00001 //============================================================================== 00015 #ifndef MDS_TETRAHOMOGENEITYMEASURE_H 00016 #define MDS_TETRAHOMOGENEITYMEASURE_H 00017 00018 #include "mdsTetraFeatures.h" 00019 00020 // MDSTk 00021 #include <MDSTk/Math/mdsVectorFunctions.h> 00022 00023 // STL 00024 #include <cmath> 00025 00026 00027 namespace mds 00028 { 00029 namespace seg 00030 { 00031 00032 //============================================================================== 00036 class CTetraHomogeneityMeasure 00037 { 00038 public: 00040 CTetraHomogeneityMeasure(double dThreshold = 0.5) : m_dThreshold(dThreshold) {} 00041 00043 virtual ~CTetraHomogeneityMeasure() {} 00044 00046 virtual double getHomogeneity(const CTetraFeatures& v1) = 0; 00047 00048 00052 bool checkHomogeneity(const CTetraFeatures& v1) 00053 { 00054 return (this->getHomogeneity(v1) > m_dThreshold); 00055 } 00056 00058 double getThreshold() { return m_dThreshold; } 00059 00061 void setThreshold(double dValue) { m_dThreshold = dValue; } 00062 00063 protected: 00065 double m_dThreshold; 00066 }; 00067 00068 00069 //============================================================================== 00074 class CTetraVarianceHomogeneity : public CTetraHomogeneityMeasure 00075 { 00076 public: 00078 static const double DEFAULT_THRESHOLD; 00079 static const double DEFAULT_RHO; 00080 00081 public: 00083 CTetraVarianceHomogeneity(double dThreshold = DEFAULT_THRESHOLD, 00084 double dRho = DEFAULT_RHO 00085 ); 00086 00088 virtual ~CTetraVarianceHomogeneity() {} 00089 00091 virtual double getHomogeneity(const CTetraFeatures& v1); 00092 00093 protected: 00095 double m_dInvRho; 00096 }; 00097 00098 00099 } // namespace seg 00100 } // namespace mds 00101 00102 #endif // MDS_TETRAHOMOGENEITYMEASURE_H 00103