ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkImagePCADecompositionCalculator.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 itkImagePCADecompositionCalculator_h
19 #define itkImagePCADecompositionCalculator_h
20 
21 #include "itkObject.h"
23 #include "vnl/vnl_vector.h"
24 #include "vnl/vnl_matrix.h"
25 
26 namespace itk
27 {
58 template< typename TInputImage,
59  typename TBasisImage = Image< double, TInputImage::ImageDimension > >
60 class ITK_TEMPLATE_EXPORT ImagePCADecompositionCalculator:public Object
61 {
62 public:
65  typedef Object Superclass;
68 
70  itkNewMacro(Self);
71 
74 
76  typedef TInputImage InputImageType;
77  typedef TBasisImage BasisImageType;
78 
80  typedef typename TInputImage::Pointer InputImagePointer;
81  typedef typename TBasisImage::Pointer BasisImagePointer;
82 
84  typedef typename TInputImage::ConstPointer InputImageConstPointer;
85  typedef typename TBasisImage::ConstPointer BasisImageConstPointer;
86 
88  typedef typename TBasisImage::PixelType BasisPixelType;
89 
91  itkStaticConstMacro(InputImageDimension, unsigned int,
92  TInputImage::ImageDimension);
93 
95  itkStaticConstMacro(BasisImageDimension, unsigned int,
96  TBasisImage::ImageDimension);
97 
99  typedef std::vector< BasisImagePointer > BasisImagePointerVector;
100 
102  typedef vnl_matrix< BasisPixelType > BasisMatrixType;
103  typedef vnl_vector< BasisPixelType > BasisVectorType;
104 
106  itkSetConstObjectMacro(Image, InputImageType);
107  itkGetConstObjectMacro(Image, InputImageType);
109 
111  itkSetConstObjectMacro(MeanImage, BasisImageType);
112  itkGetConstObjectMacro(MeanImage, BasisImageType);
114 
116  void SetBasisImages(const BasisImagePointerVector &);
117 
118  BasisImagePointerVector GetBasisImages() { return m_BasisImages; }
119 
121  typedef typename ImagePCAShapeModelEstimator< TInputImage,
123 
125  void SetBasisFromModel(ModelPointerType model);
126 
128  void Compute();
129 
131  itkGetConstMacro(Projection, BasisVectorType);
132 
133 protected:
135  virtual ~ImagePCADecompositionCalculator() ITK_OVERRIDE {}
136  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
137 
138  void CalculateBasisMatrix();
139 
140  void CalculateRecenteredImageAsVector();
141 
142 private:
144 
145  ITK_DISALLOW_COPY_AND_ASSIGN(ImagePCADecompositionCalculator);
146 
156 };
157 } // end namespace itk
158 
159 #ifndef ITK_MANUAL_INSTANTIATION
160 #include "itkImagePCADecompositionCalculator.hxx"
161 #endif
162 
163 #endif
Light weight base class for most itk classes.
Decomposes an image into directions along basis components.
std::vector< BasisImagePointer > BasisImagePointerVector
unsigned long SizeValueType
Definition: itkIntTypes.h:143
Base class for ImagePCAShapeModelEstimator object.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
ImagePCAShapeModelEstimator< TInputImage, TBasisImage >::Pointer ModelPointerType
Base class for most ITK classes.
Definition: itkObject.h:59
Templated n-dimensional image class.
Definition: itkImage.h:75