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

itkLevelSetCurvatureFunction.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkLevelSetCurvatureFunction.h,v $
00005   Language:  C++
00006   Date:      $Date: 2002/09/11 19:57:13 $
00007   Version:   $Revision: 1.22 $
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 _itkLevelSetCurvatureFunction_h
00018 #define _itkLevelSetCurvatureFunction_h
00019 
00020 #include "itkImageFunction.h"
00021 
00022 #include "vnl/vnl_vector_fixed.h"
00023 #include "vnl/vnl_matrix_fixed.h"
00024 
00025 namespace itk
00026 {
00027 
00044 template <class TInputImage, class TCoordRep = float >
00045 class ITK_EXPORT LevelSetCurvatureFunction :
00046   public ImageFunction<TInputImage,double,TCoordRep>
00047 {
00048 public:
00050   typedef LevelSetCurvatureFunction Self;
00051   typedef ImageFunction<TInputImage,double,TCoordRep> Superclass;
00052   typedef SmartPointer<Self> Pointer;
00053   typedef SmartPointer<const Self>  ConstPointer;
00054   
00056   itkTypeMacro(LevelSetCurvatureFunction, ImageFunction);
00057 
00059   itkNewMacro(Self);
00060 
00062   typedef TInputImage InputImageType;
00063 
00065   itkStaticConstMacro(ImageDimension, unsigned int,
00066                       InputImageType::ImageDimension);
00067 
00069   typedef typename Superclass::IndexType IndexType;
00070 
00072   typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
00073 
00075   typedef typename Superclass::PointType PointType;
00076 
00078   virtual void SetInputImage( const InputImageType * ptr );
00079 
00084   void SetEpsilonMagnitude( double value )
00085     { m_EpsilonMagnitude = value; }
00086 
00088   double GetEpsilonMagnitude() const
00089     { return m_EpsilonMagnitude; }
00090 
00092   virtual double EvaluateAtIndex( const IndexType& index ) const;
00093 
00095   virtual double Evaluate( const PointType& point ) const
00096     { 
00097       IndexType index;
00098       this->ConvertPointToNearestIndex( point, index );
00099       return this->EvaluateAtIndex( index ); 
00100     }
00101 
00102   virtual double EvaluateAtContinuousIndex( 
00103     const ContinuousIndexType& cindex ) const
00104     { 
00105       IndexType index;
00106       this->ConvertContinuousIndexToNearestIndex( cindex, index );
00107       return this->EvaluateAtIndex( index ) ; 
00108     }
00109   
00111   double GetCurvature() const
00112     { return m_Curvature; }
00113 
00115   double GetMagnitude() const
00116     { return m_Magnitude; }
00117 
00118 protected:
00119   LevelSetCurvatureFunction(){}
00120   ~LevelSetCurvatureFunction(){}
00121   void PrintSelf(std::ostream& os, Indent indent) const;
00122 
00123 private:
00124   LevelSetCurvatureFunction( const Self& ); //purposely not implemented
00125   void operator=( const Self& ); //purposely not implemented
00126 
00127   signed long                                 m_ImageSize[ImageDimension];
00128   bool                                        m_ImageSizeOK;
00129 
00130   mutable double                              m_Curvature;
00131   mutable double                              m_Magnitude;
00132   double                                      m_EpsilonMagnitude;
00133   mutable bool                                m_BorderPixel;
00134 
00135   mutable vnl_vector_fixed<double,itkGetStaticConstMacro(ImageDimension)>     
00136                                               m_FirstDerivative;
00137   mutable vnl_matrix_fixed<double,itkGetStaticConstMacro(ImageDimension),
00138                            itkGetStaticConstMacro(ImageDimension)>
00139                                               m_SecondDerivative;
00140 
00141   mutable IndexType                           m_NeighIndex;
00142   mutable IndexType                           m_RightIndex;
00143   mutable IndexType                           m_LeftIndex;
00144   mutable double                              m_CenterValue;
00145   mutable double                              m_DiffValue;
00146 
00147   mutable vnl_matrix_fixed<unsigned int,itkGetStaticConstMacro(ImageDimension),
00148                            itkGetStaticConstMacro(ImageDimension)>
00149                                                             m_Variable;
00150 
00151   void CalculateDerivatives( const IndexType& index ) const;
00152   void CalculateCurvature() const;
00153   void CalculateCurvature2D() const;
00154   void CalculateCurvature3D() const;
00155 
00156 };
00157 
00158 } // namespace itk
00159 
00160 #ifndef ITK_MANUAL_INSTANTIATION
00161 #include "itkLevelSetCurvatureFunction.txx"
00162 #endif
00163 
00164 #endif

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