ITK  6.0.0
Insight Toolkit
itkImagePCADecompositionCalculator.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 itkImagePCADecompositionCalculator_h
19#define itkImagePCADecompositionCalculator_h
20
21#include "itkObject.h"
23#include "vnl/vnl_vector.h"
24#include "vnl/vnl_matrix.h"
25
26namespace itk
27{
58template <typename TInputImage, typename TBasisImage = Image<double, TInputImage::ImageDimension>>
59class ITK_TEMPLATE_EXPORT ImagePCADecompositionCalculator : public Object
60{
61public:
62 ITK_DISALLOW_COPY_AND_MOVE(ImagePCADecompositionCalculator);
63
69
71 itkNewMacro(Self);
72
74 itkOverrideGetNameOfClassMacro(ImagePCADecompositionCalculator);
75
77 using InputImageType = TInputImage;
78 using BasisImageType = TBasisImage;
79
83
87
89 using BasisPixelType = typename TBasisImage::PixelType;
90
92 static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
93
95 static constexpr unsigned int BasisImageDimension = TBasisImage::ImageDimension;
96
98 using BasisImagePointerVector = std::vector<BasisImagePointer>;
99
101 using BasisMatrixType = vnl_matrix<BasisPixelType>;
102 using BasisVectorType = vnl_vector<BasisPixelType>;
103
105 itkSetConstObjectMacro(Image, InputImageType);
106 itkGetConstObjectMacro(Image, InputImageType);
110 itkSetConstObjectMacro(MeanImage, BasisImageType);
111 itkGetConstObjectMacro(MeanImage, BasisImageType);
115 void
117
120 {
121 return m_BasisImages;
122 }
123
126
128 void
130
132 void
134
136 itkGetConstMacro(Projection, BasisVectorType);
137
138protected:
141 void
142 PrintSelf(std::ostream & os, Indent indent) const override;
143
145 void
147
149 void
151
152private:
154
155 BasisVectorType m_Projection{};
156 BasisVectorType m_ImageAsVector{};
157 BasisImagePointerVector m_BasisImages{};
161 BasisMatrixType m_BasisMatrix{};
162 bool m_BasisMatrixCalculated{};
163 SizeValueType m_NumPixels{};
164};
165} // end namespace itk
166
167#ifndef ITK_MANUAL_INSTANTIATION
168# include "itkImagePCADecompositionCalculator.hxx"
169#endif
170
171#endif
Decomposes an image into directions along basis components.
typename TBasisImage::ConstPointer BasisImageConstPointer
void PrintSelf(std::ostream &os, Indent indent) const override
~ImagePCADecompositionCalculator() override=default
void SetBasisFromModel(ModelPointerType model)
void SetBasisImages(const BasisImagePointerVector &)
typename ImagePCAShapeModelEstimator< TInputImage, TBasisImage >::Pointer ModelPointerType
typename TInputImage::ConstPointer InputImageConstPointer
std::vector< BasisImagePointer > BasisImagePointerVector
Templated n-dimensional image class.
Definition: itkImage.h:89
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Light weight base class for most itk classes.
Base class for most ITK classes.
Definition: itkObject.h:62
SmartPointer< const Self > ConstPointer
SmartPointer< Self > Pointer
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
unsigned long SizeValueType
Definition: itkIntTypes.h:86