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: 2005/07/26 15:54:55 $
00007   Version:   $Revision: 1.12 $
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 
00052 template< class TSample >
00053 class ITK_EXPORT ExpectationMaximizationMixtureModelEstimator : public Object
00054 {
00055 public:
00057   typedef ExpectationMaximizationMixtureModelEstimator Self;
00058   typedef Object Superclass;
00059   typedef SmartPointer< Self > Pointer;
00060   typedef SmartPointer<const Self> ConstPointer;
00061 
00063   itkTypeMacro(ExpectationMaximizationMixtureModelEstimator,
00064                Object);
00065   itkNewMacro(Self) ;
00067 
00069   typedef typename TSample::MeasurementType MeasurementType ;
00070   typedef typename TSample::MeasurementVectorType MeasurementVectorType ;
00071 
00073   typedef MixtureModelComponentBase< TSample > ComponentType ;
00074 
00076   typedef std::vector< ComponentType* > ComponentVectorType ;
00077 
00079   typedef MembershipFunctionBase< MeasurementVectorType > 
00080   ComponentMembershipFunctionType ;
00081 
00083   typedef Array< double > ProportionVectorType ;
00084 
00086   void SetSample(const TSample* sample) ;
00087 
00089   const TSample* GetSample() const;
00090 
00093   void SetInitialProportions(ProportionVectorType &propotion) ;
00094   ProportionVectorType* GetInitialProportions() ;
00096 
00098   ProportionVectorType* GetProportions() ;
00099 
00104   void SetMaximumIteration(int numberOfIterations) ;
00105   int GetMaximumIteration() ;
00107 
00109   int GetCurrentIteration() 
00110   { return m_CurrentIteration ; }
00111 
00113   int AddComponent(ComponentType* component) ;
00114 
00116   unsigned int GetNumberOfComponents() ;
00117 
00119   void Update() ;
00120 
00122   enum TERMINATION_CODE { CONVERGED = 0, NOT_CONVERGED = 1 } ;
00123 
00125   TERMINATION_CODE GetTerminationCode() ;
00126 
00129   ComponentMembershipFunctionType* GetComponentMembershipFunction(int componentIndex) ;
00130 
00131 protected:
00132   ExpectationMaximizationMixtureModelEstimator() ;
00133   virtual ~ExpectationMaximizationMixtureModelEstimator() {}
00134   void PrintSelf(std::ostream& os, Indent indent) const ;
00135 
00136   bool CalculateDensities() ;
00137   double CalculateExpectation() ;
00138   bool UpdateComponentParameters() ;
00139   bool UpdateProportions() ;
00140 
00142   void GenerateData() ;
00143 
00144 private:
00146   const TSample* m_Sample ;
00147 
00148   int m_MaxIteration ;
00149   int m_CurrentIteration ;
00150   TERMINATION_CODE m_TerminationCode ;
00151   ComponentVectorType m_ComponentVector ;
00152   ProportionVectorType m_InitialProportions ;
00153   ProportionVectorType m_Proportions ;
00154 } ; // end of class
00155 
00156 
00157 } // end of namespace Statistics 
00158 } // end of namespace itk
00159 
00160 
00161 #ifndef ITK_MANUAL_INSTANTIATION
00162 #include "itkExpectationMaximizationMixtureModelEstimator.txx"
00163 #endif
00164 
00165 #endif
00166 
00167 
00168 
00169 
00170 
00171 
00172 
00173 

Generated at Sun Sep 23 12:27:34 2007 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000