ITK  4.3.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< class TInputImage,
59  class TBasisImage = Image< double, TInputImage::ImageDimension > >
60 class ITK_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 
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(void);
129 
131  itkGetConstMacro(Projection, BasisVectorType);
132 
133 protected:
136  void PrintSelf(std::ostream & os, Indent indent) const;
137 
138  void CalculateBasisMatrix(void);
139 
140  void CalculateRecenteredImageAsVector(void);
141 
142 private:
143  typedef typename BasisImageType::SizeType BasisSizeType;
144 
145  ImagePCADecompositionCalculator(const Self &); //purposely not implemented
146  void operator=(const Self &); //purposely not implemented
147 
157 };
158 } // end namespace itk
159 
160 #ifndef ITK_MANUAL_INSTANTIATION
161 #include "itkImagePCADecompositionCalculator.hxx"
162 #endif
163 
164 #endif
165