Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkImageGaussianModelEstimator_h
00018 #define __itkImageGaussianModelEstimator_h
00019
00020 #include <math.h>
00021 #include <float.h>
00022
00023 #include "vnl/vnl_vector.h"
00024 #include "vnl/vnl_matrix.h"
00025 #include "vnl/vnl_matrix_fixed.h"
00026 #include "vnl/vnl_math.h"
00027 #include "vnl/algo/vnl_matrix_inverse.h"
00028
00029
00030 #include "itkImageRegionIterator.h"
00031 #include "itkExceptionObject.h"
00032
00033 #include "itkImageModelEstimatorBase.h"
00034
00035 namespace itk
00036 {
00037
00078 template <class TInputImage,
00079 class TMembershipFunction,
00080 class TTrainingImage>
00081 class ITK_EXPORT ImageGaussianModelEstimator:
00082 public ImageModelEstimatorBase<TInputImage, TMembershipFunction>
00083 {
00084 public:
00086 typedef ImageGaussianModelEstimator Self;
00087 typedef ImageModelEstimatorBase<TInputImage,TMembershipFunction> Superclass;
00088 typedef SmartPointer<Self> Pointer;
00089 typedef SmartPointer<const Self> ConstPointer;
00090
00092 itkNewMacro(Self);
00093
00095 itkTypeMacro(ImageGaussianModelEstimator, ImageModelEstimatorBase);
00096
00098 typedef typename TInputImage::Pointer InputImagePointer;
00099
00101 typedef typename TTrainingImage::Pointer TrainingImagePointer;
00102
00105 typedef typename TInputImage::PixelType InputImagePixelType;
00106
00109 typedef typename TTrainingImage::PixelType TrainingImagePixelType;
00110
00112 typedef ImageRegionIterator< TInputImage > InputImageIterator;
00113 typedef ImageRegionIterator< TTrainingImage > TrainingImageIterator;
00114
00116 typedef typename TMembershipFunction::Pointer MembershipFunctionPointer;
00117
00119 itkSetMacro(TrainingImage,TrainingImagePointer);
00120
00122 itkGetConstMacro(TrainingImage,TrainingImagePointer);
00123
00124 protected:
00125 ImageGaussianModelEstimator();
00126 ~ImageGaussianModelEstimator();
00127 virtual void PrintSelf(std::ostream& os, Indent indent) const;
00128
00130 void GenerateData();
00131
00132 private:
00133 ImageGaussianModelEstimator(const Self&);
00134 void operator=(const Self&);
00135
00136 typedef vnl_matrix<double> MatrixType;
00137 typedef vnl_vector<double> VectorType;
00138
00139 typedef typename TInputImage::SizeType InputImageSizeType;
00140
00142 itkStaticConstMacro(VectorDimension, unsigned int,
00143 InputImagePixelType::Dimension);
00144 typedef vnl_matrix_fixed<double,1,itkGetStaticConstMacro(VectorDimension)> ColumnVectorType;
00146
00147 MatrixType m_NumberOfSamples;
00148 MatrixType m_Means;
00149 MatrixType *m_Covariance;
00150
00151 TrainingImagePointer m_TrainingImage;
00152
00156 virtual void EstimateModels();
00157
00158 void EstimateGaussianModelParameters();
00159
00160 };
00161
00162 }
00163
00164 #ifndef ITK_MANUAL_INSTANTIATION
00165 #include "itkImageGaussianModelEstimator.txx"
00166 #endif
00167
00168 #endif
00169