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

itkFiniteDifferenceFunction.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkFiniteDifferenceFunction.h,v $
00005   Language:  C++
00006   Date:      $Date: 2008-03-03 13:58:49 $
00007   Version:   $Revision: 1.20 $
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 #ifndef __itkFiniteDifferenceFunction_h_
00018 #define __itkFiniteDifferenceFunction_h_
00019 
00020 #include "itkLightObject.h"
00021 #include "itkConstNeighborhoodIterator.h"
00022 #include "itkZeroFluxNeumannBoundaryCondition.h"
00023 #include "itkVector.h"
00024 #include "itkFixedArray.h"
00025 
00026 namespace itk {
00027 
00064 template<class TImageType>
00065 class ITK_EXPORT FiniteDifferenceFunction : public LightObject
00066 {
00067 public:
00068 
00070   typedef FiniteDifferenceFunction Self;
00071   typedef LightObject Superclass;
00072 
00073   typedef SmartPointer<Self> Pointer;
00074   typedef SmartPointer<const Self> ConstPointer;
00075 
00077   itkTypeMacro( FiniteDifferenceFunction, LightObject );
00078 
00080   typedef TImageType ImageType;
00081   typedef typename ImageType::PixelType  PixelType;
00082   typedef double                         PixelRealType;  
00083 
00085   itkStaticConstMacro(ImageDimension, unsigned int, ImageType::ImageDimension);
00086 
00088   typedef double  TimeStepType;
00089 
00092   typedef ZeroFluxNeumannBoundaryCondition<ImageType>
00093     DefaultBoundaryConditionType;
00094 
00096   typedef typename ConstNeighborhoodIterator<TImageType>::RadiusType RadiusType;
00097 
00100   typedef ConstNeighborhoodIterator<TImageType, DefaultBoundaryConditionType> NeighborhoodType;
00101 
00104   typedef Vector<PixelRealType,itkGetStaticConstMacro(ImageDimension)> NeighborhoodScalesType;
00105 
00108   typedef Vector<float,itkGetStaticConstMacro(ImageDimension)> FloatOffsetType;
00109 
00119   virtual void InitializeIteration() {};
00120 
00134 #if !defined(CABLE_CONFIGURATION)
00135   virtual PixelType  ComputeUpdate(const NeighborhoodType &neighborhood,
00136                                    void *globalData,
00137                                    const FloatOffsetType &offset = FloatOffsetType(0.0)) = 0;
00138 #endif
00139 
00142   void SetRadius(const RadiusType &r)
00143     { m_Radius = r; }
00144 
00147   const RadiusType &GetRadius() const
00148     { return m_Radius; }
00149 
00153   void SetScaleCoefficients (PixelRealType vals[ImageDimension])
00154     {
00155       for (unsigned int i = 0; i < ImageDimension; i++)
00156         {
00157         m_ScaleCoefficients[i] = vals[i];
00158         }
00159     }
00161 
00165   const NeighborhoodScalesType ComputeNeighborhoodScales() const;
00166 
00173   virtual TimeStepType ComputeGlobalTimeStep(void *GlobalData) const =0;
00174 
00182   virtual void *GetGlobalDataPointer() const =0;
00183 
00189   virtual void ReleaseGlobalDataPointer(void *GlobalData) const =0;
00190 
00191 protected:
00192   FiniteDifferenceFunction() 
00193   {
00194     // initialize variables
00195     m_Radius.Fill( 0 );
00196     for (unsigned int i = 0; i < ImageDimension; i++)
00197       {
00198       m_ScaleCoefficients[i] = 1.0;
00199       }
00200   }
00201   ~FiniteDifferenceFunction() {}
00202   void PrintSelf(std::ostream& os, Indent indent) const;
00203 
00204   RadiusType m_Radius;
00205   PixelRealType m_ScaleCoefficients[ImageDimension];
00206 
00207 private:
00208   FiniteDifferenceFunction(const Self&); //purposely not implemented
00209   void operator=(const Self&); //purposely not implemented
00210 };
00211   
00212 } // end namespace itk
00213 
00214 // Define instantiation macro for this template.
00215 #define ITK_TEMPLATE_FiniteDifferenceFunction(_, EXPORT, x, y) namespace itk { \
00216   _(1(class EXPORT FiniteDifferenceFunction< ITK_TEMPLATE_1 x >)) \
00217   namespace Templates { typedef FiniteDifferenceFunction< ITK_TEMPLATE_1 x > FiniteDifferenceFunction##y; } \
00218   }
00219 
00220 #if ITK_TEMPLATE_EXPLICIT
00221 # include "Templates/itkFiniteDifferenceFunction+-.h"
00222 #endif
00223 
00224 #if ITK_TEMPLATE_TXX
00225 # include "itkFiniteDifferenceFunction.txx"
00226 #endif
00227 
00228 #endif
00229 

Generated at Tue Jul 29 20:01:20 2008 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000