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: 2002/09/11 19:39:01 $
00007   Version:   $Revision: 1.31 $
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 typename ImageType::TransformType          TransformType;
00088   typedef typename TransformType::Pointer            TransformPointer;
00089 
00091   typedef AffineTransform<double,itkGetStaticConstMacro(ImageDimension)> AffineTransformType;
00092   typedef typename AffineTransformType::Pointer      AffineTransformPointer;
00093 
00099   void ComputeMoments( ImageType * image );
00100 
00105   ScalarType GetTotalMass();
00106 
00112   VectorType GetFirstMoments();
00113 
00119   MatrixType GetSecondMoments();
00120 
00125   VectorType GetCenterOfGravity();
00126 
00131   MatrixType GetCentralMoments();
00132 
00139   VectorType GetPrincipalMoments();
00140 
00153   MatrixType GetPrincipalAxes();
00154 
00158   AffineTransformPointer GetPrincipalAxesToPhysicalAxesTransform(void) const;
00159 
00164   AffineTransformPointer GetPhysicalAxesToPrincipalAxesTransform(void) const;
00165 
00170   ImageMomentsCalculator();            // Create w/o summing moments
00171 
00177   ImageMomentsCalculator(ImageType * image); // Create and sum image moments
00178 
00180   ~ImageMomentsCalculator();
00181 
00182 private:
00183   bool m_Valid;                      // Have moments been computed yet?
00184   ScalarType m_M0;                   // Zeroth moment
00185   VectorType m_M1;                   // First moments about origin
00186   MatrixType m_M2;                   // Second moments about origin
00187   VectorType m_Cg;                   // Center of gravity (physical units)
00188   MatrixType m_Cm;                   // Second central moments (physical)
00189   VectorType m_Pm;                   // Principal moments (physical)
00190   MatrixType m_Pa;                   // Principal axes (physical)
00191 
00192 };  // class ImageMomentsCalculator
00193 
00194 } // end namespace itk
00195 
00196 
00197 #ifndef ITK_MANUAL_INSTANTIATION
00198 #include "itkImageMomentsCalculator.txx"
00199 #endif
00200 
00201 #endif /* __itkImageMomentsCalculator_h */

Generated at Wed Mar 12 01:13:00 2003 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000