00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkGaussianMixtureModelComponent.h,v $ 00005 Language: C++ 00006 Date: $Date: 2003/09/10 14:29:45 $ 00007 Version: $Revision: 1.7 $ 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 00018 #ifndef __itkGaussianMixtureModelComponent_h 00019 #define __itkGaussianMixtureModelComponent_h 00020 00021 #include "itkMixtureModelComponentBase.h" 00022 #include "itkGaussianDensityFunction.h" 00023 #include "itkWeightedMeanCalculator.h" 00024 #include "itkWeightedCovarianceCalculator.h" 00025 00026 namespace itk{ 00027 namespace Statistics{ 00028 00040 template< class TSample > 00041 class GaussianMixtureModelComponent : 00042 public MixtureModelComponentBase< TSample > 00043 { 00044 public: 00046 typedef GaussianMixtureModelComponent Self; 00047 typedef MixtureModelComponentBase< TSample > Superclass ; 00048 typedef SmartPointer<Self> Pointer; 00049 00051 itkTypeMacro(GaussianMixtureModelComponent, MixtureModelComponentBase); 00052 itkNewMacro(Self) ; 00053 00055 itkStaticConstMacro(MeasurementVectorSize, unsigned int, 00056 TSample::MeasurementVectorSize); 00057 00059 typedef typename Superclass::MeasurementVectorType MeasurementVectorType ; 00060 typedef typename Superclass::MembershipFunctionType MembershipFunctionType ; 00061 typedef typename Superclass::WeightArrayType WeightArrayType ; 00062 typedef typename Superclass::ParametersType ParametersType ; 00063 00065 typedef GaussianDensityFunction< MeasurementVectorType > 00066 NativeMembershipFunctionType ; 00067 00070 typedef WeightedMeanCalculator< TSample > MeanEstimatorType ; 00071 typedef WeightedCovarianceCalculator< TSample > CovarianceEstimatorType ; 00072 00074 typedef typename MeanEstimatorType::OutputType MeanType ; 00075 00077 typedef typename CovarianceEstimatorType::OutputType CovarianceType ; 00078 00080 void SetSample(TSample* sample) ; 00081 00083 void SetParameters(const ParametersType ¶meters) ; 00084 00085 protected: 00086 GaussianMixtureModelComponent() ; 00087 virtual ~GaussianMixtureModelComponent() {} 00088 void PrintSelf(std::ostream& os, Indent indent) const; 00089 00092 double CalculateParametersChange() ; 00093 00095 void GenerateData() ; 00096 00097 private: 00098 typename NativeMembershipFunctionType::Pointer m_GaussianDensityFunction ; 00099 MeanType m_Mean ; 00100 CovarianceType m_Covariance ; 00101 typename MeanEstimatorType::Pointer m_MeanEstimator ; 00102 typename CovarianceEstimatorType::Pointer m_CovarianceEstimator ; 00103 } ; // end of class 00104 00105 } // end of namespace Statistics 00106 } // end of namespace itk 00107 00108 #ifndef ITK_MANUAL_INSTANTIATION 00109 #include "itkGaussianMixtureModelComponent.txx" 00110 #endif 00111 00112 #endif 00113