OTSFieldMgr.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. #pragma once
  2. #include "afx.h"
  3. #include "OTSFieldData.h"
  4. #include "OTSImageProcessParam.h"
  5. #include "PosXray.h"
  6. #include "OTSXRayParam.h"
  7. #include "OTSBrukerImpl_const.h"
  8. #include "MsrResults.h"
  9. #include "MsrSampleStatus.h"
  10. namespace OTSMODEL {
  11. using namespace OTSController;
  12. class __declspec(dllexport) COTSFieldMgr
  13. {
  14. public:
  15. COTSFieldMgr();
  16. virtual ~COTSFieldMgr();
  17. // init
  18. BOOL Init(COTSFieldDataPtr a_pFieldData, CBSEImgPtr a_pBSEImg);
  19. COTSFieldDataPtr GetOTSFieldData() { return m_pFieldData; }
  20. void SetOTSFieldData(COTSFieldDataPtr a_pOTSFieldData);
  21. // BSE image
  22. CBSEImgPtr GetBSEImage() { return m_pBSEImg; }
  23. void SetBSEImage(CBSEImgPtr a_pBSEImg);
  24. void SetMsrStatus(CMsrSampleStatusPtr s) { m_pMsrStatus = s; }
  25. CMsrSampleStatusPtr GetMsrStatus() { return m_pMsrStatus; }
  26. // searching x ray list
  27. CPosXraysList GetSearchPosXrayList() { return m_listSearchPosXray; }
  28. void SetSearchPosXayList(CPosXraysList& a_listPosXray, BOOL a_bClear = TRUE);
  29. // analysis x ray list
  30. CPosXraysList GetAnalysisPosXrayList() { return m_listAnalysisPosXray; }
  31. void SetAnalysisPosXayList(CPosXraysList& a_listPosXray, BOOL a_bClear = TRUE);
  32. // remove BES image background
  33. BOOL RemoveBSEImageBG(COTSImageProcessParamPtr a_pImageProcessParam);
  34. // remove oversize particles and small particles
  35. BOOL ProcessParticles(COTSImageProcessParamPtr a_pImageProcessParam, double a_dPixelSize, COTSParticleList& a_listParticlesOut);
  36. BOOL IdentifyParticle(COTSImageProcessParamPtr a_pImageProcessParam, CPosXraysList& a_listXRay);
  37. // create x-ray list for a set of particles
  38. static BOOL CreateXrayList(COTSParticleList& a_listParticles, CPosXraysList& a_listPosXRay);
  39. // find out analysis (remove low count and particles contain no interesting elements)
  40. /*BOOL GetAnalysisParticles(COTSParticleList& a_listSearchParticles,
  41. CPosXraysList& a_listSearchPosXRay,
  42. int a_nLowCountLimit,
  43. CElementsList& a_listElements,
  44. COTSParticleList& a_listAnalysisParticles,
  45. CPosXraysList& a_listAnalysisXRay);*/
  46. // field on-line classification
  47. BOOL OnLineClassification();
  48. CMsrResultsPtr GetMsrResult() { return m_pMsrResults; }
  49. void SetMsrResult(CMsrResultsPtr a_pMsrResults);
  50. // save field files
  51. BOOL SaveFieldFiles();
  52. // search X-Ray analysis
  53. BOOL DoSearchXRayAnalysis(COTSXRayParamPtr a_pXrayParam, std::vector<std::vector<BrukerSegment>>& a_listFeatures, CPosXraysList& a_listXRay);
  54. // analysis X-Ray analysis
  55. //BOOL DoAnalysisXRayAnalysis(COTSXRayParamPtr a_pXrayParam, COTS);
  56. // Check if is there any particles
  57. BOOL NoParticle();
  58. BOOL CalIncAParticleImageProp(double a_pixelSize);
  59. static BOOL CalMergedParticleImageProp(COTSParticleList mergedParticles, double a_pixelSize);//process merged particles
  60. protected:
  61. // field data
  62. COTSFieldDataPtr m_pFieldData;
  63. // BSE image
  64. CBSEImgPtr m_pBSEImg;
  65. // searching x ray list
  66. CPosXraysList m_listSearchPosXray;
  67. // analysis x ray list
  68. CPosXraysList m_listAnalysisPosXray;
  69. // sample result
  70. CMsrResultsPtr m_pMsrResults;
  71. CMsrSampleStatusPtr m_pMsrStatus;
  72. //get segment list of a image
  73. BOOL GetSegmentList(long a_nWidth, long a_nHeight,const BYTE* a_pPixel, COTSSegmentsList& a_listSegments);
  74. BOOL GetFeatureList1(COTSSegmentsList & a_listSegments, COTSFeatureList & a_listFeatures);
  75. //get feature list of up-down segment
  76. //BOOL GetFeatureList(COTSSegmentsList& a_listSegments, COTSFeatureList& a_listFeatures);
  77. //change feature into particle
  78. BOOL ChangeFeaturelist(COTSFeatureList& a_listFeatures, COTSParticleList& a_listParticle);
  79. // get particles from image
  80. BOOL GetParticles(long a_nWidth, long a_nHeight, const BYTE* a_pPixel, COTSParticleList& a_listParticles);
  81. BOOL GetIncAParticleList(COTSParticleList & a_listParticleOut);
  82. // form particle from particle list
  83. //BOOL GetParticleFromParticleList(COTSParticleList& a_listParticle, COTSParticlePtr a_pParticleIn, COTSParticlePtr a_pParticleOut);
  84. //// get particle from particle list according the particle in
  85. //BOOL GetParticleListFromParticlelist(COTSParticleList& a_listParticleIn, COTSParticleList& a_listParticleOut);
  86. //// check if two particle is neighbor
  87. //BOOL CheckParticleNeight(const COTSParticlePtr a_pParticleCur, const COTSParticlePtr a_pParticleNew);
  88. // get inclusion particle
  89. };
  90. typedef std::shared_ptr<COTSFieldMgr> __declspec(dllexport) COTSFieldMgrPtr;
  91. typedef std::vector<COTSFieldMgrPtr> __declspec(dllexport) COTSFieldMgrList;
  92. }