GBImgPropCal.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #pragma once
  2. #include "OTSParticle.h"
  3. //#define PI 3.1416
  4. namespace OTSIMGPROC {
  5. using namespace OTSDATA;
  6. // cal image data size expand size by rectangle
  7. const int nExpand_Size = 1;
  8. // cirlcle cal value
  9. //const double Pi = 3.14159265;
  10. //make matrix filled with 255
  11. //const int nBlackColor = 255;
  12. //make matrix filled with 0
  13. const int nWhiteColor = 0;
  14. // divide the sum of the half diameter
  15. const int nDivide = 36;
  16. // divide the sum of the total diameter
  17. const int nCircleDivide = 18;
  18. // the start cal angle
  19. const double dStartAngle = 0.17;
  20. // thickness Line thickness
  21. const int nThickness = 1;
  22. // lineType Type of the line
  23. const int nLineType = 8;
  24. // tg10~tg80
  25. const long ANGLE_MAX = 8;
  26. const double TAN_VALUES[ANGLE_MAX] =
  27. {
  28. // 10, 20, 30, 40, 50, 60, 70, 80
  29. 0.176,0.364,0.577,0.839,1.192,1.732,2.747,5.671
  30. };
  31. const double VALUE_MIN = 0.9;
  32. typedef enum class AXIAS_DIRECTION
  33. {
  34. INVALID = -1,
  35. MIN = 0,
  36. XAX = 0,
  37. YAX = 1,
  38. MAX = 1
  39. }AXIAS_DIRECTION;
  40. // calculate image properties
  41. class __declspec(dllexport) CGBImgPropCal
  42. {
  43. public:
  44. CGBImgPropCal(); // construct
  45. ~CGBImgPropCal(); // destruct
  46. // get particle ferret diameter
  47. static BOOL GetParticleFTD(COTSParticlePtr a_pOTSPart, double a_PixelSize, double &dPartFTD, double &dMinWidth, double &dMaxLength, double &dRatio);
  48. protected:
  49. // initialisation
  50. void Init();
  51. // clear
  52. void Clear();
  53. // get distance from 3 points
  54. static double GetDisFrom3(double a_s1, double a_s2, double a_s3);
  55. static BOOL GetDisFrom2list(std::vector<CPoint> a_list1, std::vector<CPoint> a_list2, std::vector<double>& a_listFlt);
  56. static BOOL GetDisFrom4list(std::vector<CPoint> a_list1, std::vector<CPoint> a_list2,
  57. std::vector<CPoint> a_list3, std::vector<CPoint> a_list4, std::vector<double>& a_listFlt);
  58. static double GetDisFromRLNeigbor(std::vector<CPoint> a_Yaxislist, std::vector<CPoint> a_YaxisRightlist, std::vector<CPoint> a_YaxisLeftlist);
  59. static double GetDisFromUDNeigbor(std::vector<CPoint> a_Xaxislist, std::vector<CPoint> a_XaxisUplist, std::vector<CPoint> a_XaxisDownlist);
  60. static BOOL GetMaxMin(std::vector<CPoint> a_Xaxislist, AXIAS_DIRECTION a_nDirection, int& a_nMax, int& a_nMin);
  61. static double GetRadiusAsK(std::vector<CPoint> a_Ptlist, double a_k);
  62. static BOOL GetDisFrom13list(std::vector<CPoint> a_list1,
  63. std::vector<CPoint> a_list3, std::vector<double>& a_listFlt);
  64. static BOOL GetDisFrom24list(std::vector<CPoint> a_list2,
  65. std::vector<CPoint> a_list4, std::vector<double>& a_listFlt);
  66. static BOOL GetSuperParticleSize(COTSParticlePtr a_pOTSPart,
  67. double &a_dMinWidth,double &a_dMaxLength, double &a_dAveDia);
  68. };
  69. }