Browse Source

calculate the merged particles property.

gsp 3 years ago
parent
commit
4cc3e03698

+ 4 - 4
OTSCPP/OTSImagePro/OTSImageProcess.cpp

@@ -2172,7 +2172,7 @@ namespace OTSIMGPROC
 			auto newPart = COTSParticlePtr(new COTSParticle());
 			auto newPart = COTSParticlePtr(new COTSParticle());
 			COTSSegmentsList newSegs;
 			COTSSegmentsList newSegs;
 			auto p = pair.first;
 			auto p = pair.first;
-
+			newPart->SetAbsolutePos(p->GetAbsolutPos());
 			//firstly,we sum up all the merged particles's area and get the represent string.
 			//firstly,we sum up all the merged particles's area and get the represent string.
 			std::string partsStr = std::to_string(p->GetFieldId()) + ":" + std::to_string(p->GetAnalysisId());
 			std::string partsStr = std::to_string(p->GetFieldId()) + ":" + std::to_string(p->GetAnalysisId());
 			double allPartArea = p->GetArea();//Get the first particle's area.
 			double allPartArea = p->GetArea();//Get the first particle's area.
@@ -2204,12 +2204,12 @@ namespace OTSIMGPROC
 				}
 				}
 				int fldWidth = allFields[0]->Width;
 				int fldWidth = allFields[0]->Width;
 				int fldHeight = allFields[0]->Height;
 				int fldHeight = allFields[0]->Height;
-				CPoint fldLeftUpPos = CPoint(myFldPos.x + fldWidth / 2 * pixelSize, myFldPos.y + fldHeight / 2 * pixelSize);
+				CPoint fldLeftUpPos = CPoint(myFldPos.x + fldWidth / 2 , myFldPos.y + fldHeight / 2 );
 				for (auto s : subp->GetFeature()->GetSegmentsList())
 				for (auto s : subp->GetFeature()->GetSegmentsList())
 				{
 				{
 					COTSSegmentPtr newseg = COTSSegmentPtr(new COTSSegment());
 					COTSSegmentPtr newseg = COTSSegmentPtr(new COTSSegment());
-					newseg->SetStart(s->GetStart() * pixelSize + fldLeftUpPos.x);
-					newseg->SetHeight((0 - s->GetHeight() * pixelSize) + fldLeftUpPos.y);//the coordinate system of segment in a field is different with the OTS coordinate system.OTS system's y axis is upward positive ,yet the field is downward positive.
+					newseg->SetStart(s->GetStart()  + fldLeftUpPos.x);
+					newseg->SetHeight((0 - s->GetHeight()) + fldLeftUpPos.y);//the coordinate system of segment in a field is different with the OTS coordinate system.OTS system's y axis is upward positive ,yet the field is downward positive.
 					newseg->SetLength(s->GetLength());
 					newseg->SetLength(s->GetLength());
 					newSegs.push_back(newseg);
 					newSegs.push_back(newseg);
 				}
 				}

+ 16 - 4
OTSIncAMeasureApp/0-OTSModel/Measure/3-MeasureFlow/CSmplMeasure.cs

@@ -752,9 +752,10 @@ namespace OTSModelSharp
                 CImageHandler imgpro = new CImageHandler();
                 CImageHandler imgpro = new CImageHandler();
                 int scanfldsize = m_Sample.GetSEMDataMsr().GetScanFieldSize();
                 int scanfldsize = m_Sample.GetSEMDataMsr().GetScanFieldSize();
                 List<COTSParticleClr> mergedParticles = new List<COTSParticleClr>();
                 List<COTSParticleClr> mergedParticles = new List<COTSParticleClr>();
-                imgpro.MergeBigBoundaryParticles(m_pSampleRstFile.GetFieldData(), m_Sample.CalculatePixelSize(), scanfldsize, m_Sample.GetResolutionSize(), ref mergedParticles);
-
-                
+                double pixelSize = m_Sample.CalculatePixelSize();
+                imgpro.MergeBigBoundaryParticles(m_pSampleRstFile.GetFieldData(), pixelSize, scanfldsize, m_Sample.GetResolutionSize(), ref mergedParticles);
+               
+                CalculateMergedPartProperty(mergedParticles,pixelSize);
 
 
                 ClassifyMergedParticles(mergedParticles);
                 ClassifyMergedParticles(mergedParticles);
                 log.Warn("begin particle data db saving...");
                 log.Warn("begin particle data db saving...");
@@ -776,7 +777,18 @@ namespace OTSModelSharp
                 m_pMsrThread.SendMessageToMeasureApp(MsgSmplEnd);
                 m_pMsrThread.SendMessageToMeasureApp(MsgSmplEnd);
             }
             }
     }
     }
-      
+
+        private void CalculateMergedPartProperty(List<COTSParticleClr> mergedParticles,double pixelSize)
+        {
+           var m_ImagePro = new CImageHandler();
+            foreach (COTSParticleClr part in mergedParticles)
+            {
+
+                m_ImagePro.CalParticleImageProp(part, pixelSize);
+            }
+          
+        }
+
         public void DoHolePreview(int a_nHoleID)
         public void DoHolePreview(int a_nHoleID)
         {
         {
             using (AutoResetSEMControl autoReset = new AutoResetSEMControl(this))
             using (AutoResetSEMControl autoReset = new AutoResetSEMControl(this))

+ 7 - 5
OTSIncAMeasureApp/0-OTSModel/Measure/BSEPicData/COTSFieldData.cs

@@ -15,7 +15,7 @@ namespace OTSModelSharp
    using  COTSFieldDataList = List<COTSFieldData>;
    using  COTSFieldDataList = List<COTSFieldData>;
    public class COTSFieldData
    public class COTSFieldData
     {
     {
-        protected static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
+        protected  NLog.Logger log ;
         // ID
         // ID
         int m_nID;
         int m_nID;
 
 
@@ -45,6 +45,7 @@ namespace OTSModelSharp
 
 
         public COTSFieldData(CBSEImgClr a_pBSEImg, double a_dPixelSize)
         public COTSFieldData(CBSEImgClr a_pBSEImg, double a_dPixelSize)
         {
         {
+            log = NLog.LogManager.GetCurrentClassLogger();
             Init();
             Init();
             m_pBSEImg = a_pBSEImg;
             m_pBSEImg = a_pBSEImg;
             m_pixelSize = a_dPixelSize;
             m_pixelSize = a_dPixelSize;
@@ -54,6 +55,7 @@ namespace OTSModelSharp
         }
         }
         public COTSFieldData()
         public COTSFieldData()
         {
         {
+            log = NLog.LogManager.GetCurrentClassLogger();
             //m_pBSEImg = a_pBSEImg;
             //m_pBSEImg = a_pBSEImg;
             Init();
             Init();
         }
         }
@@ -97,7 +99,7 @@ namespace OTSModelSharp
             if (a_pBSEImg == null)
             if (a_pBSEImg == null)
             {
             {
                 // invalid BSE image.
                 // invalid BSE image.
-                logger.Error("SetBSEImage: invalid BSE image.");
+                log.Error("SetBSEImage: invalid BSE image.");
                 return;
                 return;
             }
             }
             m_pBSEImg = a_pBSEImg;
             m_pBSEImg = a_pBSEImg;
@@ -145,7 +147,7 @@ namespace OTSModelSharp
             int tooSmallnum = 0;
             int tooSmallnum = 0;
          
          
             int overSizenum = 0;
             int overSizenum = 0;
-            logger.Info("Total Particles: " + listParticles.Count);
+            log.Info("Total Particles: " + listParticles.Count);
             foreach (COTSParticleClr pParticle in listParticles)
             foreach (COTSParticleClr pParticle in listParticles)
             {
             {
                 // get particle area 
                 // get particle area 
@@ -182,8 +184,8 @@ namespace OTSModelSharp
                 m_listAnalysisParticles.Add(pParticle);
                 m_listAnalysisParticles.Add(pParticle);
                
                
             }
             }
-            logger.Info("TooSmall Particles (<"+ dAreaLow .ToString("f2") + "): " + tooSmallnum);
-            logger.Info("OverSize Particles (>"+ dAreaHigh.ToString("f2") + "): " + overSizenum);
+            log.Info("TooSmall Particles (<"+ dAreaLow .ToString("f2") + "): " + tooSmallnum);
+            log.Info("OverSize Particles (>"+ dAreaHigh.ToString("f2") + "): " + overSizenum);
 
 
         }
         }