| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 | #include "stdafx.h"#include "ImageProForClr.h"namespace OTSCLRINTERFACE{	ImageProForClr::ImageProForClr(COTSImgProcPrmClr^ perameter)	{		imgProEngine = new COTSImageProcess(perameter->GetImgPrcPrmPtr());	}	void ImageProForClr::UpdateImageProcessParam(COTSImgProcPrmClr^ perameter)	{		imgProEngine->UpdateImageProcessParam(perameter->GetImgPrcPrmPtr());	}	bool ImageProForClr::GetFieldDataFromImage(CBSEImgClr^ bseImg, COTSImgProcPrmClr^ perameter, double a_PixelSize, COTSFieldDataClr^ fieldData)	{		imgProEngine->UpdateImageProcessParam(perameter->GetImgPrcPrmPtr());		auto param = perameter->GetImgPrcPrmPtr();		bool ret;		if (param->GetBGRemoveType() == OTS_BGREMOVE_TYPE::Matrics)		{			 ret = imgProEngine->SplitFieldImageIntoMatricsParticle(bseImg->GetBSEImgPtr(), a_PixelSize, fieldData->GetOTSFieldDataPtr());		}		else		{			 ret = imgProEngine->RemoveBGByCVconnectivities(bseImg->GetBSEImgPtr(), a_PixelSize, fieldData->GetOTSFieldDataPtr());		}						return ret;	}	bool ImageProForClr::GetParticlesBySpecialPartGrayRange(CBSEImgClr^ bseImg, CIntRangeClr^ grayRange, CDoubleRangeClr^ diameterRange, double a_PixelSize, COTSFieldDataClr^ fieldData)	{		bool ret = imgProEngine->GetParticlesBySpecialGrayRange(bseImg->GetBSEImgPtr(), grayRange->GetCIntRangePtr(), diameterRange->GetCDoubleRangePtr(), a_PixelSize, fieldData->GetOTSFieldDataPtr());		return ret;	}	bool ImageProForClr::CalcuParticleImagePropertes(COTSParticleClr^ particle, double a_PixelSize)	{		bool ret = imgProEngine->CalcuParticleImagePropertes(particle->GetOTSParticlePtr(), a_PixelSize);		return ret;	}	BOOL ImageProForClr::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 = imgProEngine->MergeBigBoundaryParticles(allFlds, pixelSize, scanFieldSize, CResolutionSize, mergedParticles);		for each (auto p in mergedParticles)		{			mergedParts->Add(gcnew COTSParticleClr(p));		}		return ret;	}	void ImageProForClr::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;		imgProEngine->RemoveBackGround(a_pImgIn->GetBSEImgPtr(), a_pImageProcessParam->GetImgPrcPrmPtr(), a_pImgOut->GetBSEImgPtr()/*, num*/);		//foundedPixelNum = num;		return;	}	void ImageProForClr::GetSpecialGrayRangeImage(CBSEImgClr^ a_pImgIn, CIntRangeClr^ a_SpecialGrayRange, CBSEImgClr^ a_pBinImgOut, long% foundedPixelNum)	{		long num = 0;		imgProEngine->GetSpecialGrayRangeImage(a_pImgIn->GetBSEImgPtr(), a_SpecialGrayRange->GetCIntRangePtr(), a_pBinImgOut->GetBSEImgPtr(), num);		foundedPixelNum = num;	}}
 |