ITK  4.0.0
Insight Segmentation and Registration Toolkit
itkGaussianMixtureModelComponent.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkGaussianMixtureModelComponent_h
00019 #define __itkGaussianMixtureModelComponent_h
00020 
00021 #include "itkMixtureModelComponentBase.h"
00022 #include "itkGaussianMembershipFunction.h"
00023 #include "itkWeightedMeanSampleFilter.h"
00024 #include "itkWeightedCovarianceSampleFilter.h"
00025 
00026 namespace itk
00027 {
00028 namespace Statistics
00029 {
00049 template< class TSample >
00050 class ITK_EXPORT GaussianMixtureModelComponent:
00051   public MixtureModelComponentBase< TSample >
00052 {
00053 public:
00055   typedef GaussianMixtureModelComponent        Self;
00056   typedef MixtureModelComponentBase< TSample > Superclass;
00057   typedef SmartPointer< Self >                 Pointer;
00058   typedef SmartPointer< const Self >           ConstPointer;
00059 
00061   itkTypeMacro(GaussianMixtureModelComponent, MixtureModelComponentBase);
00062   itkNewMacro(Self);
00064 
00066   typedef typename Superclass::MeasurementVectorType     MeasurementVectorType;
00067   typedef typename Superclass::MeasurementVectorSizeType MeasurementVectorSizeType;
00068   typedef typename Superclass::MembershipFunctionType    MembershipFunctionType;
00069   typedef typename Superclass::WeightArrayType           WeightArrayType;
00070   typedef typename Superclass::ParametersType            ParametersType;
00071 
00073   typedef GaussianMembershipFunction< MeasurementVectorType >
00074   NativeMembershipFunctionType;
00075 
00078   typedef WeightedMeanSampleFilter< TSample >       MeanEstimatorType;
00079   typedef WeightedCovarianceSampleFilter< TSample > CovarianceEstimatorType;
00080 
00082   typedef typename MeanEstimatorType::OutputType MeanVectorType;
00083 
00085   typedef typename CovarianceEstimatorType::OutputType CovarianceMatrixType;
00086 
00088   void SetSample(const TSample *sample);
00089 
00091   void SetParameters(const ParametersType & parameters);
00092 
00093 protected:
00094   GaussianMixtureModelComponent();
00095   virtual ~GaussianMixtureModelComponent() {}
00096   void PrintSelf(std::ostream & os, Indent indent) const;
00097 
00100   double CalculateParametersChange();
00101 
00103   void GenerateData();
00104 
00105 private:
00106   typename NativeMembershipFunctionType::Pointer m_GaussianMembershipFunction;
00107 
00108   typename MeanEstimatorType::MeasurementVectorType m_Mean;
00109 
00110   typename CovarianceEstimatorType::MatrixType m_Covariance;
00111 
00112   typename MeanEstimatorType::Pointer m_MeanEstimator;
00113 
00114   typename CovarianceEstimatorType::Pointer m_CovarianceEstimator;
00115 };  // end of class
00116 } // end of namespace Statistics
00117 } // end of namespace itk
00118 
00119 #ifndef ITK_MANUAL_INSTANTIATION
00120 #include "itkGaussianMixtureModelComponent.hxx"
00121 #endif
00122 
00123 #endif
00124