ImageProForClr.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #pragma once
  2. #include "BSEImgClr.h"
  3. #include "OTSImgProcPrmClr.h"
  4. #include "OTSImageProcess.h"
  5. #include <OTSFieldDataClr.h>
  6. #include "../OTSLog/COTSUtilityDllFunExport.h"
  7. namespace OTSCLRINTERFACE
  8. {
  9. using namespace OTSCLRINTERFACE;
  10. public ref class ImageProForClr
  11. {
  12. public:
  13. bool GetFieldDataFromImage(CBSEImgClr^ bseImg, COTSImgProcPrmClr^ perameter, double a_PixelSize, COTSFieldDataClr^ fieldData)
  14. {
  15. bool ret = COTSImageProcess::RemoveBGByCVconnectivities(bseImg->GetBSEImgPtr(), perameter->GetImgPrcPrmPtr(),a_PixelSize, fieldData->GetOTSFieldDataPtr());
  16. return ret;
  17. }
  18. bool GetParticlesBySpecialPartGrayRange(CBSEImgClr^ bseImg, CIntRangeClr^ grayRange, CDoubleRangeClr^ diameterRange,double a_PixelSize, COTSFieldDataClr^ fieldData)
  19. {
  20. bool ret = COTSImageProcess::GetParticlesBySpecialGrayRange(bseImg->GetBSEImgPtr(), grayRange->GetCIntRangePtr(),diameterRange->GetCDoubleRangePtr(), a_PixelSize,fieldData->GetOTSFieldDataPtr());
  21. return ret;
  22. }
  23. bool CalcuParticleImagePropertes(COTSParticleClr^ particle, double a_PixelSize)
  24. {
  25. bool ret = COTSImageProcess::CalcuParticleImagePropertes(particle->GetOTSParticlePtr(), a_PixelSize);
  26. return ret;
  27. }
  28. BOOL MergeBigBoundaryParticles(System::Collections::Generic::List<COTSFieldDataClr^>^ allFields, int overlap, double pixelSize, int scanFieldSize, Size ResolutionSize, System::Collections::Generic::List<COTSParticleClr^>^ mergedParts)
  29. {
  30. std::vector<COTSFieldDataPtr> allFlds;
  31. COTSParticleList mergedParticles;
  32. for each (auto f in allFields)
  33. {
  34. allFlds.push_back(f->GetOTSFieldDataPtr());
  35. }
  36. CSize CResolutionSize;
  37. CResolutionSize.cx = ResolutionSize.Width;
  38. CResolutionSize.cy = ResolutionSize.Height;
  39. bool ret = COTSImageProcess::MergeBigBoundaryParticles(allFlds, overlap, pixelSize, scanFieldSize, CResolutionSize, mergedParticles);
  40. for each (auto p in mergedParticles)
  41. {
  42. mergedParts->Add(gcnew COTSParticleClr(p));
  43. }
  44. return ret;
  45. }
  46. void RemoveBackGround(CBSEImgClr^ a_pImgIn, COTSImgProcPrmClr^ a_pImageProcessParam, CBSEImgClr^ a_pImgOut, long% foundedPixelNum)
  47. {
  48. // the background pixel will be 0,and the other part will be 255.
  49. long num = 0;
  50. COTSImageProcess::RemoveBackGround(a_pImgIn->GetBSEImgPtr(), a_pImageProcessParam->GetImgPrcPrmPtr(), a_pImgOut->GetBSEImgPtr(), num);
  51. foundedPixelNum = num;
  52. return ;
  53. }
  54. void GetSpecialGrayRangeImage(CBSEImgClr^ a_pImgIn, CIntRangeClr^ a_SpecialGrayRange, CBSEImgClr^ a_pBinImgOut, long% foundedPixelNum)
  55. {
  56. long num = 0;
  57. COTSImageProcess::GetSpecialGrayRangeImage(a_pImgIn->GetBSEImgPtr(), a_SpecialGrayRange->GetCIntRangePtr(), a_pBinImgOut->GetBSEImgPtr(), num);
  58. foundedPixelNum = num;
  59. }
  60. };
  61. }