ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkImageGaussianModelEstimator.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef itkImageGaussianModelEstimator_h
19 #define itkImageGaussianModelEstimator_h
20 
21 #include <cmath>
22 #include <cfloat>
23 
24 #include "vnl/vnl_vector.h"
25 #include "vnl/vnl_matrix.h"
26 #include "vnl/vnl_matrix_fixed.h"
27 #include "itkMath.h"
28 #include "vnl/algo/vnl_matrix_inverse.h"
29 
30 #include "itkImageRegionIterator.h"
31 #include "itkMacro.h"
32 
34 
35 namespace itk
36 {
74 template< typename TInputImage,
75  typename TMembershipFunction,
76  typename TTrainingImage >
77 class ITK_TEMPLATE_EXPORT ImageGaussianModelEstimator:
78  public ImageModelEstimatorBase< TInputImage, TMembershipFunction >
79 {
80 public:
86 
88  itkNewMacro(Self);
89 
92 
94  typedef TInputImage InputImageType;
95  typedef typename TInputImage::Pointer InputImagePointer;
96  typedef typename TInputImage::ConstPointer InputImageConstPointer;
97 
99  typedef TTrainingImage TrainingImageType;
100  typedef typename TTrainingImage::Pointer TrainingImagePointer;
101  typedef typename TTrainingImage::ConstPointer TrainingImageConstPointer;
102 
105  typedef typename TInputImage::PixelType InputImagePixelType;
106 
109  typedef typename TTrainingImage::PixelType TrainingImagePixelType;
110 
116 
118  typedef TMembershipFunction MembershipFunctionType;
119  typedef typename TMembershipFunction::Pointer MembershipFunctionPointer;
120 
122  itkSetObjectMacro(TrainingImage, TrainingImageType);
123  itkGetModifiableObjectMacro(TrainingImage, TrainingImageType);
125 
126 protected:
128  ~ImageGaussianModelEstimator() ITK_OVERRIDE;
129  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
130 
132  void GenerateData() ITK_OVERRIDE;
133 
134 private:
135  ITK_DISALLOW_COPY_AND_ASSIGN(ImageGaussianModelEstimator);
136 
137  typedef vnl_matrix< double > MatrixType;
138 
139  typedef typename TInputImage::SizeType InputImageSizeType;
140 
142  itkStaticConstMacro(VectorDimension, unsigned int,
144 
145  MatrixType m_NumberOfSamples;
146  MatrixType m_Means;
147  MatrixType *m_Covariance;
148 
149  TrainingImagePointer m_TrainingImage;
150 
154  virtual void EstimateModels() ITK_OVERRIDE;
155 
156  void EstimateGaussianModelParameters();
157 }; // class ImageGaussianModelEstimator
158 } // namespace itk
159 
160 #ifndef ITK_MANUAL_INSTANTIATION
161 #include "itkImageGaussianModelEstimator.hxx"
162 #endif
163 
164 #endif
ImageRegionIterator< TTrainingImage > TrainingImageIterator
Light weight base class for most itk classes.
ImageModelEstimatorBase< TInputImage, TMembershipFunction > Superclass
ImageRegionIterator< TInputImage > InputImageIterator
ImageRegionConstIterator< TInputImage > InputImageConstIterator
Base class for model estimation from images used for classification.
A multi-dimensional iterator templated over image type that walks a region of pixels.
ImageRegionConstIterator< TTrainingImage > TrainingImageConstIterator
Control indentation during Print() invocation.
Definition: itkIndent.h:49
TMembershipFunction::Pointer MembershipFunctionPointer
Base class for ImageGaussianModelEstimator object.
TTrainingImage::ConstPointer TrainingImageConstPointer
A multi-dimensional iterator templated over image type that walks a region of pixels.