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_math.h"
00026
#include "vnl/algo/vnl_matrix_inverse.h"
00027
00028
00029
#include "itkImageRegionIterator.h"
00030
#include "itkExceptionObject.h"
00031
00032
#include "itkImageModelEstimatorBase.h"
00033
00034
namespace itk
00035 {
00036
00076
template <
class TInputImage,
00077
class TMembershipFunction,
00078
class TTrainingImage>
00079 class ITK_EXPORT ImageGaussianModelEstimator:
00080
public ImageModelEstimatorBase<TInputImage, TMembershipFunction>
00081 {
00082
public:
00084 typedef ImageGaussianModelEstimator
Self;
00085 typedef ImageModelEstimatorBase<TInputImage,TMembershipFunction> Superclass;
00086
00087 typedef SmartPointer<Self> Pointer;
00088 typedef SmartPointer<const Self> ConstPointer;
00089
00091
itkNewMacro(
Self);
00092
00094
itkTypeMacro(ImageGaussianModelEstimator,
ImageModelEstimatorBase);
00095
00097 typedef typename TInputImage::Pointer
InputImagePointer;
00098
00100 typedef typename TTrainingImage::Pointer
TrainingImagePointer;
00101
00104 typedef typename TInputImage::PixelType
InputImagePixelType;
00105
00108 typedef typename TTrainingImage::PixelType
TrainingImagePixelType;
00109
00111
typedef
00112 ImageRegionIterator< TInputImage > InputImageIterator;
00113
typedef
00114 ImageRegionIterator< TTrainingImage > TrainingImageIterator;
00115
00117 typedef typename TMembershipFunction::Pointer
MembershipFunctionPointer ;
00118
00120
itkSetMacro(TrainingImage,
TrainingImagePointer);
00121
00123
itkGetMacro(TrainingImage,
TrainingImagePointer);
00124
00125
00126
00127
protected:
00128 ImageGaussianModelEstimator();
00129 ~ImageGaussianModelEstimator();
00130
virtual void PrintSelf(std::ostream& os,
Indent indent)
const;
00131
00133
void GenerateData() ;
00134
00135
private:
00136 ImageGaussianModelEstimator(
const Self&);
00137
void operator=(
const Self&);
00138
00139
typedef vnl_matrix<double> MatrixType;
00140
typedef vnl_vector<double> VectorType;
00141
00142
typedef typename TInputImage::SizeType InputImageSizeType;
00143
00145
itkStaticConstMacro(VectorDimension,
unsigned int,
00146 InputImagePixelType::Dimension);
00147
typedef vnl_matrix_fixed<double,1,itkGetStaticConstMacro(VectorDimension)> ColumnVectorType;
00148
00149
MatrixType m_NumberOfSamples;
00150
MatrixType m_Means;
00151
MatrixType *m_Covariance;
00152
00153
TrainingImagePointer m_TrainingImage;
00154
00158
virtual void EstimateModels();
00159
00160
void EstimateGaussianModelPrameters();
00161
00162 };
00163
00164 }
00165
00166
#ifndef ITK_MANUAL_INSTANTIATION
00167
#include "itkImageGaussianModelEstimator.txx"
00168
#endif
00169
00170
00171
00172
#endif