#pragma once #include "OTSParticle.h" //#define PI 3.1416 namespace OTSIMGPROC { using namespace OTSDATA; // cal image data size expand size by rectangle const int nExpand_Size = 1; // cirlcle cal value //const double Pi = 3.14159265; //make matrix filled with 255 //const int nBlackColor = 255; //make matrix filled with 0 const int nWhiteColor = 0; // divide the sum of the half diameter const int nDivide = 36; // divide the sum of the total diameter const int nCircleDivide = 18; // the start cal angle const double dStartAngle = 0.17; // thickness Line thickness const int nThickness = 1; // lineType Type of the line const int nLineType = 8; // tg10~tg80 const long ANGLE_MAX = 8; const double TAN_VALUES[ANGLE_MAX] = { // 10, 20, 30, 40, 50, 60, 70, 80 0.176,0.364,0.577,0.839,1.192,1.732,2.747,5.671 }; const double VALUE_MIN = 0.9; typedef enum class AXIAS_DIRECTION { INVALID = -1, MIN = 0, XAX = 0, YAX = 1, MAX = 1 }AXIAS_DIRECTION; // calculate image properties class __declspec(dllexport) CGBImgPropCal { public: CGBImgPropCal(); // construct ~CGBImgPropCal(); // destruct // get particle ferret diameter static BOOL GetParticleFTD(COTSParticlePtr a_pOTSPart, double a_PixelSize, double &dPartFTD, double &dMinWidth, double &dMaxLength, double &dRatio); protected: // initialisation void Init(); // clear void Clear(); // get distance from 3 points static double GetDisFrom3(double a_s1, double a_s2, double a_s3); static BOOL GetDisFrom2list(std::vector a_list1, std::vector a_list2, std::vector& a_listFlt); static BOOL GetDisFrom4list(std::vector a_list1, std::vector a_list2, std::vector a_list3, std::vector a_list4, std::vector& a_listFlt); static double GetDisFromRLNeigbor(std::vector a_Yaxislist, std::vector a_YaxisRightlist, std::vector a_YaxisLeftlist); static double GetDisFromUDNeigbor(std::vector a_Xaxislist, std::vector a_XaxisUplist, std::vector a_XaxisDownlist); static BOOL GetMaxMin(std::vector a_Xaxislist, AXIAS_DIRECTION a_nDirection, int& a_nMax, int& a_nMin); static double GetRadiusAsK(std::vector a_Ptlist, double a_k); static BOOL GetDisFrom13list(std::vector a_list1, std::vector a_list3, std::vector& a_listFlt); static BOOL GetDisFrom24list(std::vector a_list2, std::vector a_list4, std::vector& a_listFlt); static BOOL GetSuperParticleSize(COTSParticlePtr a_pOTSPart, double &a_dMinWidth,double &a_dMaxLength, double &a_dAveDia); }; }