ImageProForClr.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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 SplitRawParticleIntoMatricsParticle(COTSParticleClr^ particle,int imageWidth,int imageHeight, double a_PixelSize, double a_xrayStep)
  29. {
  30. bool ret = COTSImageProcess::SplitRawParticleIntoMatricsParticle(particle->GetOTSParticlePtr(),imageWidth,imageHeight, a_PixelSize,a_xrayStep);
  31. return ret;
  32. }
  33. bool SplitRawParticleIntoGreyScaleParticle(COTSParticleClr^ particle,CDoubleRangeClr^ ecdRange,double a_PixelSize, CBSEImgClr^ fieldImg)
  34. {
  35. bool ret = COTSImageProcess::SplitRawParticleIntoGreyScaleParticle(particle->GetOTSParticlePtr(), ecdRange->GetCDoubleRangePtr(), a_PixelSize, fieldImg->GetBSEImgPtr());
  36. return ret;
  37. }
  38. bool SplitRawParticleIntoWaterShedParticle(COTSParticleClr^ particle, CDoubleRangeClr^ ecdRange, double a_PixelSize, CBSEImgClr^ fieldImg)
  39. {
  40. bool ret = COTSImageProcess::SplitRawParticleIntoWaterShedParticle(particle->GetOTSParticlePtr(), a_PixelSize, fieldImg->GetBSEImgPtr());
  41. return ret;
  42. }
  43. BOOL MergeBigBoundaryParticles(System::Collections::Generic::List<COTSFieldDataClr^>^ allFields, double pixelSize, int scanFieldSize, Size ResolutionSize, System::Collections::Generic::List<COTSParticleClr^>^ mergedParts)
  44. {
  45. std::vector<COTSFieldDataPtr> allFlds;
  46. COTSParticleList mergedParticles;
  47. for each (auto f in allFields)
  48. {
  49. allFlds.push_back(f->GetOTSFieldDataPtr());
  50. }
  51. CSize CResolutionSize;
  52. CResolutionSize.cx = ResolutionSize.Width;
  53. CResolutionSize.cy = ResolutionSize.Height;
  54. bool ret = COTSImageProcess::MergeBigBoundaryParticles(allFlds, pixelSize, scanFieldSize, CResolutionSize, mergedParticles);
  55. for each (auto p in mergedParticles)
  56. {
  57. mergedParts->Add(gcnew COTSParticleClr(p));
  58. }
  59. return ret;
  60. }
  61. void RemoveBackGround(CBSEImgClr^ a_pImgIn, COTSImgProcPrmClr^ a_pImageProcessParam, CBSEImgClr^ a_pImgOut, long% foundedPixelNum)
  62. {
  63. // the background pixel will be 0,and the other part will be 255.
  64. long num = 0;
  65. COTSImageProcess::RemoveBackGround(a_pImgIn->GetBSEImgPtr(), a_pImageProcessParam->GetImgPrcPrmPtr(), a_pImgOut->GetBSEImgPtr(), num);
  66. foundedPixelNum = num;
  67. return ;
  68. }
  69. void GetSpecialGrayRangeImage(CBSEImgClr^ a_pImgIn, CIntRangeClr^ a_SpecialGrayRange, CBSEImgClr^ a_pBinImgOut, long% foundedPixelNum)
  70. {
  71. long num = 0;
  72. COTSImageProcess::GetSpecialGrayRangeImage(a_pImgIn->GetBSEImgPtr(), a_SpecialGrayRange->GetCIntRangePtr(), a_pBinImgOut->GetBSEImgPtr(), num);
  73. foundedPixelNum = num;
  74. }
  75. };
  76. }