ITK  5.0.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:
81  ITK_DISALLOW_COPY_AND_ASSIGN(ImageGaussianModelEstimator);
82 
88 
90  itkNewMacro(Self);
91 
94 
96  using InputImageType = TInputImage;
97  using InputImagePointer = typename TInputImage::Pointer;
98  using InputImageConstPointer = typename TInputImage::ConstPointer;
99 
101  using TrainingImageType = TTrainingImage;
102  using TrainingImagePointer = typename TTrainingImage::Pointer;
103  using TrainingImageConstPointer = typename TTrainingImage::ConstPointer;
104 
107  using InputImagePixelType = typename TInputImage::PixelType;
108 
111  using TrainingImagePixelType = typename TTrainingImage::PixelType;
112 
118 
120  using MembershipFunctionType = TMembershipFunction;
121  using MembershipFunctionPointer = typename TMembershipFunction::Pointer;
122 
124  itkSetObjectMacro(TrainingImage, TrainingImageType);
125  itkGetModifiableObjectMacro(TrainingImage, TrainingImageType);
127 
128 protected:
130  ~ImageGaussianModelEstimator() override;
131  void PrintSelf(std::ostream & os, Indent indent) const override;
132 
134  void GenerateData() override;
135 
136 private:
137  using MatrixType = vnl_matrix< double >;
138 
140 
142  static constexpr unsigned int VectorDimension = InputImagePixelType::Dimension;
143 
146  MatrixType *m_Covariance{nullptr};
147 
149 
153  void EstimateModels() override;
154 
155  void EstimateGaussianModelParameters();
156 }; // class ImageGaussianModelEstimator
157 } // namespace itk
158 
159 #ifndef ITK_MANUAL_INSTANTIATION
160 #include "itkImageGaussianModelEstimator.hxx"
161 #endif
162 
163 #endif
Light weight base class for most itk classes.
typename TInputImage::ConstPointer InputImageConstPointer
typename TTrainingImage::Pointer TrainingImagePointer
typename TInputImage::PixelType InputImagePixelType
Base class for model estimation from images used for classification.
typename TTrainingImage::ConstPointer TrainingImageConstPointer
A multi-dimensional iterator templated over image type that walks a region of pixels.
typename TInputImage::SizeType InputImageSizeType
typename TInputImage::Pointer InputImagePointer
typename TTrainingImage::PixelType TrainingImagePixelType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Base class for ImageGaussianModelEstimator object.
Base class for most ITK classes.
Definition: itkObject.h:60
typename TMembershipFunction::Pointer MembershipFunctionPointer
A multi-dimensional iterator templated over image type that walks a region of pixels.