Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkExpectationMaximizationMixtureModelEstimator.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkExpectationMaximizationMixtureModelEstimator.h,v $
00005   Language:  C++
00006   Date:      $Date: 2003/12/15 01:00:46 $
00007   Version:   $Revision: 1.10 $
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 __itkExpectationMaximizationMixtureModelEstimator_h
00018 #define __itkExpectationMaximizationMixtureModelEstimator_h
00019 
00020 #include "itkMembershipFunctionBase.h"
00021 #include "itkMixtureModelComponentBase.h"
00022 
00023 namespace itk{ 
00024 namespace Statistics{
00025 
00045 template< class TSample >
00046 class ITK_EXPORT ExpectationMaximizationMixtureModelEstimator : public Object
00047 {
00048 public:
00050   typedef ExpectationMaximizationMixtureModelEstimator Self;
00051   typedef Object Superclass;
00052   typedef SmartPointer< Self > Pointer;
00053   typedef SmartPointer<const Self> ConstPointer;
00054 
00056   itkTypeMacro(ExpectationMaximizationMixtureModelEstimator,
00057                Object);
00058   itkNewMacro(Self) ;
00059 
00061   itkStaticConstMacro(MeasurementVectorSize, unsigned int,
00062                       TSample::MeasurementVectorSize);
00063 
00065   typedef typename TSample::MeasurementType MeasurementType ;
00066   typedef typename TSample::MeasurementVectorType MeasurementVectorType ;
00067 
00069   typedef MixtureModelComponentBase< TSample > ComponentType ;
00070 
00072   typedef std::vector< ComponentType* > ComponentVectorType ;
00073 
00075   typedef MembershipFunctionBase< MeasurementVectorType > 
00076   ComponentMembershipFunctionType ;
00077 
00079   typedef Array< double > ProportionVectorType ;
00080 
00082   void SetSample(const TSample* sample) ;
00083 
00085   const TSample* GetSample() const;
00086 
00089   void SetInitialProportions(ProportionVectorType &propotion) ;
00090   ProportionVectorType* GetInitialProportions() ;
00091 
00093   ProportionVectorType* GetProportions() ;
00094 
00099   void SetMaximumIteration(int numberOfIterations) ;
00100   int GetMaximumIteration() ;
00101 
00103   int GetCurrentIteration() 
00104   { return m_CurrentIteration ; }
00105 
00107   int AddComponent(ComponentType* component) ;
00108 
00110   int GetNumberOfComponents() ;
00111 
00113   void Update() ;
00114 
00116   enum TERMINATION_CODE { CONVERGED = 0, NOT_CONVERGED = 1 } ;
00117 
00119   TERMINATION_CODE GetTerminationCode() ;
00120 
00123   ComponentMembershipFunctionType* GetComponentMembershipFunction(int componentIndex) ;
00124 
00125 protected:
00126   ExpectationMaximizationMixtureModelEstimator() ;
00127   virtual ~ExpectationMaximizationMixtureModelEstimator() {}
00128   void PrintSelf(std::ostream& os, Indent indent) const ;
00129 
00130   bool CalculateDensities() ;
00131   double CalculateExpectation() ;
00132   bool UpdateComponentParameters() ;
00133   bool UpdateProportions() ;
00134 
00136   void GenerateData() ;
00137 
00138 private:
00140   const TSample* m_Sample ;
00141 
00142   int m_MaxIteration ;
00143   int m_CurrentIteration ;
00144   TERMINATION_CODE m_TerminationCode ;
00145   ComponentVectorType m_ComponentVector ;
00146   ProportionVectorType m_InitialProportions ;
00147   ProportionVectorType m_Proportions ;
00148 } ; // end of class
00149 
00150 
00151 } // end of namespace Statistics 
00152 } // end of namespace itk
00153 
00154 
00155 #ifndef ITK_MANUAL_INSTANTIATION
00156 #include "itkExpectationMaximizationMixtureModelEstimator.txx"
00157 #endif
00158 
00159 #endif
00160 
00161 
00162 
00163 
00164 
00165 
00166 

Generated at Tue Mar 29 23:50:44 2005 for ITK by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2000