00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkFiniteDifferenceFunction_h_
00018 #define __itkFiniteDifferenceFunction_h_
00019
00020 #include "itkLightObject.h"
00021 #include "itkConstNeighborhoodIterator.h"
00022 #include "itkConstSmartNeighborhoodIterator.h"
00023 #include "itkZeroFluxNeumannBoundaryCondition.h"
00024 #include "itkVector.h"
00025
00026 namespace itk {
00027
00063 template<class TImageType>
00064 class FiniteDifferenceFunction : public LightObject
00065 {
00066 public:
00068 typedef FiniteDifferenceFunction Self;
00069 typedef LightObject Superclass;
00070
00071 typedef SmartPointer<Self> Pointer;
00072 typedef SmartPointer<const Self> ConstPointer;
00073
00075 itkTypeMacro( FiniteDifferenceFunction, LightObject );
00076
00078 typedef TImageType ImageType;
00079 typedef typename ImageType::PixelType PixelType;
00080
00082 itkStaticConstMacro(ImageDimension, unsigned int, ImageType::ImageDimension);
00083
00085 typedef double TimeStepType;
00086
00089 typedef ZeroFluxNeumannBoundaryCondition<ImageType>
00090 DefaultBoundaryConditionType;
00091
00093 typedef typename ConstNeighborhoodIterator<TImageType>::RadiusType RadiusType;
00094
00097 typedef ConstNeighborhoodIterator<TImageType> NeighborhoodType;
00098
00101 typedef ConstSmartNeighborhoodIterator<TImageType,
00102 DefaultBoundaryConditionType> BoundaryNeighborhoodType;
00103
00106 typedef Vector<float,itkGetStaticConstMacro(ImageDimension)> FloatOffsetType;
00107
00117 virtual void InitializeIteration() {};
00118
00132 virtual PixelType ComputeUpdate(const NeighborhoodType &neighborhood,
00133 void *globalData,
00134 const FloatOffsetType &offset = m_ZeroOffset)
00135 const = 0;
00136
00141 virtual PixelType ComputeUpdate(const BoundaryNeighborhoodType
00142 &neighborhood, void *globalData,
00143 const FloatOffsetType &offset = m_ZeroOffset)
00144 const = 0;
00145
00148 void SetRadius(const RadiusType &r)
00149 { m_Radius = r; }
00150
00153 const RadiusType &GetRadius() const
00154 { return m_Radius; }
00155
00162 virtual TimeStepType ComputeGlobalTimeStep(void *GlobalData) const =0;
00163
00171 virtual void *GetGlobalDataPointer() const =0;
00172
00178 virtual void ReleaseGlobalDataPointer(void *GlobalData) const =0;
00179
00180 protected:
00181 FiniteDifferenceFunction() {}
00182 ~FiniteDifferenceFunction() {}
00183 void PrintSelf(std::ostream& os, Indent indent) const
00184 {
00185 Superclass::PrintSelf(os, indent);
00186 os << indent << "Radius: " << m_Radius << std::endl;
00187 }
00188
00189 RadiusType m_Radius;
00190
00193 static FloatOffsetType m_ZeroOffset;
00194
00195 private:
00196 FiniteDifferenceFunction(const Self&);
00197 void operator=(const Self&);
00198
00201 static FloatOffsetType InitializeZeroOffset();
00202
00203 };
00204
00205 }
00206
00207 #ifndef ITK_MANUAL_INSTANTIATION
00208 #include "itkFiniteDifferenceFunction.txx"
00209 #endif
00210
00211 #endif