ソースを参照

remove some notations.

gsp 2 年 前
コミット
78d55cefc0

+ 16 - 29
OTSCPP/OTSClassifyEngine/CurveCompareEngine/OTSClassifyOnCurveCompEng.cpp

@@ -43,21 +43,27 @@ namespace OTSClassifyEngine
 	CStandardItemPtr CClassifyOnCurveCompEng::GetMatchingSTD(  CPosXrayPtr posxray, double& dValue)
 	{
 		CStandardItemPtr itm;	// 存储最相似的那个mineral
- 		if (m_stdLib->GetSTDItemCount() < 1)
+		int stdItemCount = m_stdLib->GetSTDItemCount();
+ 		if (stdItemCount < 1)
 		{
 			return itm;
 		}
 		double dcos = 0;
-		dValue = -100000;	// 获取最大的相似值
-		for (unsigned int i = 0; i < m_stdLib->GetSTDItemCount(); i++)
+		double dSimilarity = -1000;
+			// 获取最大的相似值
+		int idx = -1;
+		for (unsigned int i = 0; i < stdItemCount; i++)
 		{
 			dcos = GetCosValue(posxray, m_stdLib->GetSTDItem(i), m_stdLib->GetSTDItem(i)->GetChannelsNum());
-			if (dcos > dValue)
+			if (dcos > dSimilarity)
 			{
-				dValue = dcos;
-				itm = m_stdLib->GetSTDItem(i);
+				dSimilarity = dcos;
+				idx = i;
+				
 			}
 		}
+		dValue = dSimilarity;
+		itm = m_stdLib->GetSTDItem(idx);
 
 		return itm;
 	}
@@ -89,17 +95,7 @@ namespace OTSClassifyEngine
 		d1 = posXray->GetXrayDataVectorNorm();
 		d2 = posXray1->GetXrayDataVectorNorm();
          return (0 == d1 || 0 == d2) ? 0 : dotProduct / (d1 * d2);
-		// 算法改进, 加上距离权重
-		/*if (0 == d1 || 0 == d2)
-		{
-			return 0;
-		}
-		double dresult = 0;
-		dresult = (d1 < d2) ? d1 / d2 : d2 / d1;
-		double stdEvp = GetStdEvp( posxray, pXrayData1, iDataLen1);
-		double finalResult;
-		 finalResult=0.4 * dotProduct / (d1 * d2) + 0.3 * dresult + 0.3 * stdEvp;
-		 return finalResult;*/
+	
 	}
 
 	// 20190903:增加参数iStartChannel哪个位置开始比较, vecIgnoreChannel里面的通道不处理
@@ -109,10 +105,7 @@ namespace OTSClassifyEngine
 		{
 			return 0;
 		}
-		/*if (iStartChannel < 0 || iStartChannel >= iDataLen1)
-		{
-			return 1;
-		}*/
+	
 		DWORD* pXrayData = posxray->GetXrayData();
 		//bool bignore = false;
 		
@@ -122,11 +115,7 @@ namespace OTSClassifyEngine
 		double dAva2 = 0;
 		double dSquare1 = 0;
 		double dSquare2 = 0;
-		/*vector<int> vecdata1;
-		vector<int> vecdata2;*/
 
-		/*vecdata1.clear();
-		vecdata2.clear();*/
 		int num1= iDataLen1 - m_iStartChannel;
 
 		// 求出能谱的平均值		
@@ -137,12 +126,10 @@ namespace OTSClassifyEngine
 			// 能谱差之和
 			
 				iSum1 = iSum1 + pXrayData1[i];
-				//vecdata1.push_back((int)pXrayData1[i]);
-				//num1 += 1;
+
 
 				iSum2 = iSum2 + pXrayData[i];
-				//vecdata2.push_back((int)posxray->GetXrayData()[i]);
-				//num2 += 1;
+
 			
 		}
 		

+ 2 - 42
OTSIncAMeasureApp/0-OTSModel/Measure/5-OTSMining/SmplMeasureMining.cs

@@ -12,41 +12,15 @@ using OTSMeasureApp._0_OTSModel.Measure._5_OTSMining;
 using OTSModelSharp.Measure;
 using OTSModelSharp.Measure.OTSCleanliness;
 using OTSModelSharp.ServiceCenter;
-using OTSModelSharp.ServiceCenter;
+
 using static OTSDataType.otsdataconst;
 
 namespace OTSModelSharp
 {
     class CSmplMeasureMining : CSmplMeasure
     {
-        //private  Queue<COTSParticleClr> particleQueueForClassify = new Queue<COTSParticleClr>();
-        //private Thread threadForClassify;
-
-        //public   void classifyFieldData()
-        //{
-        //    while (particleQueueForClassify.Count > 0)
-        //    {
-        //        string libname = m_Sample.GetMsrParams().GetSTDName();
-        //        if (libname != "NoSTDDB")
-        //        {
-                  
-        //            var pParticle = particleQueueForClassify.Dequeue();
-
-        //            IClassifyEngine engine = m_classifyEngine.GetCurveCompareEngine(libname);
-        //            log.Info("begin to calssify particle:"+ pParticle.GetParticleId());
-        //            if (!engine.Classify(pParticle))
-        //            {
-        //                log.Info("ClassifyParticle: can't identify the particle as any inclusion.");
-        //                return ;
-        //            }
 
 
-        //        }
-
-        //    }
-        //    return ;
-        //}
-
         public CSmplMeasureMining(string a_strWorkingFolder, COTSSample a_pSample) : base(a_strWorkingFolder, a_pSample)
         {
             SetWorkingFolder(a_strWorkingFolder);
@@ -116,12 +90,6 @@ namespace OTSModelSharp
             }
 
 
-            //log.Info("Begin to classify particles! particle num:" + curFldData.GetListAnalysisParticles().Count);
-
-            //while (particleQueueForClassify.Count > 0)
-            //{
-            //    Thread.Sleep(100);
-            //} 
             ClassifyFieldParticles(curFldData);
 
             MergeSubParticleByTheXrayClassification(curFldData);
@@ -163,15 +131,7 @@ namespace OTSModelSharp
 
                 nXRayAQTime = (uint)pXRayParam.GetMidAnalyAQTime();
                 m_EDSHardwareMgr.GetXRayByMatrix(parts, nXRayAQTime);
-                //foreach (var p in parts)
-                //{
-                //    particleQueueForClassify.Enqueue(p);
-                //}
-                //if (!threadForClassify.IsAlive)
-                //{
-                //    threadForClassify.Start();
-                //}
-                
+  
                
             }
 

+ 2 - 2
OTSIncAMeasureApp/BaseFunctionTest.cs

@@ -76,7 +76,7 @@ namespace OTSMeasureApp
         private void button3_Click(object sender, EventArgs e)
         {
          
-            COTSClassifyEngineClr engine = new COTSClassifyEngineClr(EngineType.CurveCompare, "global_mining.db");
+            COTSClassifyEngineClr engine = new COTSClassifyEngineClr(EngineType.CurveCompare, "globalmining.db");
 
             COTSParticleClr part = new COTSParticleClr();
             List<CElementChemistryClr> eles = new List<CElementChemistryClr>();
@@ -93,7 +93,7 @@ namespace OTSMeasureApp
             part.SetXray(xray);
             label3.Text = "";
             engine.Classify(part);
-            label3.Text = part.GetTypeName()+" Id:"+ part.GetType().ToString();
+            label3.Text = part.GetTypeName()+" Id:"+ part.GetClassifyId().ToString();
         }
     }
 }