123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- #pragma once
- #include "BSEImgClr.h"
- #include "OTSImgProcPrmClr.h"
- #include "OTSImageProcess.h"
- #include <OTSFieldDataClr.h>
- #include "../OTSLog/COTSUtilityDllFunExport.h"
- namespace OTSCLRINTERFACE
- {
- using namespace OTSCLRINTERFACE;
- public ref class ImageProForClr
- {
- public:
- bool GetFieldDataFromImage(CBSEImgClr^ bseImg, COTSImgProcPrmClr^ perameter, double a_PixelSize, COTSFieldDataClr^ fieldData)
- {
-
- bool ret = COTSImageProcess::RemoveBGByCVconnectivities(bseImg->GetBSEImgPtr(), perameter->GetImgPrcPrmPtr(),a_PixelSize, fieldData->GetOTSFieldDataPtr());
- return ret;
- }
- bool GetParticlesBySpecialPartGrayRange(CBSEImgClr^ bseImg, CIntRangeClr^ grayRange, CDoubleRangeClr^ diameterRange,double a_PixelSize, COTSFieldDataClr^ fieldData)
- {
- bool ret = COTSImageProcess::GetParticlesBySpecialGrayRange(bseImg->GetBSEImgPtr(), grayRange->GetCIntRangePtr(),diameterRange->GetCDoubleRangePtr(), a_PixelSize,fieldData->GetOTSFieldDataPtr());
- return ret;
- }
- bool CalcuParticleImagePropertes(COTSParticleClr^ particle, double a_PixelSize)
- {
- bool ret = COTSImageProcess::CalcuParticleImagePropertes(particle->GetOTSParticlePtr(), a_PixelSize);
- return ret;
- }
- bool SplitRawParticleIntoMatricsParticle(COTSParticleClr^ particle,int imageWidth,int imageHeight, double a_PixelSize, double a_xrayStep)
- {
- bool ret = COTSImageProcess::SplitRawParticleIntoMatricsParticle(particle->GetOTSParticlePtr(),imageWidth,imageHeight, a_PixelSize,a_xrayStep);
- return ret;
- }
- bool SplitRawParticleIntoGreyScaleParticle(COTSParticleClr^ particle,CDoubleRangeClr^ ecdRange,double a_PixelSize, CBSEImgClr^ fieldImg)
- {
- bool ret = COTSImageProcess::SplitRawParticleIntoGreyScaleParticle(particle->GetOTSParticlePtr(), ecdRange->GetCDoubleRangePtr(), a_PixelSize, fieldImg->GetBSEImgPtr());
- return ret;
- }
- bool SplitRawParticleIntoWaterShedParticle(COTSParticleClr^ particle, CDoubleRangeClr^ ecdRange, double a_PixelSize, CBSEImgClr^ fieldImg)
- {
- bool ret = COTSImageProcess::SplitRawParticleIntoWaterShedParticle(particle->GetOTSParticlePtr(), a_PixelSize, fieldImg->GetBSEImgPtr());
- return ret;
- }
-
- BOOL MergeBigBoundaryParticles(System::Collections::Generic::List<COTSFieldDataClr^>^ allFields, double pixelSize, int scanFieldSize, Size ResolutionSize, System::Collections::Generic::List<COTSParticleClr^>^ mergedParts)
- {
- std::vector<COTSFieldDataPtr> allFlds;
- COTSParticleList mergedParticles;
- for each (auto f in allFields)
- {
- allFlds.push_back(f->GetOTSFieldDataPtr());
- }
- CSize CResolutionSize;
- CResolutionSize.cx = ResolutionSize.Width;
- CResolutionSize.cy = ResolutionSize.Height;
- bool ret = COTSImageProcess::MergeBigBoundaryParticles(allFlds, pixelSize, scanFieldSize, CResolutionSize, mergedParticles);
- for each (auto p in mergedParticles)
- {
- mergedParts->Add(gcnew COTSParticleClr(p));
- }
- return ret;
- }
- void RemoveBackGround(CBSEImgClr^ a_pImgIn, COTSImgProcPrmClr^ a_pImageProcessParam, CBSEImgClr^ a_pImgOut, long% foundedPixelNum)
- {
- // the background pixel will be 0,and the other part will be 255.
- long num = 0;
- COTSImageProcess::RemoveBackGround(a_pImgIn->GetBSEImgPtr(), a_pImageProcessParam->GetImgPrcPrmPtr(), a_pImgOut->GetBSEImgPtr(), num);
- foundedPixelNum = num;
- return ;
- }
- void GetSpecialGrayRangeImage(CBSEImgClr^ a_pImgIn, CIntRangeClr^ a_SpecialGrayRange, CBSEImgClr^ a_pBinImgOut, long% foundedPixelNum)
- {
-
- long num = 0;
- COTSImageProcess::GetSpecialGrayRangeImage(a_pImgIn->GetBSEImgPtr(), a_SpecialGrayRange->GetCIntRangePtr(), a_pBinImgOut->GetBSEImgPtr(), num);
- foundedPixelNum = num;
- }
- };
- }
|