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;
00090   itkStaticConstMacro(InputImageDimension, unsigned int,
00091                       TInputImage::ImageDimension); 
00092 
00094   itkStaticConstMacro(BasisImageDimension, unsigned int,
00095                       TBasisImage::ImageDimension); 
00096   
00097   
00099   typedef std::vector< BasisImagePointer > BasisImagePointerVector;
00100   
00102   typedef vnl_matrix<BasisPixelType> BasisMatrixType;
00103   typedef vnl_vector<BasisPixelType> BasisVectorType;
00104   
00106   itkSetConstObjectMacro(Image, InputImageType);
00107   itkGetConstObjectMacro(Image, InputImageType);
00108   
00110   itkSetConstObjectMacro(MeanImage, BasisImageType);
00111   itkGetConstObjectMacro(MeanImage, BasisImageType);
00112   
00114   void SetBasisImages(const BasisImagePointerVector &);
00115   BasisImagePointerVector GetBasisImages() { return m_BasisImages; }
00116 
00118   typedef typename ImagePCAShapeModelEstimator<TInputImage,
00119     TBasisImage>::Pointer ModelPointerType;
00121   void SetBasisFromModel(ModelPointerType model);
00122   
00124   void Compute(void);
00125 
00127   itkGetMacro(Projection,BasisVectorType);
00128   
00129 
00130 protected:
00131   ImagePCADecompositionCalculator();
00132   virtual ~ImagePCADecompositionCalculator() {};
00133   void PrintSelf(std::ostream& os, Indent indent) const;
00134   void CalculateBasisMatrix(void);
00135   void CalculateRecenteredImageAsVector(void);
00136   
00137 private:
00138   typedef typename BasisImageType::SizeType BasisSizeType;
00139     
00140   ImagePCADecompositionCalculator(const Self&); //purposely not implemented
00141   void operator=(const Self&); //purposely not implemented
00142   
00143   BasisVectorType m_Projection;
00144   BasisVectorType m_ImageAsVector;
00145   BasisImagePointerVector  m_BasisImages;
00146   BasisImageConstPointer m_MeanImage;
00147   BasisSizeType m_Size;
00148   InputImageConstPointer  m_Image;
00149   BasisMatrixType  m_BasisMatrix;
00150   bool m_BasisMatrixCalculated;
00151   unsigned long m_NumPixels;
00152 };
00153 
00154 } // end namespace itk
00155 
00156 
00157 #ifndef ITK_MANUAL_INSTANTIATION
00158 #include "itkImagePCADecompositionCalculator.txx"
00159 #endif
00160 
00161 #endif

Generated at Wed May 24 23:21:11 2006 for ITK by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2000