123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- using System;
- using System.Collections.Generic;
- using System.Data.SQLite;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading;
- using System.Threading.Tasks;
- using OTSCLRINTERFACE;
- using OTSDataType;
- using OTSModelSharp.Measure.OTSCleanliness;
- using OTSModelSharp.ServiceCenter;
- using OTSModelSharp.ServiceInterface;
- using static OTSDataType.otsdataconst;
- namespace OTSModelSharp
- {
- class CSmplMeasureCleanliness : CSmplMeasure
- {
- public CSmplMeasureCleanliness(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(COTSFieldData curFldData)
- {
-
- try
- {
- //CFieldDataClean curFldDataCln = (CFieldDataClean)curFldData;
- string libname = m_Sample.GetMsrParams().GetSTDName();
- if (libname != "NoSTDDB")
- {
- log.Info("Begin to classify big particles!Using " + libname);
- var bigparts = curFldData.ListBigParticles;
- ClassifyQuantifyParticles(bigparts,libname);
- var smallParts = curFldData.ListSmallParticles;
- ClassifyQuantifyParticles(smallParts, libname);
-
- }
- }
- catch (Exception e)
- {
- log.Info("calcu the particle image property or classify failed. "+e.Message);
- }
- }
- public override void ClassifyMergedParticles(List<COTSParticleClr> mergedParts)
- {
-
- 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);
-
-
- }
- }
- catch (Exception e)
- {
- log.Info("calcu the particle image property or classify failed. " + e.Message);
- }
-
- }
-
-
- public bool ClassifyQuantifyParticles(List<COTSParticleClr> a_listAnalysisParticles, string libname)// classify particles
- {
- int nSize = (int)a_listAnalysisParticles.Count();
- // go through all analysis particles
- for (int i = 0; i < nSize; ++i)
- {
- COTSParticleClr pParticle = a_listAnalysisParticles[i];
-
- IClassifyEngine engine = m_classifyEngine.GetParticleEngine(libname);
- if (!engine.Classify(pParticle))
- {
- // invalid x-ray pointer.
- log.Info("ClassifyParticle: can't identify the particle as any classified id.");
- return false;
- }
- }
-
- return true;
- }
- public bool ClassifySmallParticles(List<COTSParticleClr> smallparts, string libname)
- {
- List<COTSParticleClr> a_listAnalysisParticles = smallparts;
- int nSize = (int)a_listAnalysisParticles.Count();
- // go through all analysis particles
- for (int i = 0; i < nSize; ++i)
- {
- COTSParticleClr pParticle = a_listAnalysisParticles[i];
-
- IClassifyEngine engine = m_classifyEngine.GetCurveCompareEngine(libname);
- if (!engine.Classify(pParticle))
- {
- log.Info("ClassifyParticle: can't identify the particle as any inclusion.");
- return false;
- }
- }
- return true;
- }
-
- }
- }
|