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 ITK_EXPORT 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
00066 typedef typename TSample::MeasurementVectorType MeasurementVectorType;
00067 typedef typename TSample::MeasurementVectorSizeType MeasurementVectorSizeType;
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 {
00092 m_MinimalParametersChange = change;
00093 }
00094
00095 double GetMinimalParametersChange()
00096 {
00097 return m_MinimalParametersChange;
00098 }
00099
00100 virtual void SetParameters(const ParametersType ¶meters);
00101
00102 virtual ParametersType GetFullParameters()
00103 {
00104 return m_Parameters;
00105 }
00106
00109 void AreParametersModified(bool flag);
00110
00112 bool AreParametersModified();
00113
00115 void SetWeight(unsigned int index, double value);
00116
00118 double GetWeight(unsigned int index) const;
00119
00121 double Evaluate(MeasurementVectorType& measurements);
00122
00124 itkGetConstReferenceMacro( Weights, WeightArrayType );
00125
00126 virtual void Update();
00127
00128 protected:
00129 MixtureModelComponentBase();
00130 virtual ~MixtureModelComponentBase();
00131 void PrintSelf(std::ostream& os, Indent indent) const;
00132
00136 void SetMembershipFunction(MembershipFunctionType* function);
00137
00138 virtual void GenerateData() = 0;
00139
00140 private:
00142 const TSample* m_Sample;
00143
00144 double m_MinimalParametersChange;
00145
00146 ParametersType m_Parameters;
00147
00149 MembershipFunctionType* m_MembershipFunction;
00150
00152 WeightArrayType m_Weights;
00153
00155 bool m_ParametersModified;
00156
00157 };
00158
00159 }
00160 }
00161
00162 #ifndef ITK_MANUAL_INSTANTIATION
00163 #include "itkMixtureModelComponentBase.txx"
00164 #endif
00165
00166 #endif
00167