00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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
00042
template<
class TVector >
00043 class ITK_EXPORT DistanceToCentroidMembershipFunction :
00044
public MembershipFunctionBase< TVector >
00045 {
00046
public:
00048 typedef DistanceToCentroidMembershipFunction
Self;
00049 typedef MembershipFunctionBase< TVector > Superclass ;
00050 typedef SmartPointer<Self> Pointer;
00051
00053
itkTypeMacro(DistanceToCentroidMembershipFunction,
MembershipFunctionBase);
00054
itkNewMacro(
Self);
00055
00057
typedef TVector
MeasurementVectorType ;
00058
00060
void SetCentroid(
const vnl_vector<double> ¢roid) ;
00061
00063
const vnl_vector<double> & GetCentroid() const;
00064
00066 itkSetMacro( NumberOfSamples,
int );
00067
00069 itkGetMacro( NumberOfSamples,
int );
00070
00074
double Evaluate(const
MeasurementVectorType &measurement) const;
00075
00076 protected:
00077 DistanceToCentroidMembershipFunction(
void) ;
00078 virtual ~DistanceToCentroidMembershipFunction(
void) {}
00079 void PrintSelf(std::ostream& os,
Indent indent)
const;
00080
00081
private:
00082
vnl_vector< double > m_Centroid;
00083
00084
00085
int m_NumberOfSamples;
00086
00087
itkStaticConstMacro(VectorDimension,
unsigned int, TVector::Dimension);
00088
typedef vnl_matrix_fixed<double,1,itkGetStaticConstMacro(VectorDimension)> ColumnVectorType;
00089
00090
mutable ColumnVectorType m_TempVec;
00091
mutable ColumnVectorType m_TempMat;
00092 };
00093
00094 }
00095 }
00096
00097
#ifndef ITK_MANUAL_INSTANTIATION
00098
#include "itkDistanceToCentroidMembershipFunction.txx"
00099
#endif
00100
00101
#endif