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: 2002/09/22 17:25:04 $
00007   Version:   $Revision: 1.5 $
00008 
00009   Copyright (c) 2002 Insight 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 
00060 template< class TSample >
00061 class ITK_EXPORT ExpectationMaximizationMixtureModelEstimator : public Object
00062 {
00063 public:
00065   typedef ExpectationMaximizationMixtureModelEstimator Self;
00066   typedef Object Superclass;
00067   typedef SmartPointer< Self > Pointer;
00068 
00070   itkTypeMacro(ExpectationMaximizationMixtureModelEstimator,
00071                Object);
00072   itkNewMacro(Self) ;
00073 
00075   itkStaticConstMacro(MeasurementVectorSize, unsigned int,
00076                       TSample::MeasurementVectorSize);
00077 
00079   typedef typename TSample::MeasurementType MeasurementType ;
00080   typedef typename TSample::MeasurementVectorType MeasurementVectorType ;
00081 
00082   typedef MixtureModelComponentBase< TSample > ComponentType ;
00083   typedef std::vector< ComponentType* > ComponentVectorType ;
00084   typedef MembershipFunctionBase< MeasurementVectorType > ComponentMembershipFunctionType ;
00085 
00087   void SetSample(TSample* sample) ;
00088 
00090   TSample* GetSample() ;
00091 
00092   typedef Array< double > ProportionVectorType ;
00093 
00094   void SetInitialProportions(ProportionVectorType &propotion) ;
00095 
00096   ProportionVectorType* GetInitialProportions() ;
00097 
00098   ProportionVectorType* GetProportions() ;
00099 
00100   void SetMaximumIteration(int numberOfIterations) ;
00101   
00102   int GetMaximumIteration() ;
00103 
00104   int GetCurrentIteration() 
00105   { return m_CurrentIteration ; }
00106 
00107   int AddComponent(ComponentType* component) ;
00108 
00109   int GetNumberOfComponents() ;
00110 
00111   void Update() ;
00112 
00113   enum TERMINATION_CODE { CONVERGED = 0, NOT_CONVERGED = 1 } ;
00114 
00115   TERMINATION_CODE GetTerminationCode() ;
00116   ComponentMembershipFunctionType* GetComponentMembershipFunction(int componentIndex) ;
00117 
00118 protected:
00119   ExpectationMaximizationMixtureModelEstimator() ;
00120   virtual ~ExpectationMaximizationMixtureModelEstimator() {}
00121   void PrintSelf(std::ostream& os, Indent indent) const ;
00122 
00123   bool CalculateDensities() ;
00124   double CalculateExpectation() ;
00125   bool UpdateComponentParameters() ;
00126   bool UpdateProportions() ;
00127 
00129   void GenerateData() ;
00130 
00131 private:
00133   TSample* m_Sample ;
00134 
00135   int m_MaxIteration ;
00136   int m_CurrentIteration ;
00137   TERMINATION_CODE m_TerminationCode ;
00138   ComponentVectorType m_ComponentVector ;
00139   ProportionVectorType m_InitialProportions ;
00140   ProportionVectorType m_Proportions ;
00141 } ; // end of class
00142 
00143 
00144 } // end of namespace Statistics 
00145 } // end of namespace itk
00146 
00147 
00148 #ifndef ITK_MANUAL_INSTANTIATION
00149 #include "itkExpectationMaximizationMixtureModelEstimator.txx"
00150 #endif
00151 
00152 #endif
00153 
00154 
00155 
00156 
00157 
00158 
00159 

Generated at Fri May 21 01:14:41 2004 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000