00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkMembershipFunctionBase.h,v $ 00005 Language: C++ 00006 Date: $Date: 2009-03-04 15:24:02 $ 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 __itkMembershipFunctionBase_h 00018 #define __itkMembershipFunctionBase_h 00019 00020 #include "itkFunctionBase.h" 00021 #include "itkMeasurementVectorTraits.h" 00022 00023 namespace itk { 00024 namespace Statistics { 00025 00037 template< class TVector > 00038 class ITK_EXPORT MembershipFunctionBase : 00039 public FunctionBase< TVector, double > 00040 { 00041 public: 00043 typedef MembershipFunctionBase Self; 00044 typedef FunctionBase< TVector, double > Superclass; 00045 typedef SmartPointer< Self > Pointer; 00046 typedef SmartPointer<const Self> ConstPointer; 00047 00049 itkTypeMacro(MembershipFunctionBase, FunctionBase); 00050 00052 typedef unsigned int MeasurementVectorSizeType; 00053 00055 virtual double Evaluate(const TVector &x) const = 0; 00056 00058 itkSetMacro( MeasurementVectorSize, MeasurementVectorSizeType ); 00059 itkGetConstMacro( MeasurementVectorSize, MeasurementVectorSizeType ); 00061 00062 protected: 00063 MembershipFunctionBase() : m_MeasurementVectorSize( 00064 MeasurementVectorTraits::GetLength( TVector() ) ) {} 00065 virtual ~MembershipFunctionBase(void) {} 00066 00067 void PrintSelf(std::ostream& os, Indent indent) const 00068 { 00069 Superclass::PrintSelf(os,indent); 00070 os << indent << "Length of measurement vectors: " 00071 << m_MeasurementVectorSize << std::endl; 00072 } 00073 00074 MeasurementVectorSizeType m_MeasurementVectorSize; 00075 }; // end of class 00076 00077 } // end of namespace Statistics 00078 } // end namespace itk 00079 00080 #endif 00081