浏览代码

remove true and false judgment in the FieldImageProcess procedure.

gsp 4 年之前
父节点
当前提交
433ec54b48

+ 34 - 46
OTSIncAMeasureApp/0-OTSModel/Measure/1-OTSInclution/SmplMeasureInclution.cs

@@ -39,29 +39,21 @@ namespace OTSModelSharp
             //first step:remove background of the bse image and compound all the finded particles.
             COTSXRayParam pXRayParam = m_Sample.GetMsrParams().GetXRayParam();
             loger.Info("Begin to process image and get all particles!");
-            if (!GetOriginalParticles())
-            {
-                StartSaveFileThread(curFldData);
-                loger.Error("ImageProcess: failed to find any particles.");
-                return false;
-            }
+            GetOriginalParticles();
+            
             // second step :filter the finded particles.
             loger.Info("Begin to filter particles!");
-            if (!FilterParticles())
-            {
-                StartSaveFileThread(curFldData);
-                loger.Info("ImageProcess: there is no particles to be analyzed.");
-                return false;
-            }
+            FilterParticles();
+      
             if (pXRayParam.GetUsingXray() == (int)OTS_USING_X_RAY.Yes)
             {
                 Thread.Sleep(1000);
-                if (!CollectParticlesXrayData())
-                {
-                    StartSaveFileThread(curFldData);
-                    loger.Error("ImageProcess: failed to collect xray data!");
-                    return false;
-                }
+                CollectParticlesXrayData();
+                //{
+                //    StartSaveFileThread(curFldData);
+                //    loger.Error("ImageProcess: failed to collect xray data!");
+                //    return false;
+                //}
                 Thread.Sleep(1000);
             }
             loger.Info("Begin to Calculate the image property of every particle!");
@@ -131,7 +123,7 @@ namespace OTSModelSharp
             }
         }
 
-        public bool FilterParticles()
+        public void FilterParticles()
         {
             // remove over sized particles, too small particles and get a analysis particles list
             // get pixel size
@@ -157,12 +149,12 @@ namespace OTSModelSharp
             if (curFldData.NoAnalysisParticle())
             {
                 loger.Info("There's no particles to be analysed!");
-                return false;
+                //return false;
             }
-            return true;
+            return ;
         }
 
-        public bool CollectParticlesXrayData()
+        public void CollectParticlesXrayData()
         {
             // get x-ray parameters
             COTSXRayParam pXRayParam = m_Sample.GetMsrParams().GetXRayParam();
@@ -184,30 +176,30 @@ namespace OTSModelSharp
             if (xraymode == OTS_X_RAY_SCAN_MODE.FeatureMode)
             {
                 loger.Info("Begin  feature mode xray collection!AQTime:"+nXRayAQTime+" xrayNum:"+ listAnalysisparts.Count);
-                if (!m_EDSHardwareMgr.GetXRayByFeatures(listAnalysisparts, nXRayAQTime, true))
-                {
-                    loger.Error("ImageProcess: call GetXRayByFeatures method.");
-                    pStatus.SetStatus(OTS_MSR_SAMPLE_STATUS.FAILED);
-                    StartSaveFileThread(curFldData);
-                    return false;
-                }
+                m_EDSHardwareMgr.GetXRayByFeatures(listAnalysisparts, nXRayAQTime, true);
+                //{
+                //    loger.Error("ImageProcess: call GetXRayByFeatures method.");
+                //    pStatus.SetStatus(OTS_MSR_SAMPLE_STATUS.FAILED);
+                //    StartSaveFileThread(curFldData);
+                //    return false;
+                //}
 
             }
             else 
             {
                 loger.Info("Begin  point mode xray collection!AQTime:" + nXRayAQTime + " xrayNum:" + listAnalysisparts.Count);
                 // get x-ray list (analysis) by points
-                if (!m_EDSHardwareMgr.GetXRayByPoints(listAnalysisparts, nXRayAQTime, true))
-                { // failed to call GetXRayByPoints method
-                    loger.Error("ImageProcess: call GetXRayByPoints method.");
-                    pStatus.SetStatus(OTS_MSR_SAMPLE_STATUS.FAILED);
-                    StartSaveFileThread(curFldData);
-                    return false;
-                }
+                m_EDSHardwareMgr.GetXRayByPoints(listAnalysisparts, nXRayAQTime, true);
+                //{ // failed to call GetXRayByPoints method
+                //    loger.Error("ImageProcess: call GetXRayByPoints method.");
+                //    pStatus.SetStatus(OTS_MSR_SAMPLE_STATUS.FAILED);
+                //    StartSaveFileThread(curFldData);
+                //    return false;
+                //}
 
             }
          
-            return true;
+            return ;
         }
 
       
@@ -275,7 +267,7 @@ namespace OTSModelSharp
         }
      
 
-        public bool GetOriginalParticles()
+        public void GetOriginalParticles()
         {
             // measure status
             CMsrSampleStatus pStatus = m_Sample.GetMsrStatus();
@@ -285,12 +277,8 @@ namespace OTSModelSharp
             COTSImageProcParam pImgProcessParam = pMsrParam.GetImageProcessParam();
 
             // remove BES image background
-            if (!curFldData.RemoveBSEImageBG(pImgProcessParam))
-            { // failed to call RemoveBSEImageBG method
-                loger.Error("ImageProcess: call RemoveBSEImageBG method.");
-                pStatus.SetStatus(OTS_MSR_SAMPLE_STATUS.FAILED);
-                return false;
-            }
+            curFldData.RemoveBSEImageBG(pImgProcessParam);
+            
         
 
 
@@ -298,9 +286,9 @@ namespace OTSModelSharp
             if (curFldData.NoParticle())
             { // empty fields
                 loger.Info("ImageProcess: empty field.");
-                return false;
+                //return false;
             }
-            return true;
+            return ;
         }
         public bool SaveFieldFiles(COTSFieldData fldData,string filedFileFoler)
         {

+ 53 - 53
OTSIncAMeasureApp/0-OTSModel/Measure/2-OTSCleanliness/SmplMeasureCleanliness.cs

@@ -32,26 +32,26 @@ namespace OTSModelSharp
             CFieldDataClean curFldDataMgr = new CFieldDataClean( a_BSEImg,m_Sample.CalculatePixelSize());
             curFldDataMgr.SetId(nNewFieldId);
             curFldDataMgr.SetPosition(fldCenter);
-            if (!GetOriginalParticles())
-            {
-                StartSaveFileThread(curFldDataMgr);
-                loger.Error("ImageProcess: failed to find any particles.");
-                return false;
-            }
+            GetOriginalParticles();
+            //{
+            //    StartSaveFileThread(curFldDataMgr);
+            //    loger.Error("ImageProcess: failed to find any particles.");
+            //    return false;
+            //}
             // second step :filter the finded particles.
-            if (!FilterParticles(curFldDataMgr))
-            {
-                StartSaveFileThread(curFldDataMgr);
-                loger.Info("ImageProcess: there is no particles to be analyzed.");
-                return false;
-            }
+            FilterParticles(curFldDataMgr);
+            //{
+            //    StartSaveFileThread(curFldDataMgr);
+            //    loger.Info("ImageProcess: there is no particles to be analyzed.");
+            //    return false;
+            //}
             //collect xray data.
-            if (!CollectParticlesXrayData(curFldDataMgr))
-            {
-                StartSaveFileThread(curFldDataMgr);
-                loger.Info("ImageProcess: there is no particles to be analyzed.");
-                return false;
-            }
+            CollectParticlesXrayData(curFldDataMgr);
+            //{
+            //    StartSaveFileThread(curFldDataMgr);
+            //    loger.Info("ImageProcess: there is no particles to be analyzed.");
+            //    return false;
+            //}
 
             //special treatment.
             //ParticleSpecialTreatment();
@@ -120,7 +120,7 @@ namespace OTSModelSharp
             }
         }
 
-        public bool FilterParticles(CFieldDataClean fld)
+        public void FilterParticles(CFieldDataClean fld)
         {
             // 1)remove over sized particles, too small particles and get a analysis particles list
            
@@ -134,7 +134,7 @@ namespace OTSModelSharp
             curFldData.FilterParticles(pImgProcessParam, dPixelSize);
             if (curFldData.NoAnalysisParticle())
             {
-                return false;
+                loger.Warn("There's no analysis particles!");
             }
             //2) according to the quantify threshold size value saperate the analysis particles into two group :the bigparticles and the smallparticles.
 
@@ -195,10 +195,10 @@ namespace OTSModelSharp
             loger.Info("SmallQuantifyParts: " + smallparts.Count);
             loger.Info("BigQuantifyParts: " + bigparts.Count);
 
-            return true;
+            return ;
         }
 
-        public bool CollectParticlesXrayData(CFieldDataClean fld)
+        public void CollectParticlesXrayData(CFieldDataClean fld)
         {
             // get x-ray parameters
             COTSXRayParam pXRayParam = m_Sample.GetMsrParams ().GetXRayParam();
@@ -222,13 +222,13 @@ namespace OTSModelSharp
                 
             // get x-ray list (analysis) by particle features
             nXRayAQTime = (uint)pXRayParam.GetMidAnalyAQTime();
-            if (!m_EDSHardwareMgr.GetXRayByFeatures(bigparts, nXRayAQTime, true))
-            {
-                loger.Error("ImageProcess: call GetXRayByFeatures method.");
-                pStatus.SetStatus(OTS_MSR_SAMPLE_STATUS.FAILED);
-                StartSaveFileThread(curFldData);
-                return false;
-            }
+            m_EDSHardwareMgr.GetXRayByFeatures(bigparts, nXRayAQTime, true);
+            //{
+            //    loger.Error("ImageProcess: call GetXRayByFeatures method.");
+            //    pStatus.SetStatus(OTS_MSR_SAMPLE_STATUS.FAILED);
+            //    StartSaveFileThread(curFldData);
+            //    return false;
+            //}
          
 
 
@@ -236,15 +236,15 @@ namespace OTSModelSharp
             nXRayAQTime = (uint)pXRayParam.GetFastXrayTime();
 
             // get x-ray list (analysis) by points
-            if (!m_EDSHardwareMgr.GetXRayByPoints(smallparts, nXRayAQTime, true))
-            { // failed to call GetXRayByPoints method
+            m_EDSHardwareMgr.GetXRayByPoints(smallparts, nXRayAQTime, true);
+            //{ // failed to call GetXRayByPoints method
 
-                loger.Error("ImageProcess: call GetXRayByPoints method.");
-                pStatus.SetStatus(OTS_MSR_SAMPLE_STATUS.FAILED);
-                StartSaveFileThread(curFldData);
-                return false;
-            }
-            return true;
+            //    loger.Error("ImageProcess: call GetXRayByPoints method.");
+            //    pStatus.SetStatus(OTS_MSR_SAMPLE_STATUS.FAILED);
+            //    StartSaveFileThread(curFldData);
+            //    return false;
+            //}
+            return ;
         }
 
         public void ParticleSpecialTreatment(CFieldDataClean fld)
@@ -275,14 +275,14 @@ namespace OTSModelSharp
                     partsMax.Add(p.Key);
                 }
                 List<CPosXrayClr> maxEDSXrays = new List<CPosXrayClr>();
-                if (!m_EDSHardwareMgr.GetXRayByFeatures(partsMax, edsTime, true))
-                {
-                    loger.Error("ImageProcess: call GetXRayByFeatures method for MaxEDS");
-                   m_Sample.GetMsrStatus(). SetStatus(OTS_MSR_SAMPLE_STATUS.FAILED);
-                    StartSaveFileThread(curFldData);
+                m_EDSHardwareMgr.GetXRayByFeatures(partsMax, edsTime, true);
+                //{
+                //    loger.Error("ImageProcess: call GetXRayByFeatures method for MaxEDS");
+                //   m_Sample.GetMsrStatus(). SetStatus(OTS_MSR_SAMPLE_STATUS.FAILED);
+                //    StartSaveFileThread(curFldData);
 
-                    return;
-                }
+                //    return;
+                //}
 
 
             }
@@ -317,7 +317,7 @@ namespace OTSModelSharp
             StartSaveFileThread(curFldData);
         }
 
-        public bool GetOriginalParticles()
+        public void GetOriginalParticles()
         {
             // measure status
             CMsrSampleStatus pStatus = m_Sample.GetMsrStatus();
@@ -328,20 +328,20 @@ namespace OTSModelSharp
             COTSImageProcParam pImgProcessParam = pMsrParam.GetImageProcessParam();
 
             // remove BES image background
-            if (!curFldData.RemoveBSEImageBG(pImgProcessParam))
-            { // failed to call RemoveBSEImageBG method
-                loger.Error("ImageProcess: call RemoveBSEImageBG method.");
-                pStatus.SetStatus(OTS_MSR_SAMPLE_STATUS.FAILED);
-                return false;
-            }
+            curFldData.RemoveBSEImageBG(pImgProcessParam);
+            //{ // failed to call RemoveBSEImageBG method
+            //    loger.Error("ImageProcess: call RemoveBSEImageBG method.");
+            //    pStatus.SetStatus(OTS_MSR_SAMPLE_STATUS.FAILED);
+            //    return false;
+            //}
 
             // check if this is an empty image
             if (curFldData.NoParticle())
             { // empty fields
                 loger.Info("ImageProcess: empty field.");
-                return false;
+                //return false;
             }
-            return true;
+            return ;
         }
         public bool ClassifyQuantifyParticles(List<COTSParticleClr> a_listAnalysisParticles, string libname)// classify particles
         {

+ 2 - 2
OTSIncAMeasureApp/0-OTSModel/Measure/GetBSEPic/COTSFieldData.cs

@@ -103,13 +103,13 @@ namespace OTSModelSharp
             m_pBSEImg = a_pBSEImg;
         }
 
-        public bool RemoveBSEImageBG(COTSImageProcParam a_pImageProcessParam)
+        public void RemoveBSEImageBG(COTSImageProcParam a_pImageProcessParam)
         {
             CImageHandler imghandler = new CImageHandler();
             imghandler.RemoveBSEImageBG(m_pBSEImg, a_pImageProcessParam, ref m_listParticles);
 
            
-            return true;
+            return ;
         }
         public bool CalParticleImageProp(List<COTSParticleClr> particles)
         {

+ 3 - 3
OTSIncAMeasureApp/0-OTSModel/Measure/GetBSEPic/CSmplMeasure.cs

@@ -634,12 +634,12 @@ namespace OTSModelSharp
                     if (rst == true)
                     {
                         // is the field data empty
-                        if (!curFldData.IsEmpty())
-                        {
+                        //if (!curFldData.IsEmpty())
+                        //{
                             // add the field into the field
                             m_pSampleRstFile.AddAField(curFldData);
 
-                        }
+                        //}
                     }
 
 

+ 4 - 4
OTSIncAMeasureApp/0-OTSModel/ServiceCenter/EDSController.cs

@@ -28,7 +28,7 @@ namespace OTSModelSharp.ServiceInterface
 
 
 
-        public bool GetXRayByFeatures(List<COTSParticleClr> a_listParticles,  double a_nXRayAQTime, bool a_bElementInfo)
+        public void GetXRayByFeatures(List<COTSParticleClr> a_listParticles,  double a_nXRayAQTime, bool a_bElementInfo)
         {
 
            
@@ -40,10 +40,10 @@ namespace OTSModelSharp.ServiceInterface
 
 
 
-            return true;
+            
         }
 
-        public bool GetXRayByPoints(List<COTSParticleClr> a_listParticles, uint a_nXRayAQTime, bool a_bElementInfo)
+        public void GetXRayByPoints(List<COTSParticleClr> a_listParticles, uint a_nXRayAQTime, bool a_bElementInfo)
         {
             int xrayNum = a_listParticles.Count;
             Point[] Ps = new Point[xrayNum];
@@ -60,7 +60,7 @@ namespace OTSModelSharp.ServiceInterface
             string[] a_strEleResult = new string[xrayNum];
             eds.GetXRayByPoints(a_nXRayAQTime, Ps,parts, a_bElementInfo);
 
-            return true;
+            return ;
         }
     }
 }

+ 2 - 2
OTSIncAMeasureApp/0-OTSModel/ServiceCenter/IMeasureHardware.cs

@@ -42,7 +42,7 @@ namespace OTSModelSharp.ServiceInterface
     public interface IEDSController
     {
        
-        bool GetXRayByFeatures(List<COTSParticleClr> a_listParticles,  double a_nXRayAQTime, bool a_bElementInfo /*= FALSE*/);//这里将DWORD转成了Double类型,因为在后续调用时还有DWORD强制转换
-        bool GetXRayByPoints(List<COTSParticleClr> a_listParticles, uint a_nXRayAQTime, bool a_bElementInfo /*= FALSE*/);
+        void GetXRayByFeatures(List<COTSParticleClr> a_listParticles,  double a_nXRayAQTime, bool a_bElementInfo /*= FALSE*/);//这里将DWORD转成了Double类型,因为在后续调用时还有DWORD强制转换
+        void GetXRayByPoints(List<COTSParticleClr> a_listParticles, uint a_nXRayAQTime, bool a_bElementInfo /*= FALSE*/);
     }
 }