ImageProForClr.h 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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 MergeBigBoundaryParticles(System::Collections::Generic::List<COTSFieldDataClr^>^ allFields, double pixelSize, int scanFieldSize, Size ResolutionSize, System::Collections::Generic::List<COTSParticleClr^>^ mergedParts)
  39. {
  40. std::vector<COTSFieldDataPtr> allFlds;
  41. COTSParticleList mergedParticles;
  42. for each (auto f in allFields)
  43. {
  44. allFlds.push_back(f->GetOTSFieldDataPtr());
  45. }
  46. CSize CResolutionSize;
  47. CResolutionSize.cx = ResolutionSize.Width;
  48. CResolutionSize.cy = ResolutionSize.Height;
  49. bool ret = COTSImageProcess::MergeBigBoundaryParticles(allFlds, pixelSize, scanFieldSize, CResolutionSize, mergedParticles);
  50. for each (auto p in mergedParticles)
  51. {
  52. mergedParts->Add(gcnew COTSParticleClr(p));
  53. }
  54. return ret;
  55. }
  56. void RemoveBackGround(CBSEImgClr^ a_pImgIn, COTSImgProcPrmClr^ a_pImageProcessParam, CBSEImgClr^ a_pImgOut, long% foundedPixelNum)
  57. {
  58. // the background pixel will be 0,and the other part will be 255.
  59. long num = 0;
  60. COTSImageProcess::RemoveBackGround(a_pImgIn->GetBSEImgPtr(), a_pImageProcessParam->GetImgPrcPrmPtr(), a_pImgOut->GetBSEImgPtr(), num);
  61. foundedPixelNum = num;
  62. return ;
  63. }
  64. void GetSpecialGrayRangeImage(CBSEImgClr^ a_pImgIn, CIntRangeClr^ a_SpecialGrayRange, CBSEImgClr^ a_pBinImgOut, long% foundedPixelNum)
  65. {
  66. long num = 0;
  67. COTSImageProcess::GetSpecialGrayRangeImage(a_pImgIn->GetBSEImgPtr(), a_SpecialGrayRange->GetCIntRangePtr(), a_pBinImgOut->GetBSEImgPtr(), num);
  68. foundedPixelNum = num;
  69. }
  70. };
  71. }