ITK  4.9.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 "vnl/vnl_math.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 >
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:
129  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
130 
132  void GenerateData() ITK_OVERRIDE;
133 
134 private:
135  ImageGaussianModelEstimator(const Self &) ITK_DELETE_FUNCTION;
136  void operator=(const Self &) ITK_DELETE_FUNCTION;
137 
138  typedef vnl_matrix< double > MatrixType;
139 
140  typedef typename TInputImage::SizeType InputImageSizeType;
141 
143  itkStaticConstMacro(VectorDimension, unsigned int,
144  InputImagePixelType::Dimension);
145 
146  MatrixType m_NumberOfSamples;
147  MatrixType m_Means;
148  MatrixType *m_Covariance;
149 
151 
155  virtual void EstimateModels() ITK_OVERRIDE;
156 
158 }; // class ImageGaussianModelEstimator
159 } // namespace itk
160 
161 #ifndef ITK_MANUAL_INSTANTIATION
162 #include "itkImageGaussianModelEstimator.hxx"
163 #endif
164 
165 #endif
ImageRegionIterator< TTrainingImage > TrainingImageIterator
Light weight base class for most itk classes.
ImageModelEstimatorBase< TInputImage, TMembershipFunction > Superclass
virtual void EstimateModels() override
ImageRegionIterator< TInputImage > InputImageIterator
ImageRegionConstIterator< TInputImage > InputImageConstIterator
Base class for model estimation from images used for classification.
virtual void PrintSelf(std::ostream &os, Indent indent) const override
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.