#pragma once #include "OTSParticle.h" #include "OTSImageProcessParam.h" #include namespace OTSIMGPROC { using namespace OTSDATA; class __declspec(dllexport) COTSImageProcess { public: COTSImageProcess(); ~COTSImageProcess(); // ReZoom the picture with re-magnification static BOOL ReZoom(CString InPutPath, CString OutPutPath); static BOOL RemoveBSEImageBG(CBSEImgPtr m_pBSEImg, COTSImageProcessParamPtr a_pImageProcessParam, COTSFieldDataPtr m_pFieldData); static BOOL RemoveBGByFindContour(CBSEImgPtr m_pBSEImg, COTSImageProcessParamPtr a_pImageProcessParam, COTSFieldDataPtr m_pFieldData); static BOOL RemoveBGByCVconnectivities(CBSEImgPtr m_pBSEImg, COTSImageProcessParamPtr a_pImageProcessParam, double a_pixelSize, COTSFieldDataPtr m_pFieldData); static BOOL GetParticlesBySpecialGrayRange(CBSEImgPtr m_pBSEImg, CIntRangePtr a_grayRange, CDoubleRangePtr a_diameterRange, double a_pixelSize, COTSFieldDataPtr m_pFieldData); static CIntRangePtr CalBackground(CBSEImgPtr m_pBSEImg); static std::vector CalcuGrayLevelRange(CBSEImgPtr m_pBSEImg); static void GetSpecialGrayRangeImage(CBSEImgPtr a_pImgIn, CIntRangePtr a_SpecialGrayRange, CBSEImgPtr a_pBinImgOut, long& foundedPixelNum); static void RemoveBackGround(CBSEImgPtr a_pImgIn, COTSImageProcessParamPtr a_pImageProcessParam, CBSEImgPtr a_pImgOut,long& foundedPixelNum); static BOOL CalcuParticleImagePropertes(COTSParticlePtr part, double a_PixelSize); static BOOL SplitRawParticleIntoMatricsParticle(COTSParticlePtr part, int imageWidth, int imageHeight, double a_PixelSize, double a_XrayStep ); static BOOL SplitRawParticleIntoGreyScaleParticle(COTSParticlePtr part, CDoubleRangePtr ecdRange, double a_PixelSize, CBSEImgPtr fieldImg); static BOOL SplitRawParticleIntoWaterShedParticle(COTSParticlePtr part, double a_PixelSize, CBSEImgPtr fieldImg); static BOOL MergeBigBoundaryParticles(COTSFieldDataList allFields, double pixelSize, int scanFieldSize, CSize ResolutionSize, COTSParticleList& mergedParts); private: static BOOL GetParticles(long left, long top, long a_nWidth, long a_nHeight, const BYTE* a_pPixel, COTSParticleList& a_listParticles); static BOOL GetOneParticleFromROI(long left, long top, long a_nWidth, long a_nHeight, const BYTE* a_pPixel, COTSParticleList& a_listParticles); static BOOL GetSegmentList(long left, long top, long a_nWidth, long a_nHeight, const BYTE* a_pPixel, COTSSegmentsList& a_listSegments); static BOOL GetFeatureList(COTSSegmentsList& a_listSegments, COTSFeatureList& a_listFeatures); static BOOL ChangeFeaturelist(COTSFeatureList& a_listFeatures, COTSParticleList& a_listParticle); static void ImshowImage(CBSEImgPtr img); static void ImshowChartData(CBSEImgPtr img); }; }