|
@@ -0,0 +1,132 @@
|
|
|
+using OTSCLRINTERFACE;
|
|
|
+using OTSDataType;
|
|
|
+using OTSModelSharp.ServiceCenter;
|
|
|
+using System;
|
|
|
+using System.Collections.Generic;
|
|
|
+using System.Linq;
|
|
|
+using System.Text;
|
|
|
+using System.Threading.Tasks;
|
|
|
+using static OTSDataType.otsdataconst;
|
|
|
+
|
|
|
+namespace OTSModelSharp
|
|
|
+{
|
|
|
+ class CSmplMeasureInclutionForSteelMineral : CSmplMeasure
|
|
|
+ {
|
|
|
+ public CSmplMeasureInclutionForSteelMineral(string a_strWorkingFolder, COTSSample a_pSample) : base(a_strWorkingFolder, a_pSample)
|
|
|
+ {
|
|
|
+ SetWorkingFolder(a_strWorkingFolder);
|
|
|
+ SetSample(a_pSample);
|
|
|
+ m_classifyEngine = new CClassifyEngine();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ public override void ClassifyFieldParticles(COTSField curFldData)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ var anylysisparts = curFldData.GetListAnalysisParticles();
|
|
|
+ int nSize = anylysisparts.Count();
|
|
|
+
|
|
|
+ // go through all analysis particles
|
|
|
+ for (int i = 0; i < nSize; ++i)
|
|
|
+ {
|
|
|
+ string libname = m_Sample.GetMsrParams().GetSTDName();
|
|
|
+ if (!IsLowCounts(anylysisparts[i]))
|
|
|
+ {
|
|
|
+ ClassifySteelMineralParticle(anylysisparts[i], libname);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (Exception e)
|
|
|
+ {
|
|
|
+ log.Info(" classify failed. " + e.Message);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ public bool ClassifySteelMineralParticle(COTSParticleClr particle, string libname)// classify particles
|
|
|
+ {
|
|
|
+
|
|
|
+ int steelTech = (int)m_Sample.GetMsrParams().GetSteelTechnology();
|
|
|
+ particle.SetType((int)OTS_PARTICLE_TYPE.NOT_IDENTIFIED);
|
|
|
+ if (m_Sample.GetMsrParams().GetEngineType() == OTS_CLASSIFY_ENGINE_TYPE.InclutionPlusExpressionParse)
|
|
|
+ {
|
|
|
+
|
|
|
+ if (libname != "NoSTDDB")
|
|
|
+ {
|
|
|
+ //var m_classifyEngine = new CClassifyEngine();
|
|
|
+ IClassifyEngine engine = m_classifyEngine.GetExpressionClassifyEngine(libname);
|
|
|
+ engine.ClassifyByExpression(particle);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (particle.GetType() == (int)OTS_PARTICLE_TYPE.NOT_IDENTIFIED || particle.GetType() == (int)OTS_PARTICLE_TYPE.UNCLASSIFY)
|
|
|
+ {
|
|
|
+ IClassifyEngine engine;
|
|
|
+ engine = m_classifyEngine.GetIncClassifyEngine();
|
|
|
+ engine.ClassifyIncA(particle, steelTech);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ else if (m_Sample.GetMsrParams().GetEngineType() == OTS_CLASSIFY_ENGINE_TYPE.ExpressionParse)
|
|
|
+ {
|
|
|
+ if (libname != "NoSTDDB")
|
|
|
+ {
|
|
|
+ //var m_classifyEngine = new CClassifyEngine();
|
|
|
+ IClassifyEngine engine = m_classifyEngine.GetExpressionClassifyEngine(libname);
|
|
|
+ engine.ClassifyByExpression(particle);
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (m_Sample.GetMsrParams().GetEngineType() == OTS_CLASSIFY_ENGINE_TYPE.SpectrumMatch)
|
|
|
+ {
|
|
|
+ if (libname != "NoSTDDB")
|
|
|
+ {
|
|
|
+ //var m_classifyEngine = new CClassifyEngine();
|
|
|
+ IClassifyEngine engine = m_classifyEngine.GetSpectrumCompareEngine(libname);
|
|
|
+ engine.ClassifyBySpectrum(particle);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (m_Sample.GetMsrParams().GetEngineType() == OTS_CLASSIFY_ENGINE_TYPE.InclustionEngine)
|
|
|
+ {
|
|
|
+ IClassifyEngine engine;
|
|
|
+ engine = m_classifyEngine.GetIncClassifyEngine();
|
|
|
+ engine.ClassifyIncA(particle, steelTech);
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ public override void CollectParticlesXrayData(COTSField curFldData)
|
|
|
+ {
|
|
|
+ base.CollectParticlesXrayData(curFldData);
|
|
|
+ var parts = curFldData.GetListAnalysisParticles();
|
|
|
+ string libname = m_Sample.GetMsrParams().GetSTDName();
|
|
|
+ //process the maxeds rules
|
|
|
+ if (m_Sample.GetMsrParams().GetEngineType() == OTS_CLASSIFY_ENGINE_TYPE.InclutionPlusExpressionParse ||
|
|
|
+ m_Sample.GetMsrParams().GetEngineType() == OTS_CLASSIFY_ENGINE_TYPE.ExpressionParse)
|
|
|
+ {
|
|
|
+ if (libname != "NoSTDDB")
|
|
|
+ {
|
|
|
+ IClassifyEngine engine = m_classifyEngine.GetExpressionClassifyEngine(libname);
|
|
|
+ double maxedstime = 0;
|
|
|
+ List<COTSParticleClr> maxedsparts = new List<COTSParticleClr>();
|
|
|
+ foreach (var p in parts)
|
|
|
+ {
|
|
|
+ if (engine.IfNeedMaxEDS(p, ref maxedstime))
|
|
|
+ {
|
|
|
+ maxedsparts.Add(p);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (maxedsparts.Count > 0)
|
|
|
+ {
|
|
|
+ log.Warn("Begin to collect MaxEDS particles:" + maxedsparts.Count + "(" + maxedstime.ToString() + ") on Point mode");
|
|
|
+
|
|
|
+ m_EDSController.GetXRayByParts(maxedsparts, (uint)maxedstime, true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|