00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkDistanceToCentroidMembershipFunction.h,v $ 00005 Language: C++ 00006 Date: $Date: 2009-05-02 05:43:55 $ 00007 Version: $Revision: 1.1 $ 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 "itkMembershipFunctionBase.h" 00021 #include "itkDistanceMetric.h" 00022 00023 namespace itk { 00024 namespace Statistics { 00025 00035 template< class TVector > 00036 class ITK_EXPORT DistanceToCentroidMembershipFunction : 00037 public MembershipFunctionBase< TVector > 00038 { 00039 public: 00041 typedef DistanceToCentroidMembershipFunction Self; 00042 typedef MembershipFunctionBase< TVector > Superclass; 00043 typedef SmartPointer<Self> Pointer; 00044 typedef SmartPointer<const Self> ConstPointer; 00045 00047 itkTypeMacro(DistanceToCentroidMembershipFunction, 00048 MembershipFunctionBase); 00049 itkNewMacro(Self); 00051 00053 typedef TVector MeasurementVectorType; 00054 00056 typedef typename Superclass::MeasurementVectorSizeType 00057 MeasurementVectorSizeType; 00058 00060 virtual void SetMeasurementVectorSize( MeasurementVectorSizeType ); 00061 00063 typedef DistanceMetric< MeasurementVectorType > DistanceMetricType; 00064 typedef typename DistanceMetricType::Pointer DistanceMetricPointer; 00065 00067 itkSetObjectMacro( DistanceMetric, DistanceMetricType ); 00068 itkGetConstObjectMacro( DistanceMetric, DistanceMetricType ); 00070 00071 typedef typename DistanceMetricType::OriginType CentroidType; 00072 00074 void SetCentroid(const CentroidType & centroid); 00075 00077 const CentroidType & GetCentroid() const; 00078 00082 double Evaluate(const MeasurementVectorType &measurement) const; 00083 00085 Pointer Clone(); 00086 00087 protected: 00088 DistanceToCentroidMembershipFunction(void); 00089 virtual ~DistanceToCentroidMembershipFunction(void) {} 00090 void PrintSelf(std::ostream& os, Indent indent) const; 00091 00092 private: 00093 00094 DistanceMetricPointer m_DistanceMetric; 00095 00096 }; 00097 00098 } // end of namespace Statistics 00099 } // end namespace itk 00100 00101 #ifndef ITK_MANUAL_INSTANTIATION 00102 #include "itkDistanceToCentroidMembershipFunction.txx" 00103 #endif 00104 00105 #endif 00106