00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkCurvatureFlowFunction.h,v $ 00005 Language: C++ 00006 Date: $Date: 2002/09/28 03:16:55 $ 00007 Version: $Revision: 1.12 $ 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 __itkCurvatureFlowFunction_h_ 00018 #define __itkCurvatureFlowFunction_h_ 00019 00020 #include "itkFiniteDifferenceFunction.h" 00021 #include "itkMacro.h" 00022 00023 namespace itk { 00024 00039 template <class TImage> 00040 class CurvatureFlowFunction : 00041 public FiniteDifferenceFunction<TImage> 00042 { 00043 public: 00045 typedef CurvatureFlowFunction Self; 00046 typedef FiniteDifferenceFunction<TImage> Superclass; 00047 typedef SmartPointer<Self> Pointer; 00048 typedef SmartPointer<const Self> ConstPointer; 00049 00051 itkNewMacro(Self); 00052 00054 itkTypeMacro( CurvatureFlowFunction, 00055 FiniteDifferenceFunction ); 00056 00058 typedef typename Superclass::ImageType ImageType; 00059 typedef typename Superclass::PixelType PixelType; 00060 typedef typename Superclass::RadiusType RadiusType; 00061 typedef PixelType ScalarValueType; 00062 typedef typename Superclass::NeighborhoodType NeighborhoodType; 00063 typedef typename Superclass::BoundaryNeighborhoodType BoundaryNeighborhoodType; 00064 typedef typename Superclass::FloatOffsetType FloatOffsetType; 00065 typedef typename Superclass::TimeStepType TimeStepType; 00066 00068 itkStaticConstMacro(ImageDimension, unsigned int,Superclass::ImageDimension); 00069 00080 virtual TimeStepType ComputeGlobalTimeStep(void *GlobalData) const; 00081 00087 virtual void *GetGlobalDataPointer() const 00088 { 00089 GlobalDataStruct *ans = new GlobalDataStruct(); 00090 ans->m_MaxChange = NumericTraits<ScalarValueType>::Zero; 00091 return ans; 00092 } 00093 00098 virtual void ReleaseGlobalDataPointer(void *GlobalData) const 00099 { delete (GlobalDataStruct *) GlobalData; } 00100 00102 void SetTimeStep( const TimeStepType & t ) 00103 { m_TimeStep = t; } 00104 00106 const TimeStepType &GetTimeStep() const 00107 { return m_TimeStep; } 00108 00111 virtual PixelType ComputeUpdate(const NeighborhoodType &neighborhood, 00112 void * globalData, 00113 const FloatOffsetType& offset = m_ZeroOffset 00114 ) const; 00115 00118 virtual PixelType ComputeUpdate(const BoundaryNeighborhoodType 00119 &neighborhood, void * globalData, 00120 const FloatOffsetType& offset = m_ZeroOffset 00121 ) const; 00122 00123 protected: 00124 00127 struct GlobalDataStruct 00128 { 00129 GlobalDataStruct() 00130 { 00131 m_MaxChange = NumericTraits<ScalarValueType>::Zero; 00132 } 00133 ~GlobalDataStruct() {} 00134 00135 ScalarValueType m_MaxChange; 00136 }; 00137 00138 CurvatureFlowFunction(); 00139 ~CurvatureFlowFunction() {} 00140 00141 private: 00142 CurvatureFlowFunction(const Self&); //purposely not implemented 00143 void operator=(const Self&); //purposely not implemented 00144 00145 TimeStepType m_TimeStep; 00146 00147 00148 }; 00149 00150 }// end namespace itk 00151 00152 #ifndef ITK_MANUAL_INSTANTIATION 00153 #include "itkCurvatureFlowFunction.txx" 00154 #endif 00155 00156 #endif