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

itkImageMomentsCalculator.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkImageMomentsCalculator.h,v $
00005   Language:  C++
00006   Date:      $Date: 2003/02/12 18:45:33 $
00007   Version:   $Revision: 1.33 $
00008 
00009   Copyright (c) 2002 Insight 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 #ifndef __itkImageMomentsCalculator_h
00018 #define __itkImageMomentsCalculator_h
00019 
00020 #include "itkAffineTransform.h"
00021 #include "itkMacro.h"
00022 #include "itkImage.h"
00023 
00024 #include "vnl/vnl_vector_fixed.h"
00025 #include "vnl/vnl_matrix_fixed.h"
00026 #include "vnl/vnl_diag_matrix.h"
00027 
00028 namespace itk
00029 {
00030 
00058 template < class TImage >
00059 class ImageMomentsCalculator
00060 {
00061 public:
00063   typedef ImageMomentsCalculator<TImage>   Self;
00064 
00066   itkStaticConstMacro(ImageDimension, unsigned int,
00067                       TImage::ImageDimension);
00068 
00070   typedef double                       ScalarType;
00071 
00073   typedef Vector<ScalarType,itkGetStaticConstMacro(ImageDimension)> VectorType;
00074 
00076   typedef Matrix<ScalarType,
00077                  itkGetStaticConstMacro(ImageDimension),
00078                  itkGetStaticConstMacro(ImageDimension)>   MatrixType;
00079 
00081   typedef TImage ImageType;
00082 
00084   typedef typename ImageType::Pointer ImagePointer;
00085 
00087   typedef AffineTransform<double,itkGetStaticConstMacro(ImageDimension)> AffineTransformType;
00088   typedef typename AffineTransformType::Pointer      AffineTransformPointer;
00089 
00095   void ComputeMoments( const ImageType * image );
00096 
00101   ScalarType GetTotalMass();
00102 
00108   VectorType GetFirstMoments();
00109 
00115   MatrixType GetSecondMoments();
00116 
00121   VectorType GetCenterOfGravity();
00122 
00127   MatrixType GetCentralMoments();
00128 
00135   VectorType GetPrincipalMoments();
00136 
00149   MatrixType GetPrincipalAxes();
00150 
00154   AffineTransformPointer GetPrincipalAxesToPhysicalAxesTransform(void) const;
00155 
00160   AffineTransformPointer GetPhysicalAxesToPrincipalAxesTransform(void) const;
00161 
00166   ImageMomentsCalculator();            // Create w/o summing moments
00167 
00173   ImageMomentsCalculator( const ImageType * image); // Create and sum image moments
00174 
00176   ~ImageMomentsCalculator();
00177 
00178 private:
00179   bool m_Valid;                      // Have moments been computed yet?
00180   ScalarType m_M0;                   // Zeroth moment
00181   VectorType m_M1;                   // First moments about origin
00182   MatrixType m_M2;                   // Second moments about origin
00183   VectorType m_Cg;                   // Center of gravity (physical units)
00184   MatrixType m_Cm;                   // Second central moments (physical)
00185   VectorType m_Pm;                   // Principal moments (physical)
00186   MatrixType m_Pa;                   // Principal axes (physical)
00187 
00188 };  // class ImageMomentsCalculator
00189 
00190 } // end namespace itk
00191 
00192 
00193 #ifndef ITK_MANUAL_INSTANTIATION
00194 #include "itkImageMomentsCalculator.txx"
00195 #endif
00196 
00197 #endif /* __itkImageMomentsCalculator_h */

Generated at Fri May 21 01:14:54 2004 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000