Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkImagePCADecompositionCalculator.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkImagePCADecompositionCalculator.h,v $
00005   Language:  C++
00006   Date:      $Date: 2005-03-21 23:04:03 $
00007   Version:   $Revision: 1.5 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
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   itkGetMacro(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&); //purposely not implemented
00146   void operator=(const Self&); //purposely not implemented
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 } // end namespace itk
00160 
00161 
00162 #ifndef ITK_MANUAL_INSTANTIATION
00163 #include "itkImagePCADecompositionCalculator.txx"
00164 #endif
00165 
00166 #endif
00167 

Generated at Mon Apr 14 12:55:24 2008 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000