ITK  5.2.0
Insight Toolkit
itkImageGaussianModelEstimator.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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 {
75 template <typename TInputImage, typename TMembershipFunction, typename TTrainingImage>
76 class ITK_TEMPLATE_EXPORT ImageGaussianModelEstimator : public ImageModelEstimatorBase<TInputImage, TMembershipFunction>
77 {
78 public:
79  ITK_DISALLOW_COPY_AND_MOVE(ImageGaussianModelEstimator);
80 
86 
88  itkNewMacro(Self);
89 
92 
94  using InputImageType = TInputImage;
95  using InputImagePointer = typename TInputImage::Pointer;
96  using InputImageConstPointer = typename TInputImage::ConstPointer;
97 
99  using TrainingImageType = TTrainingImage;
100  using TrainingImagePointer = typename TTrainingImage::Pointer;
101  using TrainingImageConstPointer = typename TTrainingImage::ConstPointer;
102 
105  using InputImagePixelType = typename TInputImage::PixelType;
106 
109  using TrainingImagePixelType = typename TTrainingImage::PixelType;
110 
116 
118  using MembershipFunctionType = TMembershipFunction;
119  using MembershipFunctionPointer = typename TMembershipFunction::Pointer;
120 
122  itkSetObjectMacro(TrainingImage, TrainingImageType);
123  itkGetModifiableObjectMacro(TrainingImage, TrainingImageType);
125 
126 protected:
127  ImageGaussianModelEstimator() = default;
128  ~ImageGaussianModelEstimator() override;
129  void
130  PrintSelf(std::ostream & os, Indent indent) const override;
131 
133  void
134  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
154  EstimateModels() override;
155 
156  void
157  EstimateGaussianModelParameters();
158 }; // class ImageGaussianModelEstimator
159 } // namespace itk
160 
161 #ifndef ITK_MANUAL_INSTANTIATION
162 # include "itkImageGaussianModelEstimator.hxx"
163 #endif
164 
165 #endif
itk::ImageGaussianModelEstimator::m_TrainingImage
TrainingImagePointer m_TrainingImage
Definition: itkImageGaussianModelEstimator.h:148
itk::ImageGaussianModelEstimator::TrainingImageConstPointer
typename TTrainingImage::ConstPointer TrainingImageConstPointer
Definition: itkImageGaussianModelEstimator.h:101
itk::ImageGaussianModelEstimator::InputImagePointer
typename TInputImage::Pointer InputImagePointer
Definition: itkImageGaussianModelEstimator.h:95
itkImageModelEstimatorBase.h
itk::ImageGaussianModelEstimator::InputImageSizeType
typename TInputImage::SizeType InputImageSizeType
Definition: itkImageGaussianModelEstimator.h:139
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itk::SmartPointer< Self >
itkImageRegionIterator.h
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::ImageGaussianModelEstimator::MembershipFunctionType
TMembershipFunction MembershipFunctionType
Definition: itkImageGaussianModelEstimator.h:118
itk::ImageGaussianModelEstimator::m_NumberOfSamples
MatrixType m_NumberOfSamples
Definition: itkImageGaussianModelEstimator.h:144
itk::ImageRegionIterator
A multi-dimensional iterator templated over image type that walks a region of pixels.
Definition: itkImageRegionIterator.h:80
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itkMacro.h
itk::ImageGaussianModelEstimator::InputImageConstPointer
typename TInputImage::ConstPointer InputImageConstPointer
Definition: itkImageGaussianModelEstimator.h:96
itk::ImageGaussianModelEstimator::m_Means
MatrixType m_Means
Definition: itkImageGaussianModelEstimator.h:145
itk::ImageModelEstimatorBase
Base class for model estimation from images used for classification.
Definition: itkImageModelEstimatorBase.h:64
itk::ImageGaussianModelEstimator::MatrixType
vnl_matrix< double > MatrixType
Definition: itkImageGaussianModelEstimator.h:137
itk::ImageGaussianModelEstimator::MembershipFunctionPointer
typename TMembershipFunction::Pointer MembershipFunctionPointer
Definition: itkImageGaussianModelEstimator.h:119
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::ImageGaussianModelEstimator::TrainingImagePointer
typename TTrainingImage::Pointer TrainingImagePointer
Definition: itkImageGaussianModelEstimator.h:100
itk::ImageGaussianModelEstimator::TrainingImagePixelType
typename TTrainingImage::PixelType TrainingImagePixelType
Definition: itkImageGaussianModelEstimator.h:109
itk::ImageGaussianModelEstimator::TrainingImageType
TTrainingImage TrainingImageType
Definition: itkImageGaussianModelEstimator.h:99
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:62
itk::ImageGaussianModelEstimator::InputImageType
TInputImage InputImageType
Definition: itkImageGaussianModelEstimator.h:94
itk::ImageGaussianModelEstimator
Base class for ImageGaussianModelEstimator object.
Definition: itkImageGaussianModelEstimator.h:76
itk::ImageRegionConstIterator
A multi-dimensional iterator templated over image type that walks a region of pixels.
Definition: itkImageRegionConstIterator.h:109
itk::ImageGaussianModelEstimator::InputImagePixelType
typename TInputImage::PixelType InputImagePixelType
Definition: itkImageGaussianModelEstimator.h:105
itk::GTest::TypedefsAndConstructors::Dimension2::Dimension
constexpr unsigned int Dimension
Definition: itkGTestTypedefsAndConstructors.h:44
itkMath.h