ITK  6.0.0
Insight Toolkit
itkImagePCAShapeModelEstimator.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 * https://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 itkImagePCAShapeModelEstimator_h
19#define itkImagePCAShapeModelEstimator_h
20
21#include <ctime>
22#include <cmath>
23#include <cfloat>
24
25#include "vnl/vnl_vector.h"
26#include "vnl/vnl_matrix.h"
27#include "itkMath.h"
28#include "vnl/algo/vnl_matrix_inverse.h"
29
31#include "itkMacro.h"
32
34#include "itkConceptChecking.h"
35#include "itkImage.h"
36#include "vnl/algo/vnl_generalized_eigensystem.h"
37#include "vnl/algo/vnl_symmetric_eigensystem.h"
38
39namespace itk
40{
75template <typename TInputImage, typename TOutputImage = Image<double, TInputImage::ImageDimension>>
76class ITK_TEMPLATE_EXPORT ImagePCAShapeModelEstimator : public ImageShapeModelEstimatorBase<TInputImage, TOutputImage>
77{
78public:
79 ITK_DISALLOW_COPY_AND_MOVE(ImagePCAShapeModelEstimator);
80
86
88 itkNewMacro(Self);
89
91 itkOverrideGetNameOfClassMacro(ImagePCAShapeModelEstimator);
92
94 using InputImageType = TInputImage;
97
99 using InputImagePixelType = typename TInputImage::PixelType;
100
104
106 static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
107
109 using OutputImageType = TOutputImage;
111
114
116 using MatrixOfDoubleType = vnl_matrix<double>;
117
119 using MatrixOfIntegerType = vnl_matrix<int>;
120
122 using VectorOfDoubleType = vnl_vector<double>;
123
128 virtual void
130
131 itkGetConstMacro(NumberOfPrincipalComponentsRequired, unsigned int);
132
134 virtual void
136
137 itkGetConstMacro(NumberOfTrainingImages, unsigned int);
138
140 itkGetConstMacro(EigenValues, VectorOfDoubleType);
141
142protected:
144 ~ImagePCAShapeModelEstimator() override = default;
145 void
146 PrintSelf(std::ostream & os, Indent indent) const override;
147
151 void
153
158 void
160
162 void
163 GenerateData() override;
164
165private:
167 using InputImagePointerArray = std::vector<InputImageConstPointer>;
168 using InputImageIteratorArray = std::vector<InputImageConstIterator>;
169
171
173 using InputPixelType = typename TInputImage::PixelType;
174
183 void
185
187 void
189
192 void
194
195 InputImageIteratorArray m_InputImageIteratorArray{};
196
198
199 MatrixOfDoubleType m_InnerProduct{};
200
201 MatrixOfDoubleType m_EigenVectors{};
202
203 VectorOfDoubleType m_EigenValues{};
204
205 VectorOfDoubleType m_EigenVectorNormalizedEnergy{};
206
207 ImageSizeType m_InputImageSize{ {} };
208
209 unsigned int m_NumberOfPixels{ 0 };
210
211 unsigned int m_NumberOfTrainingImages{ 0 };
212
213 unsigned int m_NumberOfPrincipalComponentsRequired{};
214};
215
216} // end namespace itk
217
218#ifndef ITK_MANUAL_INSTANTIATION
219# include "itkImagePCAShapeModelEstimator.hxx"
220#endif
221
222#endif
Base class for all data objects in ITK.
Base class for ImagePCAShapeModelEstimator object.
typename TInputImage::SizeType ImageSizeType
typename TInputImage::Pointer InputImagePointer
virtual void SetNumberOfPrincipalComponentsRequired(unsigned int n)
std::vector< InputImageConstIterator > InputImageIteratorArray
typename TInputImage::PixelType InputPixelType
~ImagePCAShapeModelEstimator() override=default
typename TOutputImage::Pointer OutputImagePointer
typename TInputImage::ConstPointer InputImageConstPointer
std::vector< InputImageConstPointer > InputImagePointerArray
void GenerateInputRequestedRegion() override
virtual void SetNumberOfTrainingImages(unsigned int n)
typename TInputImage::PixelType InputImagePixelType
void PrintSelf(std::ostream &os, Indent indent) const override
void EnlargeOutputRequestedRegion(DataObject *) override
A multi-dimensional iterator templated over image type that walks a region of pixels.
A multi-dimensional iterator templated over image type that walks a region of pixels.
Base class for statistical shape model estimation.
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Light weight base class for most itk classes.
SmartPointer< const Self > ConstPointer
SmartPointer< Self > Pointer
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....