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/09/10 14:29:45 $
00007   Version:   $Revision: 1.8 $
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 
00055   itkTypeMacro(ExpectationMaximizationMixtureModelEstimator,
00056                Object);
00057   itkNewMacro(Self) ;
00058 
00060   itkStaticConstMacro(MeasurementVectorSize, unsigned int,
00061                       TSample::MeasurementVectorSize);
00062 
00064   typedef typename TSample::MeasurementType MeasurementType ;
00065   typedef typename TSample::MeasurementVectorType MeasurementVectorType ;
00066 
00068   typedef MixtureModelComponentBase< TSample > ComponentType ;
00069 
00071   typedef std::vector< ComponentType* > ComponentVectorType ;
00072 
00074   typedef MembershipFunctionBase< MeasurementVectorType > 
00075   ComponentMembershipFunctionType ;
00076 
00078   typedef Array< double > ProportionVectorType ;
00079 
00081   void SetSample(TSample* sample) ;
00082 
00084   TSample* GetSample() ;
00085 
00088   void SetInitialProportions(ProportionVectorType &propotion) ;
00089   ProportionVectorType* GetInitialProportions() ;
00090 
00092   ProportionVectorType* GetProportions() ;
00093 
00098   void SetMaximumIteration(int numberOfIterations) ;
00099   int GetMaximumIteration() ;
00100 
00102   int GetCurrentIteration() 
00103   { return m_CurrentIteration ; }
00104 
00106   int AddComponent(ComponentType* component) ;
00107 
00109   int GetNumberOfComponents() ;
00110 
00112   void Update() ;
00113 
00115   enum TERMINATION_CODE { CONVERGED = 0, NOT_CONVERGED = 1 } ;
00116 
00118   TERMINATION_CODE GetTerminationCode() ;
00119 
00122   ComponentMembershipFunctionType* GetComponentMembershipFunction(int componentIndex) ;
00123 
00124 protected:
00125   ExpectationMaximizationMixtureModelEstimator() ;
00126   virtual ~ExpectationMaximizationMixtureModelEstimator() {}
00127   void PrintSelf(std::ostream& os, Indent indent) const ;
00128 
00129   bool CalculateDensities() ;
00130   double CalculateExpectation() ;
00131   bool UpdateComponentParameters() ;
00132   bool UpdateProportions() ;
00133 
00135   void GenerateData() ;
00136 
00137 private:
00139   TSample* m_Sample ;
00140 
00141   int m_MaxIteration ;
00142   int m_CurrentIteration ;
00143   TERMINATION_CODE m_TerminationCode ;
00144   ComponentVectorType m_ComponentVector ;
00145   ProportionVectorType m_InitialProportions ;
00146   ProportionVectorType m_Proportions ;
00147 } ; // end of class
00148 
00149 
00150 } // end of namespace Statistics 
00151 } // end of namespace itk
00152 
00153 
00154 #ifndef ITK_MANUAL_INSTANTIATION
00155 #include "itkExpectationMaximizationMixtureModelEstimator.txx"
00156 #endif
00157 
00158 #endif
00159 
00160 
00161 
00162 
00163 
00164 
00165 

Generated at Tue Sep 16 11:31:57 2003 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000