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 "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
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&);
00209 void operator=(const Self&);
00210 };
00211
00212 }
00213
00214
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