Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkMahalanobisDistanceMembershipFunction.h

Go to the documentation of this file.
00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkMahalanobisDistanceMembershipFunction.h,v $ 00005 Language: C++ 00006 Date: $Date: 2003/09/10 14:29:46 $ 00007 Version: $Revision: 1.7 $ 00008 00009 Copyright (c) Insight Software Consortium. All rights reserved. 00010 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 #ifndef __itkMahalanobisDistanceMembershipFunction_h 00018 #define __itkMahalanobisDistanceMembershipFunction_h 00019 00020 #include <vnl/vnl_vector.h> 00021 #include <vnl/vnl_transpose.h> 00022 #include <vnl/vnl_matrix.h> 00023 #include <vnl/algo/vnl_matrix_inverse.h> 00024 #include <vnl/algo/vnl_determinant.h> 00025 00026 00027 #include "itkMembershipFunctionBase.h" 00028 00029 00030 namespace itk{ 00031 namespace Statistics{ 00032 00042 template< class TVector > 00043 class ITK_EXPORT MahalanobisDistanceMembershipFunction : 00044 public MembershipFunctionBase< TVector > 00045 { 00046 public: 00048 typedef MahalanobisDistanceMembershipFunction Self; 00049 typedef MembershipFunctionBase< TVector > Superclass ; 00050 typedef SmartPointer<Self> Pointer; 00051 00053 itkTypeMacro(MahalanobisDistanceMembershipFunction, MembershipFunctionBase); 00054 itkNewMacro(Self); 00055 00057 typedef TVector MeasurementVectorType ; 00058 00060 typedef vnl_vector<double> MeanVectorType; 00061 00063 typedef vnl_matrix<double> CovarianceMatrixType; 00064 00066 void SetMean(const MeanVectorType &mean) ; 00067 00069 const MeanVectorType & GetMean() const; 00070 00075 void SetCovariance(const CovarianceMatrixType &cov); 00076 00078 const CovarianceMatrixType & GetCovariance() const; 00079 00084 void SetInverseCovariance(const CovarianceMatrixType &invcov); 00085 00087 const CovarianceMatrixType & GetInverseCovariance() const; 00088 00090 itkSetMacro( NumberOfSamples, double ); 00091 00093 itkGetMacro( NumberOfSamples, double ); 00094 00098 double Evaluate(const MeasurementVectorType &measurement) const; 00099 00100 protected: 00101 MahalanobisDistanceMembershipFunction(void) ; 00102 virtual ~MahalanobisDistanceMembershipFunction(void) {} 00103 void PrintSelf(std::ostream& os, Indent indent) const; 00104 00105 private: 00106 MeanVectorType m_Mean; // mean 00107 CovarianceMatrixType m_Covariance; // covariance matrix 00108 00109 // inverse covariance matrix which is automatically calculated 00110 // when covariace matirx is set. This speed up the GetProbability() 00111 CovarianceMatrixType m_InverseCovariance; 00112 00113 // Number of samples defining this density 00114 double m_NumberOfSamples; 00115 // pre_factor which is automatically calculated 00116 // when covariace matirx is set. This speeds up the GetProbability() 00117 double m_PreFactor; 00118 double m_Epsilon; 00119 double m_DoubleMax; 00120 00121 bool m_ValidInverseCovarianceFlag; 00122 00123 itkStaticConstMacro(VectorDimension, unsigned int, TVector::Dimension); 00124 typedef vnl_matrix_fixed<double,1,itkGetStaticConstMacro(VectorDimension)> ColumnVectorType; 00125 00126 mutable ColumnVectorType m_TempVec; 00127 mutable ColumnVectorType m_TempMat; 00128 00129 void CalculateInverseCovariance(); 00130 }; 00131 00132 } // end of namespace Statistics 00133 } // end namespace itk 00134 00135 #ifndef ITK_MANUAL_INSTANTIATION 00136 #include "itkMahalanobisDistanceMembershipFunction.txx" 00137 #endif 00138 00139 #endif

Generated at Sat Mar 31 02:23:55 2007 for ITK by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2000