SmplMeasureCleanliness.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using OTSCLRINTERFACE;
  5. using OTSModelSharp.ServiceCenter;
  6. namespace OTSModelSharp
  7. {
  8. using OTSDataType;
  9. using static OTSDataType.otsdataconst;
  10. class CSmplMeasureCleanliness : CSmplMeasure
  11. {
  12. public CSmplMeasureCleanliness(string a_strWorkingFolder, COTSSample a_pSample):base(a_strWorkingFolder,a_pSample)
  13. {
  14. SetWorkingFolder(a_strWorkingFolder);
  15. SetSample(a_pSample);
  16. m_classifyEngine = new CClassifyEngine();
  17. }
  18. public override void ClassifyFieldParticles(COTSFieldData curFldData)
  19. {
  20. try
  21. {
  22. string libname = m_Sample.GetMsrParams().GetSTDName();
  23. if (libname != "NoSTDDB")
  24. {
  25. log.Info("Begin to classify big particles!Using " + libname);
  26. var parts = curFldData.GetListAnalysisParticles();
  27. ClassifyParticles(parts,libname);
  28. //var smallParts = curFldData.ListSmallParticles;
  29. //ClassifyQuantifyParticles(smallParts, libname);
  30. }
  31. }
  32. catch (Exception e)
  33. {
  34. log.Info("calcu the particle image property or classify failed. "+e.Message);
  35. }
  36. }
  37. public override void ClassifyMergedParticles(List<COTSParticleClr> mergedParts)
  38. {
  39. try
  40. {
  41. string libname = m_Sample.GetMsrParams().GetSTDName();
  42. if (libname != "NoSTDDB")
  43. {
  44. log.Info("Begin to classify big particles!Using " + libname);
  45. ClassifyParticles(mergedParts, libname);
  46. }
  47. }
  48. catch (Exception e)
  49. {
  50. log.Info("calcu the particle image property or classify failed. " + e.Message);
  51. }
  52. }
  53. public bool ClassifyParticles(List<COTSParticleClr> a_listAnalysisParticles, string libname)// classify particles
  54. {
  55. int nSize = (int)a_listAnalysisParticles.Count();
  56. // go through all analysis particles
  57. for (int i = 0; i < nSize; ++i)
  58. {
  59. COTSParticleClr pParticle = a_listAnalysisParticles[i];
  60. IClassifyEngine engine = m_classifyEngine.GetExpressionClassifyEngine(libname);
  61. if (!IsLowCounts(pParticle))
  62. {
  63. if (engine.ClassifyByExpressionTemporarySpectrum(pParticle))
  64. {
  65. if (pParticle.GetType() == (int)OTS_PARTICLE_TYPE.UNCLASSIFY)
  66. {
  67. m_EDSController.QuantifyXrayByPart(pParticle);
  68. engine.ClassifyByExpression(pParticle);
  69. }
  70. }
  71. }
  72. }
  73. return true;
  74. }
  75. }
  76. }