Browse Source

add the 100 percentage process to the ParticleClassifyEngine

gsp 3 years ago
parent
commit
8f4361dc56

+ 13 - 3
OTSCPP/OTSClassifyEngine/ParticleClassifyEngine.cpp

@@ -59,9 +59,9 @@ bool ParticleClassifyEngine::Classify(COTSParticlePtr particle, CPosXrayPtr xray
 		}
 		LogTrace(__FILE__, __LINE__, allele.c_str());*/
 		//-----------------------------
-		//zero element process,if satisfied the condition than erase the element from the list.
+		//zero element process,if satisfied the condition than set the particular element percentage to 0.and make it 100% of all the element percentage.
 
-		auto partEles = ZeroElementProcess(particle, xray);//auto partEles = xray->GetElementQuantifyData();
+		auto partEles = ZeroElementProcess(particle, xray);//
 
 
 		std::map<std::string, CElementChemistryPtr> mapChemistrys;
@@ -500,7 +500,17 @@ CElementChemistriesList ParticleClassifyEngine::ZeroElementProcess(COTSParticleP
 		auto newChe = CElementChemistryPtr(new CElementChemistry(che.get()));
 		partEles.push_back(newChe);
 	}
-
+	//make it 100% in total.
+	double rawPercentage = 0;
+	for (auto ele : partEles)
+	{
+		rawPercentage += ele->GetPercentage();
+	}
+	for (auto ele : partEles)
+	{
+		ele->SetPercentage(ele->GetPercentage() / rawPercentage * 100);
+	}
+	//zero element process
 	std::map<CString, CElementChemistryPtr> mapChe;
 	for (auto ch : partEles)
 	{

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

@@ -288,33 +288,28 @@ namespace OTSModelSharp
         }
         public override void ClassifyMergedParticles(List<COTSParticleClr> mergedParts)
         {
+           
             try
             {
-                try
-                {
                    
-                    string libname = m_Sample.GetMsrParams().GetSTDName();
-                    if (libname != "NoSTDDB")
-                    {
-                        log.Info("Begin to classify big particles!Using " + libname);
-                        var bigparts = mergedParts;
-                        ClassifyQuantifyParticles(bigparts, libname);
+                string libname = m_Sample.GetMsrParams().GetSTDName();
+                if (libname != "NoSTDDB")
+                {
+                    log.Info("Begin to classify big particles!Using " + libname);
+                    var bigparts = mergedParts;
+                    ClassifyQuantifyParticles(bigparts, libname);
                        
                      
 
-                    }
                 }
-                catch (Exception e)
-                {
-                    log.Info("calcu the particle image property or classify failed. " + e.Message);
-                }
-
             }
             catch (Exception e)
             {
-                log.Info(" classify failed. " + e.Message);
+                log.Info("calcu the particle image property or classify failed. " + e.Message);
             }
 
+        
+
         }
         public void SaveFieldParticlesData()
         {