Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __itkImagePCADecompositionCalculator_h
00019 #define __itkImagePCADecompositionCalculator_h
00020
00021 #include "itkObject.h"
00022 #include "itkImagePCAShapeModelEstimator.h"
00023 #include "vnl/vnl_vector.h"
00024 #include "vnl/vnl_matrix.h"
00025
00026 namespace itk
00027 {
00028
00058 template <class TInputImage,
00059 class TBasisImage = Image<double, ::itk::GetImageDimension<TInputImage>::ImageDimension> >
00060 class ITK_EXPORT ImagePCADecompositionCalculator : public Object
00061 {
00062 public:
00064 typedef ImagePCADecompositionCalculator Self;
00065 typedef Object Superclass;
00066 typedef SmartPointer<Self> Pointer;
00067 typedef SmartPointer<const Self> ConstPointer;
00068
00070 itkNewMacro(Self);
00071
00073 itkTypeMacro(ImagePCADecompositionCalculator, Object);
00074
00076 typedef TInputImage InputImageType;
00077 typedef TBasisImage BasisImageType;
00078
00080 typedef typename TInputImage::Pointer InputImagePointer;
00081 typedef typename TBasisImage::Pointer BasisImagePointer;
00082
00084 typedef typename TInputImage::ConstPointer InputImageConstPointer;
00085 typedef typename TBasisImage::ConstPointer BasisImageConstPointer;
00086
00088 typedef typename TBasisImage::PixelType BasisPixelType;
00089
00091 itkStaticConstMacro(InputImageDimension, unsigned int,
00092 TInputImage::ImageDimension);
00093
00095 itkStaticConstMacro(BasisImageDimension, unsigned int,
00096 TBasisImage::ImageDimension);
00097
00098
00100 typedef std::vector< BasisImagePointer > BasisImagePointerVector;
00101
00103 typedef vnl_matrix<BasisPixelType> BasisMatrixType;
00104 typedef vnl_vector<BasisPixelType> BasisVectorType;
00105
00107 itkSetConstObjectMacro(Image, InputImageType);
00108 itkGetConstObjectMacro(Image, InputImageType);
00110
00112 itkSetConstObjectMacro(MeanImage, BasisImageType);
00113 itkGetConstObjectMacro(MeanImage, BasisImageType);
00115
00117 void SetBasisImages(const BasisImagePointerVector &);
00118 BasisImagePointerVector GetBasisImages() { return m_BasisImages; }
00120
00122 typedef typename ImagePCAShapeModelEstimator<TInputImage,
00123 TBasisImage>::Pointer ModelPointerType;
00124
00126 void SetBasisFromModel(ModelPointerType model);
00127
00129 void Compute(void);
00130
00132 itkGetConstMacro(Projection,BasisVectorType);
00133
00134
00135 protected:
00136 ImagePCADecompositionCalculator();
00137 virtual ~ImagePCADecompositionCalculator() {};
00138 void PrintSelf(std::ostream& os, Indent indent) const;
00139 void CalculateBasisMatrix(void);
00140 void CalculateRecenteredImageAsVector(void);
00141
00142 private:
00143 typedef typename BasisImageType::SizeType BasisSizeType;
00144
00145 ImagePCADecompositionCalculator(const Self&);
00146 void operator=(const Self&);
00147
00148 BasisVectorType m_Projection;
00149 BasisVectorType m_ImageAsVector;
00150 BasisImagePointerVector m_BasisImages;
00151 BasisImageConstPointer m_MeanImage;
00152 BasisSizeType m_Size;
00153 InputImageConstPointer m_Image;
00154 BasisMatrixType m_BasisMatrix;
00155 bool m_BasisMatrixCalculated;
00156 unsigned long m_NumPixels;
00157 };
00158
00159 }
00160
00161
00162 #ifndef ITK_MANUAL_INSTANTIATION
00163 #include "itkImagePCADecompositionCalculator.txx"
00164 #endif
00165
00166 #endif
00167