00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkDistanceToCentroidMembershipFunction.h,v $ 00005 Language: C++ 00006 Date: $Date: 2005/11/21 02:40:48 $ 00007 Version: $Revision: 1.9 $ 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 __itkDistanceToCentroidMembershipFunction_h 00018 #define __itkDistanceToCentroidMembershipFunction_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 00041 template< class TVector > 00042 class ITK_EXPORT DistanceToCentroidMembershipFunction : 00043 public MembershipFunctionBase< TVector > 00044 { 00045 public: 00047 typedef DistanceToCentroidMembershipFunction Self; 00048 typedef MembershipFunctionBase< TVector > Superclass ; 00049 typedef SmartPointer<Self> Pointer; 00050 typedef SmartPointer<const Self> ConstPointer; 00051 00053 itkTypeMacro(DistanceToCentroidMembershipFunction, MembershipFunctionBase); 00054 itkNewMacro(Self); 00055 00057 typedef TVector MeasurementVectorType ; 00058 00060 typedef typename Superclass::MeasurementVectorSizeType MeasurementVectorSizeType; 00061 00063 virtual void SetMeasurementVectorSize( const MeasurementVectorSizeType ); 00064 00066 void SetCentroid(const vnl_vector<double> ¢roid) ; 00067 00069 const vnl_vector<double> & GetCentroid() const; 00070 00072 itkSetMacro( NumberOfSamples, int ); 00073 00075 itkGetMacro( NumberOfSamples, int ); 00076 00080 double Evaluate(const MeasurementVectorType &measurement) const; 00081 00082 protected: 00083 DistanceToCentroidMembershipFunction(void) ; 00084 virtual ~DistanceToCentroidMembershipFunction(void) {} 00085 void PrintSelf(std::ostream& os, Indent indent) const; 00086 00087 private: 00088 vnl_vector< double > m_Centroid; // mean 00089 00090 // Number of samples defining this density 00091 int m_NumberOfSamples; 00092 }; 00093 00094 } // end of namespace Statistics 00095 } // end namespace itk 00096 00097 #ifndef ITK_MANUAL_INSTANTIATION 00098 #include "itkDistanceToCentroidMembershipFunction.txx" 00099 #endif 00100 00101 #endif