00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkMixtureModelComponentBase_h
00018 #define __itkMixtureModelComponentBase_h
00019
00020 #include <vnl/vnl_vector.h>
00021 #include <vnl/vnl_matrix.h>
00022
00023 #include "itkArray.h"
00024 #include "itkObject.h"
00025 #include "itkMembershipFunctionBase.h"
00026
00027 namespace itk{
00028 namespace Statistics{
00029
00052 template< class TSample >
00053 class MixtureModelComponentBase :
00054 public Object
00055 {
00056 public:
00058 typedef MixtureModelComponentBase Self;
00059 typedef Object Superclass ;
00060 typedef SmartPointer<Self> Pointer;
00061 typedef SmartPointer<const Self> ConstPointer;
00062
00064 itkTypeMacro(MixtureModelComponentBase, Object);
00065 itkNewMacro(Self) ;
00066
00067 typedef typename TSample::MeasurementVectorType MeasurementVectorType ;
00068
00070 typedef MembershipFunctionBase< MeasurementVectorType >
00071 MembershipFunctionType ;
00072
00074 typedef Array< double > WeightArrayType ;
00075
00076 typedef Array< double > ParametersType ;
00077
00079 virtual void SetSample(const TSample* sample) ;
00080
00082 const TSample* GetSample() const;
00083
00088 MembershipFunctionType* GetMembershipFunction() ;
00089
00090 void SetMinimalParametersChange(double change)
00091 { m_MinimalParametersChange = change ; }
00092
00093 double GetMinimalParametersChange()
00094 { return m_MinimalParametersChange ; }
00095
00096 virtual void SetParameters(const ParametersType ¶meters) ;
00097
00098 virtual ParametersType GetFullParameters()
00099 { return m_Parameters ; }
00100
00101
00104 void AreParametersModified(bool flag) ;
00105
00107 bool AreParametersModified() ;
00108
00110 void SetWeight(int index, double value) ;
00111
00113 double GetWeight(int index) ;
00114
00116 double Evaluate(MeasurementVectorType& measurements) ;
00117
00119 WeightArrayType* GetWeights() ;
00120
00121 virtual void Update() ;
00122
00123 protected:
00124 MixtureModelComponentBase() ;
00125 virtual ~MixtureModelComponentBase() ;
00126 void PrintSelf(std::ostream& os, Indent indent) const;
00127
00129 void CreateWeightArray() ;
00131 void DeleteWeightArray() ;
00135 void SetMembershipFunction(MembershipFunctionType* function) ;
00136
00137 virtual void GenerateData() ;
00138
00139 private:
00141 const TSample* m_Sample ;
00142
00143 double m_MinimalParametersChange ;
00144
00145 ParametersType m_Parameters ;
00147 MembershipFunctionType* m_MembershipFunction ;
00149 WeightArrayType* m_Weights ;
00151 bool m_ParametersModified ;
00152
00153 } ;
00154
00155 }
00156 }
00157
00158 #ifndef ITK_MANUAL_INSTANTIATION
00159 #include "itkMixtureModelComponentBase.txx"
00160 #endif
00161
00162 #endif
00163