00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkFiniteDifferenceFunction.h,v $ 00005 Language: C++ 00006 Date: $Date: 2002/12/17 17:50:35 $ 00007 Version: $Revision: 1.9 $ 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 __itkFiniteDifferenceFunction_h_ 00018 #define __itkFiniteDifferenceFunction_h_ 00019 00020 #include "itkLightObject.h" 00021 #include "itkConstNeighborhoodIterator.h" 00022 #include "itkZeroFluxNeumannBoundaryCondition.h" 00023 #include "itkVector.h" 00024 00025 namespace itk { 00026 00062 template<class TImageType> 00063 class FiniteDifferenceFunction : public LightObject 00064 { 00065 public: 00067 typedef FiniteDifferenceFunction Self; 00068 typedef LightObject Superclass; 00069 00070 typedef SmartPointer<Self> Pointer; 00071 typedef SmartPointer<const Self> ConstPointer; 00072 00074 itkTypeMacro( FiniteDifferenceFunction, LightObject ); 00075 00077 typedef TImageType ImageType; 00078 typedef typename ImageType::PixelType PixelType; 00079 00081 itkStaticConstMacro(ImageDimension, unsigned int, ImageType::ImageDimension); 00082 00084 typedef double TimeStepType; 00085 00088 typedef ZeroFluxNeumannBoundaryCondition<ImageType> 00089 DefaultBoundaryConditionType; 00090 00092 typedef typename ConstNeighborhoodIterator<TImageType>::RadiusType RadiusType; 00093 00096 typedef ConstNeighborhoodIterator<TImageType, DefaultBoundaryConditionType> NeighborhoodType; 00097 00100 typedef Vector<float,itkGetStaticConstMacro(ImageDimension)> FloatOffsetType; 00101 00111 virtual void InitializeIteration() {}; 00112 00126 virtual PixelType ComputeUpdate(const NeighborhoodType &neighborhood, 00127 void *globalData, 00128 const FloatOffsetType &offset = FloatOffsetType(0.0)) 00129 const = 0; 00130 00131 00134 void SetRadius(const RadiusType &r) 00135 { m_Radius = r; } 00136 00139 const RadiusType &GetRadius() const 00140 { return m_Radius; } 00141 00148 virtual TimeStepType ComputeGlobalTimeStep(void *GlobalData) const =0; 00149 00157 virtual void *GetGlobalDataPointer() const =0; 00158 00164 virtual void ReleaseGlobalDataPointer(void *GlobalData) const =0; 00165 00166 protected: 00167 FiniteDifferenceFunction() {} 00168 ~FiniteDifferenceFunction() {} 00169 void PrintSelf(std::ostream& os, Indent indent) const 00170 { 00171 Superclass::PrintSelf(os, indent); 00172 os << indent << "Radius: " << m_Radius << std::endl; 00173 } 00174 00175 RadiusType m_Radius; 00176 00177 private: 00178 FiniteDifferenceFunction(const Self&); //purposely not implemented 00179 void operator=(const Self&); //purposely not implemented 00180 }; 00181 00182 } // end namespace itk 00183 00184 #ifndef ITK_MANUAL_INSTANTIATION 00185 #include "itkFiniteDifferenceFunction.txx" 00186 #endif 00187 00188 #endif