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-10-16 23:25:41 $
00007   Version:   $Revision: 1.21 $
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   typedef SmartPointer<Self>            Pointer;
00073   typedef SmartPointer<const Self>      ConstPointer;
00074 
00076   itkTypeMacro( FiniteDifferenceFunction, LightObject );
00077 
00079   typedef TImageType                        ImageType;
00080   typedef typename ImageType::PixelType     PixelType;
00081   typedef double                            PixelRealType;  
00082 
00084   itkStaticConstMacro(ImageDimension, unsigned int, ImageType::ImageDimension);
00085 
00087   typedef double  TimeStepType;
00088 
00091   typedef ZeroFluxNeumannBoundaryCondition<ImageType>
00092     DefaultBoundaryConditionType;
00093 
00095   typedef typename ConstNeighborhoodIterator<TImageType>::RadiusType RadiusType;
00096 
00099   typedef ConstNeighborhoodIterator<TImageType, DefaultBoundaryConditionType> NeighborhoodType;
00100 
00103   typedef Vector<PixelRealType,itkGetStaticConstMacro(ImageDimension)> NeighborhoodScalesType;
00104 
00107   typedef Vector<float,itkGetStaticConstMacro(ImageDimension)> FloatOffsetType;
00108 
00118   virtual void InitializeIteration() {};
00119 
00133 #if !defined(CABLE_CONFIGURATION)
00134   virtual PixelType  ComputeUpdate(const NeighborhoodType &neighborhood,
00135                                    void *globalData,
00136                                    const FloatOffsetType &offset = FloatOffsetType(0.0)) = 0;
00137 #endif
00138 
00141   void SetRadius(const RadiusType &r)
00142     { m_Radius = r; }
00143 
00146   const RadiusType &GetRadius() const
00147     { return m_Radius; }
00148 
00152   void SetScaleCoefficients (PixelRealType vals[ImageDimension])
00153     {
00154     for( unsigned int i = 0; i < ImageDimension; i++ )
00155       {
00156       m_ScaleCoefficients[i] = vals[i];
00157       }
00158     }
00160 
00164   const NeighborhoodScalesType ComputeNeighborhoodScales() const;
00165 
00172   virtual TimeStepType ComputeGlobalTimeStep(void *GlobalData) const =0;
00173 
00181   virtual void *GetGlobalDataPointer() const =0;
00182 
00188   virtual void ReleaseGlobalDataPointer(void *GlobalData) const =0;
00189 
00190 protected:
00191   FiniteDifferenceFunction() 
00192   {
00193     // initialize variables
00194     m_Radius.Fill( 0 );
00195     for (unsigned int i = 0; i < ImageDimension; i++)
00196       {
00197       m_ScaleCoefficients[i] = 1.0;
00198       }
00199   }
00200   ~FiniteDifferenceFunction() {}
00201   void PrintSelf(std::ostream& os, Indent indent) const;
00202 
00203   RadiusType m_Radius;
00204   PixelRealType m_ScaleCoefficients[ImageDimension];
00205 
00206 private:
00207   FiniteDifferenceFunction(const Self&); //purposely not implemented
00208   void operator=(const Self&); //purposely not implemented
00209 };
00210   
00211 } // end namespace itk
00212 
00213 // Define instantiation macro for this template.
00214 #define ITK_TEMPLATE_FiniteDifferenceFunction(_, EXPORT, x, y) namespace itk { \
00215   _(1(class EXPORT FiniteDifferenceFunction< ITK_TEMPLATE_1 x >)) \
00216   namespace Templates { typedef FiniteDifferenceFunction< ITK_TEMPLATE_1 x > FiniteDifferenceFunction##y; } \
00217   }
00218 
00219 #if ITK_TEMPLATE_EXPLICIT
00220 # include "Templates/itkFiniteDifferenceFunction+-.h"
00221 #endif
00222 
00223 #if ITK_TEMPLATE_TXX
00224 # include "itkFiniteDifferenceFunction.txx"
00225 #endif
00226 
00227 #endif
00228 

Generated at Mon Jul 12 2010 18:20:07 for ITK by doxygen 1.7.1 written by Dimitri van Heesch, © 1997-2000