ITK  4.8.0
Insight Segmentation and Registration Toolkit
itkImagePCAShapeModelEstimator.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 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 "vnl/vnl_math.h"
28 #include "vnl/algo/vnl_matrix_inverse.h"
29 
30 #include "itkImageRegionIterator.h"
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 
39 namespace itk
40 {
75 template< typename TInputImage,
76  typename TOutputImage = Image< double, TInputImage::ImageDimension > >
78  public ImageShapeModelEstimatorBase< TInputImage, TOutputImage >
79 {
80 public:
86 
88  itkNewMacro(Self);
89 
92 
94  typedef TInputImage InputImageType;
95  typedef typename TInputImage::Pointer InputImagePointer;
96  typedef typename TInputImage::ConstPointer InputImageConstPointer;
97 
99  typedef typename TInputImage::PixelType InputImagePixelType;
100 
104 
106  itkStaticConstMacro(InputImageDimension, unsigned int,
107  TInputImage::ImageDimension);
108 
110  typedef TOutputImage OutputImageType;
111  typedef typename TOutputImage::Pointer OutputImagePointer;
112 
115 
117  typedef vnl_matrix< double > MatrixOfDoubleType;
118 
120  typedef vnl_matrix< int > MatrixOfIntegerType;
121 
123  typedef vnl_vector< double > VectorOfDoubleType;
124 
129  virtual void SetNumberOfPrincipalComponentsRequired(unsigned int n);
130 
131  itkGetConstMacro(NumberOfPrincipalComponentsRequired, unsigned int);
132 
134  virtual void SetNumberOfTrainingImages(unsigned int n);
135 
136  itkGetConstMacro(NumberOfTrainingImages, unsigned int);
137 
139  itkGetConstMacro(EigenValues, VectorOfDoubleType);
140 
141 protected:
144  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
145 
149  virtual void EnlargeOutputRequestedRegion(DataObject *) ITK_OVERRIDE;
150 
155  virtual void GenerateInputRequestedRegion() ITK_OVERRIDE;
156 
158  void GenerateData() ITK_OVERRIDE;
159 
160 private:
161 
162  ImagePCAShapeModelEstimator(const Self &); //purposely not implemented
163  void operator=(const Self &); //purposely not implemented
164 
168 
169  typedef typename TInputImage::SizeType ImageSizeType;
170 
172  typedef typename TInputImage::PixelType InputPixelType;
173 
182  virtual void EstimateShapeModels() ITK_OVERRIDE;
183 
185 
186  void CalculateInnerProduct();
187 
189  InputImageIteratorArray m_InputImageIteratorArray;
190 
192 
194 
196 
198 
200 
201  ImageSizeType m_InputImageSize;
202 
203  unsigned int m_NumberOfPixels;
204 
205  // The number of input images for PCA
207 
208  // The number of output Principal Components
210 }; // class ImagePCAShapeModelEstimator
211 } // namespace itk
212 
213 #ifndef ITK_MANUAL_INSTANTIATION
214 #include "itkImagePCAShapeModelEstimator.hxx"
215 #endif
216 
217 #endif
InputImageType::ConstPointer InputImageConstPointer
ImageRegionIterator< TOutputImage > OutputImageIterator
virtual void SetNumberOfTrainingImages(unsigned int n)
ImageRegionIterator< TInputImage > InputImageIterator
virtual void GenerateInputRequestedRegion() override
Base class for all process objects that output image data.
ImageShapeModelEstimatorBase< TInputImage, TOutputImage > Superclass
Base class for ImagePCAShapeModelEstimator object.
A multi-dimensional iterator templated over image type that walks a region of pixels.
ImageRegionConstIterator< TInputImage > InputImageConstIterator
virtual void EnlargeOutputRequestedRegion(DataObject *) override
virtual void EstimateShapeModels() override
virtual void SetNumberOfPrincipalComponentsRequired(unsigned int n)
virtual void PrintSelf(std::ostream &os, Indent indent) const override
Control indentation during Print() invocation.
Definition: itkIndent.h:49
std::vector< InputImageConstIterator > InputImageIteratorArray
std::vector< InputImageConstPointer > InputImagePointerArray
Base class for statistical shape model estimation.
Base class for all data objects in ITK.
A multi-dimensional iterator templated over image type that walks a region of pixels.