浏览代码

add a new xray collection algorithm and change the threshold of invalid particles judge condition(P,Na etc)

GSP 2 月之前
父节点
当前提交
e00a59ddf0

+ 1 - 1
Bin/x64/Debug/Resources/XMLData/ResourceForMeasureSourceGrid-EN.xml

@@ -50,7 +50,7 @@
 		<collection RegName="ResGrp" grpKey="3" text="x-ray" description="">
 
 			<member itemKey="20032" itemName="" itemText="Big x-ray(ms)"/>
-			<member itemKey="20033" itemName="" itemText="ScanMode" comboContent="SpotScan,PlaneScan,ExpandScan" />
+			<member itemKey="20033" itemName="" itemText="ScanMode" comboContent="SpotScan,PlaneScan,ExpandScan,SubAreaScan" />
 			<member itemKey="20034" itemName="" itemText="ExpectCounts"/>
 			<member itemKey="20036" itemName="" itemText="BigPartThreshold(ECD/um)" description=""/>
 			<member itemKey="20037" itemName="" itemText="Small X-ray(Ms)" description=""/>

+ 1 - 1
Bin/x64/Debug/Resources/XMLData/ResourceForMeasureSourceGrid-ZH.xml

@@ -48,7 +48,7 @@
 		<collection RegName="ResGrp" grpKey="3" text="x-ray参数" description="">
 		
 			<member itemKey="20032" itemName="" itemText="x-ray时间(毫秒)" description="输入分析x-ray时间。"/>
-			<member itemKey="20033" itemName="" itemText="扫描方式" comboContent="点扫描,面扫描,扩展扫描" description="选择分析x-ray扫描方式。"/>
+			<member itemKey="20033" itemName="" itemText="扫描方式" comboContent="点扫描,面扫描,扩展扫描,子区域扫描" description="选择分析x-ray扫描方式。"/>
 			<member itemKey="20034" itemName="" itemText="期望计数率" description="输入分析x-ray计数率期望值。"/>
 			<member itemKey="20036" itemName="" itemText="分析阈值(等效圆直径/微米)" description="进行X-ray quantify 分析的最小颗粒尺寸"/>
 			<member itemKey="20037" itemName="" itemText="小颗粒x-ray时间(毫秒)" description="进行X-ray quantify 分析的最小颗粒尺寸"/>

+ 2 - 2
OTSCPP/OTSClassifyEngine/InclutionEngine/OTSClassifyEng.cpp

@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
 #include "stdafx.h"
 #include "OTSClassifyEng.h"
 #include "OTSHelper.h"
@@ -479,7 +479,7 @@ namespace OTSClassifyEngine
 			a_nIncId = OTS_PARTICLE_TYPE::INVALID;
 			return TRUE;
 		}
-		if (dPWeight > 0 || dNaWeight >  0)// contain any of P Na  then set it as invalid.
+		if (dPWeight > 20 || dNaWeight >  20)// contain any of P Na  then set it as invalid.
 		{
 			a_nIncId = OTS_PARTICLE_TYPE::INVALID;
 			return TRUE;

+ 52 - 44
OTSIncAMeasureApp/0-OTSModel/OTSDataType/COTSField.cs

@@ -1,4 +1,5 @@
-using OTSCLRINTERFACE;
+using OTSCLRINTERFACE;
+using OTSCommon.DBOperate.Model;
 using OTSMeasureApp._0_OTSModel.OTSDataType;
 using OTSModelSharp;
 using OTSModelSharp.ServiceCenter;
@@ -35,11 +36,9 @@ namespace OTSDataType
 
         protected CImageHandler m_ImagePro;
 
-        protected List<COTSParticleClr> m_listAllParticles = new List<COTSParticleClr>();//hold up all the particles abstracted from bse image;
+        protected List<COTSParticleClr> m_listInitialParticles = new List<COTSParticleClr>();//hold up all the particles abstracted from bse image;
 
-        protected List<COTSParticleClr> m_listAnalysisParticles = new List<COTSParticleClr>();// according to xraylimit constraint,pick out the first big particles.
-
-        protected List<COTSParticleClr> m_listXrayParticles = new List<COTSParticleClr>();//hold up all the particles that needing the xray data.
+        protected List<COTSParticleClr> m_listAnalysisParticles = new List<COTSParticleClr>();// hold up all the final particles that need to be saved to db ;
 
 
         private int imgheight;
@@ -59,6 +58,7 @@ namespace OTSDataType
         public int ImgWidth { get => imgwidth; set => imgwidth = value; }
         public COTSSample Sample { get => m_sample; set => m_sample = value; }
         public bool Enable { get => m_enable; set => m_enable = value; }
+  
 
         internal COTSRect GetOTSRect()
         {
@@ -105,9 +105,9 @@ namespace OTSDataType
         }
 
         private PointF m_semPos;
-        public List<COTSParticleClr> GetAllParticles()
+        public List<COTSParticleClr> GetInitialParticles()
         {
-            return m_listAllParticles;
+            return m_listInitialParticles;
         }
         public List<COTSParticleClr> GetListAnalysisParticles()
         {
@@ -115,7 +115,9 @@ namespace OTSDataType
         }
         public List<COTSParticleClr> GetListXrayParticles()
         {
-            m_listXrayParticles.Clear();
+          List<COTSParticleClr> m_listXrayParticles = new List<COTSParticleClr>();//hold up all the particles that needing the xray data.
+
+        m_listXrayParticles.Clear();
             foreach (var p in m_listAnalysisParticles)
             {
                 if (p.IsXrayParticle())
@@ -132,9 +134,9 @@ namespace OTSDataType
             m_listAnalysisParticles = value;
         }
 
-        public void SetListAllParticles(List<COTSParticleClr> value)
+        public void SetInitialParticles(List<COTSParticleClr> value)
         {
-            m_listAllParticles = value;
+            m_listInitialParticles = value;
         }
 
         public COTSField(PointF centerPoint, double a_dPixelSize)
@@ -162,7 +164,7 @@ namespace OTSDataType
             // initialization
             m_nID = -1;
             m_otsPos = new System.Drawing.Point(0, 0);
-            m_listAllParticles.Clear();
+            m_listInitialParticles.Clear();
             m_enable = true;
         }
 
@@ -185,7 +187,7 @@ namespace OTSDataType
         public Bitmap GetAnalysisParticleBlackColoredImage()
         {
             CImageHandler imghandler = new CImageHandler();
-            List<COTSParticleClr> Parts = GetAllParticles();
+            List<COTSParticleClr> Parts = GetInitialParticles();
             Bitmap img = new Bitmap(this.ImgWidth, this.ImgHeight);
             var imgparam = m_sample.GetMsrParams().GetImageProcessParam();
             var pixelsize = m_sample.CalculatePixelSize();
@@ -219,57 +221,63 @@ namespace OTSDataType
 
           
             COTSImageProcParam pImgProcessParam = pMsrParam.GetImageProcessParam();
-           
-          
+
+
             // remove BES image background
-            RemoveImgBGAndGetParticles(pImgProcessParam, pixelsize);
+        
+            if (m_pBSEImg == null)
+                return;
+            CImageHandler imghandler = new CImageHandler();
 
+            List<COTSParticleClr> allParts = new List<COTSParticleClr>();
+            imghandler.RemoveBGAndGetParts(this, pImgProcessParam, ref allParts);
             var specialPartsparam = pMsrParam.GetImageProcessParam().GetSpecialGreyRangeParam();
 
             if (specialPartsparam != null && specialPartsparam.GetIsToRun())
             {
                 List<CSpecialGrayRange> ranges = specialPartsparam.GetSpecialGreyRanges();
+                List<COTSParticleClr> allgreyRngParts = new List<COTSParticleClr>();
                 foreach (var grayRange in ranges)
                 {
                     CIntRangeClr range = new CIntRangeClr(grayRange.range.GetStart(), grayRange.range.GetEnd());
                     CDoubleRangeClr diaRange = new CDoubleRangeClr(grayRange.diameterRange.GetStart(), grayRange.diameterRange.GetEnd());
-                    GetPartsBySpecialGray(range, diaRange, pixelsize, grayRange.ifCollectXray);
+                   
+                    var pixelSize = this.GetPixelSize();
+                    List<COTSParticleClr> specialParts = new List<COTSParticleClr>();
+                    imghandler.GetParticlesBySpecialGray(m_pBSEImg, range, diaRange, pixelSize, ref specialParts);
+                    foreach (var p in specialParts)
+                    {
+                        p.SetIsXrayParticle(grayRange.ifCollectXray);
+                        allgreyRngParts.Add(p);
+
+                    }
                 }
+                allParts.AddRange(allgreyRngParts);
             }
+
             List<COTSParticleClr> m_listInnerParticles= new List<COTSParticleClr>();
-            for(var i = 0; i < m_listAllParticles.Count; i++)
+            for(var i = 0; i < allParts.Count; i++)
             {
-                var part = m_listAllParticles[i];
+                var part = allParts[i];
                 int l = 0, r = 0, t = 0, b = 0;
                 part.GetOTSRect(ref l, ref t, ref r, ref b);
                 COTSRect otsrec = new COTSRect(l, t, r, b);
                 PointF p1 = otsrec.GetCenterPoint();
                 if (m_sample.IsThisPointInMeasureArea(new Point((int)p1.X, (int)p1.Y)))
                 {
-                    m_listInnerParticles.Add(m_listAllParticles[i]);
+                    m_listInnerParticles.Add(allParts[i]);
                 }
             }
            
-            m_listAllParticles=m_listInnerParticles;
+            m_listInitialParticles=m_listInnerParticles;
 
 
-            log.Info("Find all particle num:" + GetAllParticles().Count);
+            log.Info("Find all particle num:" + GetInitialParticles().Count);
 
             return;
         }
 
-        private void RemoveImgBGAndGetParticles(COTSImageProcParam a_pImageProcessParam, double a_pixelSize)
-        {
-            if (m_pBSEImg == null)
-                return;
-            CImageHandler imghandler = new CImageHandler();
-            List<COTSParticleClr> allParts = new List<COTSParticleClr>();
-            imghandler.RemoveBGAndGetParts(this, a_pImageProcessParam, ref allParts);
-
-            m_listAllParticles = allParts;
-
-            return;
-        }
+       
         class particleCompOnArea : IComparer<COTSParticleClr>
         {
             public int Compare(COTSParticleClr x, COTSParticleClr y)
@@ -282,24 +290,24 @@ namespace OTSDataType
        
         log.Info("filter particle according to xraylimit and outermost border");
            
-           m_listAllParticles.Sort(new particleCompOnArea());
+           m_listInitialParticles.Sort(new particleCompOnArea());
 
 
 
             var listXray1 = new List<COTSParticleClr>();
            
-            if (m_listAllParticles.Count > pXRayParam.GetXrayLimit())
+            if (m_listInitialParticles.Count > pXRayParam.GetXrayLimit())
             {
                 
                 for (var i = 0; i < pXRayParam.GetXrayLimit(); i++)
                 {
-                        listXray1.Add(m_listAllParticles[i]);                  
+                        listXray1.Add(m_listInitialParticles[i]);                  
                 }
 
             }
             else
             {
-                foreach (var p in m_listAllParticles)
+                foreach (var p in m_listInitialParticles)
                 {
                         listXray1.Add(p);
                 }
@@ -800,7 +808,7 @@ namespace OTSDataType
             foreach (var p in specialParts)
             {
                 p.SetIsXrayParticle(ifXray);
-                m_listAllParticles.Add(p);
+                m_listInitialParticles.Add(p);
 
             }
 
@@ -842,7 +850,7 @@ namespace OTSDataType
 
             int nTagId = 0;
 
-            foreach (COTSParticleClr pParticle in m_listAllParticles)//m_listAllParticles memorize all the particles .
+            foreach (COTSParticleClr pParticle in m_listInitialParticles)//m_listAllParticles memorize all the particles .
             {
 
                 pParticle.SetParticleId(nTagId);//give all the conforming particles a unified sequence no.
@@ -890,9 +898,9 @@ namespace OTSDataType
 
         public void ClearAllMeausredData()
         {
-            m_listAllParticles.Clear();
+            m_listInitialParticles.Clear();
             m_listAnalysisParticles.Clear();
-            m_listXrayParticles.Clear();
+          
             m_pBSEImg = null;
 
         }
@@ -1053,7 +1061,7 @@ namespace OTSDataType
         // is empty
         public bool IsEmpty()
         {
-            return m_listAllParticles.Count == 0;
+            return m_listInitialParticles.Count == 0;
         }
         void Duplicate(COTSField a_oSource)
         {
@@ -1063,9 +1071,9 @@ namespace OTSDataType
 
 
             // copy data over
-            foreach (var pParticle in a_oSource.m_listAllParticles)
+            foreach (var pParticle in a_oSource.m_listInitialParticles)
             {
-                m_listAllParticles.Add(pParticle);
+                m_listInitialParticles.Add(pParticle);
             }
         }
 

+ 4 - 2
OTSIncAMeasureApp/0-OTSModel/OTSDataType/otsdataconst.cs

@@ -264,6 +264,7 @@ namespace OTSDataType
             MANUAL = 1,
             MATRIX=2,
             WaterShed = 3
+           
 
         }
 
@@ -300,8 +301,9 @@ namespace OTSDataType
         {
             PointMode = 0,
             FeatureMode = 1,
-            ExpandMode=2
-          
+            ExpandMode=2,
+            SubRegionMode= 3
+
         }
         public enum OTS_X_RAY_QUANTIFY_MODE
         {

+ 1 - 1
OTSIncAMeasureApp/1-OTSMeasure/Measure/1-OTSInclution/SmplMeasureInclution.cs

@@ -212,7 +212,7 @@ namespace OTSModelSharp
         }
         private void LinkParticlesByGB30834Standard(COTSField curFldData)
         {
-            var parts = curFldData.GetAllParticles();
+            var parts = curFldData.GetInitialParticles();
             
             if (parts.Count == 0)
             {

+ 93 - 19
OTSIncAMeasureApp/1-OTSMeasure/Measure/3-MeasureFlow/CSmplMeasure.cs

@@ -655,6 +655,7 @@ namespace OTSModelSharp
                             {
                                 p.SetIsXrayParticle(true);
                             }
+
                             try
                             {
                                 CollectParticlesXrayData(curFld);
@@ -769,13 +770,37 @@ namespace OTSModelSharp
             curFldData.GetOriginalParticles(m_Sample.GetMsrParams(), m_Sample.CalculatePixelSize());
             if (curFldData.Sample.GetMsrParams().GetImageProcessParam().GetBGRemoveType() == OTS_BGREMOVE_TYPE.MATRIX)
             {
-                curFldData.SetListAnalysisParticles(curFldData.GetAllParticles());
+                curFldData.SetListAnalysisParticles(curFldData.GetInitialParticles());
 
             }
-            else 
+            else if( curFldData.Sample.GetMsrParams().GetImageProcessParam().GetBGRemoveType() == OTS_BGREMOVE_TYPE.WaterShed)
+            {
+                List<COTSParticleClr> allsubRegions = new List<COTSParticleClr>();
+
+                var parts = curFldData.GetInitialParticles();
+                foreach (var p in parts)
+                {
+                    if (p.GetSubParticles().Count>0)
+                    {
+                        var subparts = p.GetSubParticles();
+                        allsubRegions.AddRange(subparts);
+                    }
+                    else
+                    {
+                        allsubRegions.Add(p);
+                    }
+                }   
+
+                curFldData.SetListAnalysisParticles(allsubRegions);
+                
+                curFldData.CalParticleImageProp(parts);//calculate particle image property such as feret diameter, DMAX etc.
+
+           
+            }
+            else            
             {
                 log.Info("Begin to filter particles!");
-                curFldData.FilterParticles(m_Sample.GetMsrParams().GetXRayParam());//filter according to the xraylimit and outermost border
+                curFldData.FilterParticles(m_Sample.GetMsrParams().GetXRayParam());//filter according to the xraylimit 
 
                 log.Info("Begin to Calculate the image property of every particle!");
                 var analysisparts = curFldData.GetListAnalysisParticles();
@@ -811,15 +836,15 @@ namespace OTSModelSharp
 
         }
 
-        
-        
-       
-       
+
+
+
+
         public virtual void CollectParticlesXrayData(COTSField curFldData)
         {
-          
+
             var allParts = curFldData.GetListXrayParticles();
-          
+
             var smallparts = new List<COTSParticleClr>();
             var bigparts = new List<COTSParticleClr>();
 
@@ -846,7 +871,7 @@ namespace OTSModelSharp
             // get x-ray parameters
             COTSXRayParam pXRayParam = m_Sample.GetMsrParams().GetXRayParam();
             var workmode = pXRayParam.GetScanMode();
-           
+
             if (workmode == OTS_X_RAY_SCAN_MODE.PointMode)
             {
 
@@ -855,8 +880,8 @@ namespace OTSModelSharp
                 if (bigparts.Count > 0)
                 {
                     nXRayAQTime = (uint)pXRayParam.GetMidAnalyAQTime();
-                    log.Info("Begin to collect xraydata:" + bigparts.Count +"(" +nXRayAQTime.ToString()+") on " + workmode.ToString());
-                    
+                    log.Info("Begin to collect xraydata:" + bigparts.Count + "(" + nXRayAQTime.ToString() + ") on " + workmode.ToString());
+
                     m_EDSController.GetXRayByParts(bigparts, nXRayAQTime, true);
 
                 }
@@ -866,7 +891,7 @@ namespace OTSModelSharp
                     nXRayAQTime = (uint)pXRayParam.GetSmallPartXrayTime();
 
                     log.Info("Begin to collect xraydata:" + smallparts.Count + "(" + nXRayAQTime.ToString() + ") on " + workmode.ToString());
-                   
+
                     m_EDSController.GetXRayByParts(smallparts, nXRayAQTime, true);
 
                 }
@@ -874,14 +899,14 @@ namespace OTSModelSharp
             }
             else if (workmode == OTS_X_RAY_SCAN_MODE.FeatureMode)
             {
-              
+
                 uint nXRayAQTime;
-               
+
                 if (bigparts.Count > 0)
                 {
-                        log.Info("Begin to collect xraydata:" + bigparts.Count + " on " + OTS_X_RAY_SCAN_MODE.FeatureMode.ToString());
-                        nXRayAQTime = (uint)pXRayParam.GetMidAnalyAQTime();
-                        m_EDSController.GetXRayByFeatures(bigparts, nXRayAQTime, true);
+                    log.Info("Begin to collect xraydata:" + bigparts.Count + " on " + OTS_X_RAY_SCAN_MODE.FeatureMode.ToString());
+                    nXRayAQTime = (uint)pXRayParam.GetMidAnalyAQTime();
+                    m_EDSController.GetXRayByFeatures(bigparts, nXRayAQTime, true);
 
                 }
                 if (smallparts.Count > 0)
@@ -918,8 +943,57 @@ namespace OTSModelSharp
 
 
             }
+            else if (workmode == OTS_X_RAY_SCAN_MODE.SubRegionMode)
+            {
 
-            return;
+                uint nXRayAQTime;
+                List<COTSParticleClr> allfldparts = curFldData.GetInitialParticles();
+                curFldData.CreateXrayList(allfldparts);
+
+                if (allfldparts.Count > 0)
+                {
+                    log.Info("Begin to collect xraydata:" + allfldparts.Count + " on " + OTS_X_RAY_SCAN_MODE.FeatureMode.ToString());
+                    nXRayAQTime = (uint)pXRayParam.GetMidAnalyAQTime();
+                    //find the biggest subparticle of every  particle and scan it.
+                    List<COTSParticleClr> scanparts = new List<COTSParticleClr>();
+                    foreach (var p in allfldparts)
+                    {
+                        if (p.GetSubParticles().Count > 0)
+                        {
+                            var subps = p.GetSubParticles();
+                            var maxP = subps[0];
+                            foreach (var sp in subps)
+                            {
+                                var area = sp.GetActualArea();
+                                if (area > maxP.GetActualArea())
+                                {
+                                    maxP = sp;
+                                }
+                            }
+                            scanparts.Add(maxP);
+
+                        }
+                        else
+                        {
+                            scanparts.Add(p);
+
+                        }
+
+
+
+                    }
+                    m_EDSController.GetXRayByParts(scanparts, nXRayAQTime, true);
+                    for (int i = 0; i < allfldparts.Count; i++)
+                    {
+                        var xray = scanparts[i].GetXray();
+                        allfldparts[i].SetXray(xray);
+
+                    }
+
+                }
+                curFldData.SetListAnalysisParticles(allfldparts);
+
+            }
         }
 
         public virtual void QuantifyParticlesXrayData(COTSField curFldData)

+ 1 - 0
OTSIncAMeasureApp/3-OTSDisplaySourceGridData/OTSSampleVisualPropertyInfo.cs

@@ -1687,6 +1687,7 @@ namespace OTSMeasureApp
                                     poPropItem.InitialSmplParameter(a_nId, nItemId, OTS_ITEM_TYPES.BUTTON, true, bShow);
                                     a_listPropItems.Add(poPropItem);
                                     break;
+                                
 
                             }
                         }

+ 97 - 35
OTSIncAMeasureApp/5-OTSMeasureStatuImageFun/OTSMeasureStatusWindow.cs

@@ -15,13 +15,11 @@ using System.Drawing.Drawing2D;
 using System.IO;
 using System.Reflection;
 using System.Windows.Forms;
-
-
 namespace OTSMeasureApp
 {
 
     public enum MeasureStateMenuType
-    {  
+    {
         //获取BSE图
         ReadBSEPic = 0,
         //设置可视化灰度
@@ -96,8 +94,8 @@ namespace OTSMeasureApp
         public OTSIncAMeasureAppForm m_MeasureAppForm;
 
 
-         int m_iWidth = 0;
-         int m_iHeight = 0;
+        int m_iWidth = 0;
+        int m_iHeight = 0;
 
         public byte[] originalBseData;
 
@@ -191,7 +189,7 @@ namespace OTSMeasureApp
 
             pictureBox2.Visible = false;
             double h = picBox.Height - GetZoomedImageRect(picBox).Height;
-            Point rulerLocation = new Point(GetZoomedImageRect(picBox).Left-10, (int)(h / 2+GetZoomedImageRect(picBox).Height - (int)(control_Ruler.Height -3)));
+            Point rulerLocation = new Point(GetZoomedImageRect(picBox).Left - 10, (int)(h / 2 + GetZoomedImageRect(picBox).Height - (int)(control_Ruler.Height - 3)));
             control_Ruler.Location = rulerLocation;
             //标尺初始化
             RulerInit();
@@ -355,7 +353,7 @@ namespace OTSMeasureApp
 
             CBSEImgClr img;
             bool rst = GetScanImage(GetIWidth(), GetIHeight(), nDwellTime, out img);
-            if (rst) 
+            if (rst)
             {
                 if (img.GetWidth() != GetIWidth() || img.GetHeight() != GetIHeight())
                 {
@@ -369,7 +367,7 @@ namespace OTSMeasureApp
                 myFld.Sample = m_MeasureAppForm.m_ProjParam.GetResultData().GetWorkingSample();
 
             }
-            
+
 
             return rst;
 
@@ -699,7 +697,8 @@ namespace OTSMeasureApp
                 if (ImgProcPrm.GetBGRemoveType() == otsdataconst.OTS_BGREMOVE_TYPE.MANUAL)
                 {
                     VisualAdjustingMenu.Enabled = true;
-                }else if (ImgProcPrm.GetBGRemoveType() == otsdataconst.OTS_BGREMOVE_TYPE.WaterShed)
+                }
+                else if (ImgProcPrm.GetBGRemoveType() == otsdataconst.OTS_BGREMOVE_TYPE.WaterShed)
                 {
                     VisualAdjustingMenu.Enabled = true;
                 }
@@ -707,7 +706,7 @@ namespace OTSMeasureApp
                 {
                     VisualAdjustingMenu.Enabled = false;
                 }
-               
+
             }
             else
             {
@@ -1177,7 +1176,7 @@ namespace OTSMeasureApp
                         }
                     }
                     control_XRayTable1.List_ShowElementInfo = list_showelementinfo;
-                    control_XRayTable1.GoodName = classifyName+ " (Dmax:"+parts[0].GetDMAX().ToString("0.##")+")";
+                    control_XRayTable1.GoodName = classifyName + " (Dmax:" + parts[0].GetDMAX().ToString("0.##") + ")";
                     //设置分析Xray数据
                     control_XRayTable1.SetXRayShowLineValue(new uint[2000], u_ElementXrayData, list_showelementinfo);
                     //需要显示计数率
@@ -1207,10 +1206,24 @@ namespace OTSMeasureApp
             foreach (var p in fldParts)
             {
                 Rectangle r = (Rectangle)p.GetParticleRect();
-                if (r.Contains(partPos))
+                if (!r.Contains(partPos))
                 {
-                    selectedPart = p;
-                    break;
+                    continue;
+
+                }
+                var feature = p.GetFeature();
+                var segs = feature.GetSegmentsList();
+                foreach (var seg in segs)
+                {
+                    if (seg.GetHeight() == dMouseImgY)
+                    {
+                        if (seg.GetStart() <= dMouseImgX && seg.GetEnd() >= dMouseImgX)
+                        {
+                            selectedPart = p;
+                            break;
+                        }
+
+                    }
 
                 }
 
@@ -1234,20 +1247,69 @@ namespace OTSMeasureApp
             var knownelements = m_MeasureAppForm.m_ProjRstData.GetWorkingSample().GetMsrParams().GetXRayParam().AnalysisElements;
             var eds = EDSController.GetEDSController(GetIWidth(), GetIHeight(), expC, ifautoid, knownelements);
 
-            bool r=false;
+            bool r = false;
             //var parts = new List<COTSParticleClr>();
             //parts.Add(selectedPart);
             if (mode == otsdataconst.OTS_X_RAY_SCAN_MODE.PointMode)
             {
-              r=  eds.GetXRayByParts(selectedParts, a_nXRayAQTime, true);
+                r = eds.GetXRayByParts(selectedParts, a_nXRayAQTime, true);
             }
             else if (mode == otsdataconst.OTS_X_RAY_SCAN_MODE.FeatureMode)
             {
-              r=  eds.GetXRayByFeatures(selectedParts, a_nXRayAQTime, true);
+                r = eds.GetXRayByFeatures(selectedParts, a_nXRayAQTime, true);
             }
             else if (mode == otsdataconst.OTS_X_RAY_SCAN_MODE.ExpandMode)
             {
-               r= eds.GetXRayByExpandFeatures(selectedParts, a_nXRayAQTime, true);
+                r = eds.GetXRayByExpandFeatures(selectedParts, a_nXRayAQTime, true);
+
+            }
+            else if (mode == otsdataconst.OTS_X_RAY_SCAN_MODE.SubRegionMode)
+            {
+
+                if (selectedParts.Count > 0)
+                {
+                    log.Info("Begin to collect xraydata:" + selectedParts.Count + " on " + otsdataconst.OTS_X_RAY_SCAN_MODE.FeatureMode.ToString());
+
+                    //find the biggest subparticle of every  particle and scan it.
+                    List<COTSParticleClr> scanparts = new List<COTSParticleClr>();
+                    foreach (var p in selectedParts)
+                    {
+                        if (p.GetSubParticles().Count > 0)
+                        {
+                            var subps = p.GetSubParticles();
+                            var maxP = subps[0];
+                            foreach (var sp in subps)
+                            {
+                                var area = sp.GetActualArea();
+                                if (area > maxP.GetActualArea())
+                                {
+                                    maxP = sp;
+                                }
+                            }
+                            scanparts.Add(maxP);
+
+                        }
+                        else
+                        {
+                            scanparts.Add(p);
+
+                        }
+
+
+
+                    }
+                    r = eds.GetXRayByParts(scanparts, a_nXRayAQTime, true);
+                    for (int i = 0; i < selectedParts.Count; i++)
+                    {
+                        var xray = scanparts[i].GetXray();
+                        selectedParts[i].SetXray(xray);
+
+                    }
+
+                }
+
+
+
 
             }
 
@@ -1259,7 +1321,7 @@ namespace OTSMeasureApp
         void ClassifyParticles(List<COTSParticleClr> parts)
         {
 
-            if (m_MeasureAppForm.m_ProjRstData.SystemTypeId == otsdataconst.OTS_SysType_ID.IncA|| m_MeasureAppForm.m_ProjRstData.SystemTypeId == otsdataconst.OTS_SysType_ID.SteelMineral)
+            if (m_MeasureAppForm.m_ProjRstData.SystemTypeId == otsdataconst.OTS_SysType_ID.IncA || m_MeasureAppForm.m_ProjRstData.SystemTypeId == otsdataconst.OTS_SysType_ID.SteelMineral)
             {
                 var smplmeasure = new CSmplMeasureIncA("", m_MeasureAppForm.m_ProjRstData.GetWorkingSample());
                 foreach (var p in parts)
@@ -1467,7 +1529,7 @@ namespace OTSMeasureApp
             string[] sArray = str.Split('X');
             if (sArray[0] != "" && sArray[1] != "")
             {
-                
+
                 SetIHeight(Convert.ToInt32(sArray[1]));
             }
             return m_iHeight;
@@ -1478,19 +1540,19 @@ namespace OTSMeasureApp
             m_iHeight = value;
         }
 
-        public  int GetIWidth()
+        public int GetIWidth()
         {
             string str = m_MeasureAppForm.m_ProjParam.GetBSEImageResolutionStr();
             string[] sArray = str.Split('X');
             if (sArray[0] != "" && sArray[1] != "")
             {
                 SetIWidth(Convert.ToInt32(sArray[0]));
-              
+
             }
             return m_iWidth;
         }
 
-        public  void SetIWidth(int value)
+        public void SetIWidth(int value)
         {
             m_iWidth = value;
         }
@@ -1570,7 +1632,7 @@ namespace OTSMeasureApp
             foreach (int i in RulerVal)
             {
                 double obj = Convert.ToInt32(control_Ruler.RulerWidth * i / 100);
-                if (obj  > 75)
+                if (obj > 75)
                 {
                     control_Ruler.RulerWidth = (int)obj;
                     control_Ruler.Value = i;
@@ -1635,7 +1697,7 @@ namespace OTSMeasureApp
         private void toolStripMenuItem1_Click(object sender, EventArgs e)
         {
             COTSSample WSample = m_MeasureAppForm.m_ProjRstData.GetWorkingSample();
-            SpecialParticleForm specialParticleForm = new SpecialParticleForm( m_MeasureAppForm, originalBseData, GetIWidth(), GetIHeight(), WSample);
+            SpecialParticleForm specialParticleForm = new SpecialParticleForm(m_MeasureAppForm, originalBseData, GetIWidth(), GetIHeight(), WSample);
             DialogResult dialogResult = specialParticleForm.ShowDialog();
             WSample.GetMsrParams().GetImageProcessParam().SetSpecialGreyRangeParam(specialParticleForm.specialGray);
         }
@@ -1646,7 +1708,7 @@ namespace OTSMeasureApp
             SetContextMenuEnabled(true);
             m_imagetype = ImageType.RemoveBGImage;
             ShowColoredRemoveBGImage();
-          
+
             panelXray.Visible = false;
         }
 
@@ -1777,19 +1839,19 @@ namespace OTSMeasureApp
             foreach (int i in RulerVal)
             {
                 double obj = Convert.ToInt32(f_ruler_size * i / 100);
-                if (obj + 20 >75)
+                if (obj + 20 > 75)
                 {
                     control_Ruler.RulerWidth = (int)obj;
                     control_Ruler.Value = i;
                     break;
                 }
             }
-            control_Ruler.SetValue(control_Ruler.RulerWidth, control_Ruler.Value.ToString()+ "um");
+            control_Ruler.SetValue(control_Ruler.RulerWidth, control_Ruler.Value.ToString() + "um");
         }
         private void pictureBox1_MouseWheel(object sender, MouseEventArgs e)
         {
-                
-       }
+
+        }
         public static Rectangle GetZoomedImageRect(PictureBox pbox)
         {
             if (pbox.Image == null) return Rectangle.Empty;
@@ -1821,19 +1883,19 @@ namespace OTSMeasureApp
             frmBCRegulate frmBC = new frmBCRegulate();
             frmBC.m_measureobj = m_MeasureAppForm.m_MsrThreadWrapper.m_measure;
             //var param = m_MeasureAppForm.m_ProjParam.GetDefaultParam().BrightnessContrastRegulationParam;
-            var param = frmBC.m_measureobj.m_pMeasureParam.GetDefaultParam().BrightnessContrastRegulationParam;  
+            var param = frmBC.m_measureobj.m_pMeasureParam.GetDefaultParam().BrightnessContrastRegulationParam;
             frmBC.brightphaseMaterial = param.brightphaseelement;
             frmBC.darkphaseMaterial = param.darkphaseelement;
             frmBC.brightphasevalue = param.brightphaseGrayvalue;
             frmBC.darkphasevalue = param.darkphaseGrayvalue;
             frmBC.stdPos = param.stdMaterialOTSPos;
-            frmBC.mag=param.mag;
+            frmBC.mag = param.mag;
             frmBC.initialBrightness = param.initialBrightness;
             frmBC.initialContrast = param.initialContrast;
-           frmBC.autoregulateType = param.autoRegulateType;
+            frmBC.autoregulateType = param.autoRegulateType;
             frmBC.period = param.period;
-            frmBC.stageData = m_MeasureAppForm.m_ProjParam.GetDefaultParam().GetStageDataParam();  
-            frmBC.isToRun=param.toRun;
+            frmBC.stageData = m_MeasureAppForm.m_ProjParam.GetDefaultParam().GetStageDataParam();
+            frmBC.isToRun = param.toRun;
             frmBC.Show();
         }
         #endregion

+ 110 - 106
OTSIncAMeasureApp/ServiceCenter/CImageHandler.cs

@@ -1,21 +1,16 @@
 using OTSDataType;
-using OTSModelSharp.ImageProcess;
 using System;
 using System.Collections.Generic;
 using System.Drawing;
 using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 using static OTSDataType.otsdataconst;
 
 namespace OTSModelSharp.ServiceCenter
 {
     using OpenCvSharp;
     using OTSCLRINTERFACE;
-    using OTSIMGPROC;
     using System.Drawing.Imaging;
     using System.Runtime.InteropServices;
-    using System.Windows;
 
     public class CImageHandler
     {
@@ -36,7 +31,7 @@ namespace OTSModelSharp.ServiceCenter
         /// <returns>位图</returns>    
         public static Bitmap ToGrayBitmap(byte[] data, int width, int height)
         {
-            if (width == 0 || height == 0) 
+            if (width == 0 || height == 0)
                 return null;
             //// 申请目标位图的变量,并将其内存区域锁定    
             Bitmap bmp = new Bitmap(width, height, PixelFormat.Format8bppIndexed);
@@ -106,31 +101,31 @@ namespace OTSModelSharp.ServiceCenter
         }
 
         //获取测量的BSE图
-     
+
         public bool GetBSEImage(COTSField tempFld, COTSImageProcParam ImgProcPrm, double pixelSize, int iWidth, int iHeight, ref byte[] BSEImageNoBG)
         {
             Rectangle rect = new Rectangle();
             rect.Height = iHeight;
             rect.Width = iWidth;
-           
+
             CBSEImgClr pBSEImageOut = new CBSEImgClr(rect);
-            
-           
-       
+
+
+
             if (null == ImgProcPrm)
             {
                 return false;
             }
 
 
-            RemoveBackGround(tempFld, ImgProcPrm, pixelSize ,ref pBSEImageOut);
+            RemoveBackGround(tempFld, ImgProcPrm, pixelSize, ref pBSEImageOut);
 
 
             BSEImageNoBG = pBSEImageOut.GetImageDataPtr();
 
             return true;
         }
-       
+
 
         /// <summary>
         /// 获取测量的BSE图
@@ -150,20 +145,20 @@ namespace OTSModelSharp.ServiceCenter
             CBSEImgClr pBSEImageIn = new CBSEImgClr(rect);
             CBSEImgClr pBSEImageOut = new CBSEImgClr(rect);
 
-           
-           
-            pBSEImageIn.SetImageData(BSEImage, iWidth, iHeight );
+
+
+            pBSEImageIn.SetImageData(BSEImage, iWidth, iHeight);
+
 
 
 
-         
             CIntRangeClr cIntRangeClr = new CIntRangeClr();
             cIntRangeClr.SetStart(grayStart);
             cIntRangeClr.SetEnd(grayEnd);
 
             //ImageProForClr imgpro = new ImageProForClr();
-            int num=0;
-            imgProEngine.GetSpecialGrayRangeImage(pBSEImageIn, cIntRangeClr, pBSEImageOut,ref num);
+            int num = 0;
+            imgProEngine.GetSpecialGrayRangeImage(pBSEImageIn, cIntRangeClr, pBSEImageOut, ref num);
 
             for (int i = 0; i < iWidth; i++)
             {
@@ -175,24 +170,24 @@ namespace OTSModelSharp.ServiceCenter
                         var originalBse = pBSEImageIn.GetBSEValue(i, j);
                         pBSEImageOut.SetBSEValue(i, j, originalBse);
                     }
-                    else 
+                    else
                     {
                         pBSEImageOut.SetBSEValue(i, j, 255);
                     }
-                  
-                
+
+
                 }
-            
+
             }
-            
+
 
             BSEImageNoBG = pBSEImageOut.GetImageDataPtr();
 
             return true;
         }
-        public bool GetColoredImage(COTSField tempFld, COTSImageProcParam ImgProcPrm, double pixelSize,  int iWidth, int iHeight, ref CBSEImgClr a_pImgOut, ref Bitmap BSEImageNoBG)
+        public bool GetColoredImage(COTSField tempFld, COTSImageProcParam ImgProcPrm, double pixelSize, int iWidth, int iHeight, ref CBSEImgClr a_pImgOut, ref Bitmap BSEImageNoBG)
         {
-         
+
 
             if (null == ImgProcPrm)
             {
@@ -205,15 +200,15 @@ namespace OTSModelSharp.ServiceCenter
             return true;
         }
         // remove background
-        private void RemoveBackGround(COTSField tempFld,  COTSImageProcParam a_pImgProcessParam, double a_pixelSize, ref CBSEImgClr a_pImgOut)
+        private void RemoveBackGround(COTSField tempFld, COTSImageProcParam a_pImgProcessParam, double a_pixelSize, ref CBSEImgClr a_pImgOut)
         {
-       
+
 
             List<COTSParticleClr> parts = new List<COTSParticleClr>();
             List<COTSParticleClr> specialGreyparts = new List<COTSParticleClr>();
             var ecdrange = a_pImgProcessParam.GetIncAreaRange();
             var originalBse = tempFld.GetBSEImage();
-           
+
             if (!RemoveBGAndGetParts(tempFld, a_pImgProcessParam, ref parts))
             {
                 return;
@@ -225,8 +220,8 @@ namespace OTSModelSharp.ServiceCenter
             {
                 var param = a_pImgProcessParam.GetSpecialGreyRangeParam();
                 var ranges = param.GetSpecialGreyRanges();
-               
-                
+
+
                 foreach (var r in ranges)
                 {
                     CIntRangeClr r1 = new CIntRangeClr();
@@ -239,7 +234,7 @@ namespace OTSModelSharp.ServiceCenter
 
                     GetParticlesBySpecialGray(originalBse, r1, r2, a_pixelSize, ref specialGreyparts);
                 }
-              
+
             }
 
 
@@ -270,10 +265,10 @@ namespace OTSModelSharp.ServiceCenter
 
             foreach (var p in parts)
             {
-              
+
                 foreach (var s in p.GetFeature().GetSegmentsList())
                 {
-                   
+
                     for (int i = s.GetStart(); i < s.GetStart() + s.GetLength(); i++)
                     {
                         var bseValue = originalBse.GetBSEValue(i, s.GetHeight());
@@ -283,9 +278,9 @@ namespace OTSModelSharp.ServiceCenter
 
 
             }
-           
-          
-          
+
+
+
             return;
         }
         private void RemoveBGAndGetColoredParts(COTSField tempFld, COTSImageProcParam a_pImgProcessParam, double a_pixelSize, ref CBSEImgClr a_pImgOut, ref Bitmap a_pBmpOut)
@@ -295,17 +290,44 @@ namespace OTSModelSharp.ServiceCenter
             List<COTSParticleClr> parts = new List<COTSParticleClr>();
             List<COTSParticleClr> specialGreyparts = new List<COTSParticleClr>();
             var ecdrange = a_pImgProcessParam.GetIncAreaRange();
-          
-            if (!RemoveBGAndGetParts(tempFld, a_pImgProcessParam,  ref parts))
+
+            if (!RemoveBGAndGetParts(tempFld, a_pImgProcessParam, ref parts))
             {
                 return;
             }
+            if (a_pImgProcessParam.GetBGRemoveType() == OTS_BGREMOVE_TYPE.WaterShed)
+            {
+                List<COTSParticleClr> allsubRegions = new List<COTSParticleClr>();
+
+
+                foreach (var p in parts)
+                {
+                    if (p.GetSubParticles().Count > 0)
+                    {
+                        var subparts = p.GetSubParticles();
+                        allsubRegions.AddRange(subparts);
+                    }
+                    else
+                    {
+                        allsubRegions.Add(p);
+                    }
+                }
+
+                tempFld.SetListAnalysisParticles(allsubRegions);
+            }
+            else 
+            {
+                tempFld.SetListAnalysisParticles(parts);
+            }
+
+
             tempFld.CalParticleImageProp(parts);
+           
             tempFld.SelectParticlesAccordingImgProp(a_pImgProcessParam);
-            parts = tempFld.GetListAnalysisParticles();
+            var Analysisparts = tempFld.GetListAnalysisParticles();
             var a_pImgIn = tempFld.GetBSEImage();
             Random c = new Random();
-           
+
 
 
             for (int i = 0; i < a_pBmpOut.Width; i++)
@@ -314,26 +336,26 @@ namespace OTSModelSharp.ServiceCenter
                 {
                     a_pBmpOut.SetPixel(i, j, Color.White);
                 }
-               
+
             }
-            
 
 
-            foreach (var p in parts)
+
+            foreach (var p in Analysisparts)
             {
 
                 Color cValue = GetRandomColor30(c);
 
                 //Color cValue = p.GetTypeColor();
                 foreach (var s in p.GetFeature().GetSegmentsList())
-                    {
+                {
 
-                        for (int i = s.GetStart(); i < s.GetStart() + s.GetLength(); i++)
-                        {
+                    for (int i = s.GetStart(); i < s.GetStart() + s.GetLength(); i++)
+                    {
                         var y = s.GetHeight();
                         a_pBmpOut.SetPixel(i, y, cValue);
-                        }
                     }
+                }
 
             }
 
@@ -373,22 +395,22 @@ namespace OTSModelSharp.ServiceCenter
 
                     }
                     tempFld.CalParticleImageProp(specialGreyparts);
-                    parts.AddRange(specialGreyparts);
-                    tempFld.SetListAnalysisParticles(parts);
+                    Analysisparts.AddRange(specialGreyparts);
+                    tempFld.SetListAnalysisParticles(Analysisparts);
                     //tempFld.SelectParticlesAccordingImgProp(a_pImgProcessParam);    
-                   
-                   
+
+
                 }
-                
+
 
             }
-           
+
 
             Graphics graphics = Graphics.FromImage(a_pBmpOut);
 
             // 绘制一个红色矩形
             Pen pen = new Pen(Color.Red, 1);
-            var overlap=a_pImgProcessParam.GetOverlapParam();
+            var overlap = a_pImgProcessParam.GetOverlapParam();
             if (overlap > 0)
             {
                 int overlapPixels = (int)(overlap / a_pixelSize);
@@ -400,11 +422,11 @@ namespace OTSModelSharp.ServiceCenter
 
             return;
         }
-        public void GetImageWithBlackColoredParts(List<COTSParticleClr> analysitParts,COTSImageProcParam a_pImgProcessParam,double a_pixelSize, ref Bitmap a_pBmpOut)
+        public void GetImageWithBlackColoredParts(List<COTSParticleClr> analysitParts, COTSImageProcParam a_pImgProcessParam, double a_pixelSize, ref Bitmap a_pBmpOut)
         {
 
 
-          
+
 
 
             for (int i = 0; i < a_pBmpOut.Width; i++)
@@ -470,7 +492,7 @@ namespace OTSModelSharp.ServiceCenter
             foreach (var p in analysitParts)
             {
 
-                Color cValue = ColorTranslator.FromHtml(p.GetTypeColor()) ;
+                Color cValue = ColorTranslator.FromHtml(p.GetTypeColor());
                 foreach (var s in p.GetFeature().GetSegmentsList())
                 {
 
@@ -499,7 +521,7 @@ namespace OTSModelSharp.ServiceCenter
 
         public Color GetRandomColor30(Random r)
         {
-           
+
             int n = r.Next(0, 31);
 
             Color ret_color;
@@ -606,21 +628,21 @@ namespace OTSModelSharp.ServiceCenter
 
             return ret_color;
         }
-      
 
-        public bool CalParticleImageProp( COTSParticleClr part, double a_pixelSize)
+
+        public bool CalParticleImageProp(COTSParticleClr part, double a_pixelSize)
         {
-           
-            imgProEngine.CalcuParticleImagePropertes(part,a_pixelSize);
-            
+
+            imgProEngine.CalcuParticleImagePropertes(part, a_pixelSize);
+
             return true;
         }
-      
 
 
-        public bool RemoveBGAndGetParts(COTSField currentField, COTSImageProcParam a_pImgProcessParam,ref List<COTSParticleClr> parts)
+
+        public bool RemoveBGAndGetParts(COTSField currentField, COTSImageProcParam a_pImgProcessParam, ref List<COTSParticleClr> parts)
         {
-           var a_pixelSize = currentField.GetPixelSize();
+            var a_pixelSize = currentField.GetPixelSize();
             COTSImgProcPrmClr prm = GetImageProcPrmClr(a_pImgProcessParam);
             COTSFieldDataClr flddataclr = new COTSFieldDataClr();
             PointF fldpos = currentField.GetOTSPosition();
@@ -632,46 +654,28 @@ namespace OTSModelSharp.ServiceCenter
             double right = fldpos.X + currentField.ImgWidth * a_pixelSize / 2;
             double bottom = fldpos.Y - currentField.ImgHeight * a_pixelSize / 2;
             flddataclr.SetOTSRect(left, top, right, bottom);
-          
+
             if (!imgProEngine.GetFieldDataFromImage(currentField.GetBSEImage(), prm, a_pixelSize, flddataclr))
             {
                 return false;
             }
             List<COTSParticleClr> originalParts = flddataclr.GetParticleList();
-           
-            if(a_pImgProcessParam.GetBGRemoveType() == OTS_BGREMOVE_TYPE.WaterShed)
-            {
-                foreach(var p in originalParts)
-                {
-                    if (p.GetSubParticles().Count > 0)
-                    {
-                        parts.AddRange(p.GetSubParticles());
-                    }
-                    else
-                    {
-                        parts.Add(p);
-                    }
-                  
-                }
-                currentField.SetListAnalysisParticles(parts);
-            }
-            else
-            {
-                parts = originalParts;
-            }
+            parts = originalParts;
+
+
+
+
+
 
-            currentField.SetListAnalysisParticles(parts);
-          
-          
             return true;
 
         }
-        public bool GetParticlesBySpecialGray(CBSEImgClr img, CIntRangeClr grayrange, CDoubleRangeClr diameterRange,double a_pixelSize, ref List<COTSParticleClr> parts)
+        public bool GetParticlesBySpecialGray(CBSEImgClr img, CIntRangeClr grayrange, CDoubleRangeClr diameterRange, double a_pixelSize, ref List<COTSParticleClr> parts)
         {
-          
+
 
             COTSFieldDataClr flddataclr = new COTSFieldDataClr();
-            imgProEngine.GetParticlesBySpecialPartGrayRange(img, grayrange,diameterRange,a_pixelSize, flddataclr);
+            imgProEngine.GetParticlesBySpecialPartGrayRange(img, grayrange, diameterRange, a_pixelSize, flddataclr);
 
             parts = flddataclr.GetParticleList();
             return true;
@@ -689,14 +693,14 @@ namespace OTSModelSharp.ServiceCenter
             prmclr.SetParticleGray(r3);
             prmclr.SetBGRemoveType((int)a_oSource.GetBGRemoveType());
             prmclr.SetAutoBGRemoveType((int)a_oSource.GetAutoBGRemoveType());
-          
+
             prmclr.SetOverlapParam(a_oSource.GetOverlapParam());
             prmclr.SetMatrixStep(a_oSource.MatrixStep);
-            
+
 
             return prmclr;
         }
-        public  bool CalculateBrightnessDarkGrayByOtsu(CBSEImgClr bseimg, ref int bright, ref int dark)
+        public bool CalculateBrightnessDarkGrayByOtsu(CBSEImgClr bseimg, ref int bright, ref int dark)
         {
             if (bseimg == null || bseimg.GetImageDataPtr() == null)
             {
@@ -704,10 +708,10 @@ namespace OTSModelSharp.ServiceCenter
                 dark = 0;
                 return false;
             }
-       
-          
+
+
             return imgProEngine.CalcuBrightPhaseDarkPhaseGrayByOtsu(bseimg, ref bright, ref dark);
-        }   
+        }
 
         public bool MergeBigBoundaryParticles(List<COTSField> allFields, double pixelSize, int scanFieldSize, System.Drawing.Size ResolutionSize, ref List<COTSParticleClr> mergedParts)
         {
@@ -717,7 +721,7 @@ namespace OTSModelSharp.ServiceCenter
                 COTSFieldDataClr fldclr = new COTSFieldDataClr();
                 PointF p1 = f.GetOTSPosition();
                 System.Drawing.Point p2 = new System.Drawing.Point((int)p1.X, (int)p1.Y);
-                fldclr.SetPosition((int)p1.X,(int)p1.Y);
+                fldclr.SetPosition((int)p1.X, (int)p1.Y);
                 fldclr.SetImageWidth(f.ImgWidth);
                 fldclr.SetImageHeight(f.ImgHeight);
                 var parts = f.GetListAnalysisParticles();
@@ -727,13 +731,13 @@ namespace OTSModelSharp.ServiceCenter
                 }
                 fldclrs.Add(fldclr);
             }
-           
+
 
             imgProEngine.MergeBigBoundaryParticles(fldclrs, pixelSize, scanFieldSize, ResolutionSize, mergedParts);
             return true;
 
         }
-       
+
         /// <summary>
         /// 根据Segment寻找边缘坐标点
         /// </summary>
@@ -743,7 +747,7 @@ namespace OTSModelSharp.ServiceCenter
         /// <returns></returns>
         public static List<System.Drawing.Point> FindContoursBySegment(int width, int height, List<COTSSegmentClr> segmentClrs)
         {
-            List<System.Drawing.Point> points = new List<System.Drawing.Point>(); 
+            List<System.Drawing.Point> points = new List<System.Drawing.Point>();
             using (Mat mat = new Mat(height, width, MatType.CV_8UC1, new Scalar(0)))
             {
                 for (int i = 0; i < segmentClrs.Count; i++)
@@ -768,6 +772,6 @@ namespace OTSModelSharp.ServiceCenter
             return points;
         }
 
-       
+
     }
 }

+ 2 - 13
OTSIncAMeasureApp/ServiceCenter/CPP(Bruker)API/EDSController.cs

@@ -303,11 +303,6 @@ namespace OTSModelSharp.ServiceCenter
             return eds.GetExpectCount();
         }
 
-        //public bool GetIfDelayQuantify()
-        //{
-        //    return delayQuant;
-        //}
-
         public void SetQuantifiCationParam(bool IfAutoId, string knownElements)
         {
             eds.SetQuantificationParam(IfAutoId, knownElements);
@@ -343,10 +338,7 @@ namespace OTSModelSharp.ServiceCenter
 
             COTSParticleClr[] parts = a_listParticles.ToArray();
 
-            //if (delayQuant)
-            //{
-            //    a_bElementInfo = false;
-            //}
+            
             result = eds.GetXRayByFeatures((uint)a_nXRayAQTime, parts, a_bElementInfo);
 
 
@@ -362,9 +354,6 @@ namespace OTSModelSharp.ServiceCenter
             return result;
         }
 
-        //public bool GetIfDelayQuantify()
-        //{
-        //    return false;
-        //}
+      
     }
 }

+ 0 - 5
OTSIncAMeasureApp/ServiceCenter/FEIAutoScript/FEIEDSController.cs

@@ -169,11 +169,6 @@ namespace OTSMeasureApp.ServiceCenter
             return AnalyExpCount;
         }
 
-        //public bool GetIfDelayQuantify()
-        //{
-        //    return false;
-        //}
-
         public void SetQuantifiCationParam(bool IfAutoId, string knownElements)
         {
             ApiClass.SetQuantificationParam(IfAutoId, knownElements);