00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkAnisotropicDiffusionFunction.h,v $ 00005 Language: C++ 00006 Date: $Date: 2002/09/11 19:39:01 $ 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 __itkAnisotropicDiffusionFunction_h_ 00018 #define __itkAnisotropicDiffusionFunction_h_ 00019 00020 00021 #include "itkFiniteDifferenceFunction.h" 00022 00023 namespace itk { 00024 00131 template <class TImage> 00132 class AnisotropicDiffusionFunction : 00133 public FiniteDifferenceFunction<TImage> 00134 { 00135 public: 00137 typedef AnisotropicDiffusionFunction Self; 00138 typedef FiniteDifferenceFunction<TImage> Superclass; 00139 typedef SmartPointer<Self> Pointer; 00140 typedef SmartPointer<const Self> ConstPointer; 00141 00143 itkTypeMacro( AnisotropicDiffusionFunction, FiniteDifferenceFunction ); 00144 00146 typedef typename Superclass::ImageType ImageType; 00147 typedef typename Superclass::PixelType PixelType; 00148 typedef typename Superclass::RadiusType RadiusType; 00149 typedef typename Superclass::NeighborhoodType NeighborhoodType; 00150 typedef typename Superclass::BoundaryNeighborhoodType BoundaryNeighborhoodType; 00151 typedef typename Superclass::TimeStepType TimeStepType; 00152 typedef typename Superclass::FloatOffsetType FloatOffsetType; 00153 00155 itkStaticConstMacro(ImageDimension, unsigned int,Superclass::ImageDimension); 00156 00162 virtual void CalculateAverageGradientMagnitudeSquared(ImageType *) = 0; 00163 00167 void SetTimeStep(const TimeStepType &t) 00168 { m_TimeStep = t; } 00169 const TimeStepType &GetTimeStep() const 00170 { return m_TimeStep; } 00171 00173 void SetConductanceParameter(const double &c) 00174 { m_ConductanceParameter = c * c ; } 00175 const double &GetConductanceParameter() const 00176 { return m_ConductanceParameter; } 00177 00179 const double &GetAverageGradientMagnitudeSquared() const 00180 { return m_AverageGradientMagnitudeSquared; } 00181 void SetAverageGradientMagnitudeSquared(const double &c) 00182 { m_AverageGradientMagnitudeSquared = c; } 00183 00186 virtual TimeStepType ComputeGlobalTimeStep(void *GlobalData) const 00187 { return this->GetTimeStep(); } 00188 00191 virtual void *GetGlobalDataPointer() const 00192 { return 0; } 00193 00195 virtual void ReleaseGlobalDataPointer(void *GlobalData) const 00196 { /* do nothing */ } 00197 00198 protected: 00199 AnisotropicDiffusionFunction() 00200 { 00201 m_AverageGradientMagnitudeSquared = 0.0; 00202 m_ConductanceParameter = 1.0; // default value 00203 m_TimeStep = 0.125f; // default value 00204 } 00205 ~AnisotropicDiffusionFunction() {} 00206 00207 void PrintSelf(std::ostream& os, Indent indent) const 00208 { 00209 Superclass::PrintSelf(os,indent); 00210 os << indent << "TimeStep: " << m_TimeStep << std::endl; 00211 os << indent << "ConductanceParameter: " << m_ConductanceParameter << 00212 std::endl; 00213 } 00214 00215 private: 00216 AnisotropicDiffusionFunction(const Self&); //purposely not implemented 00217 void operator=(const Self&); //purposely not implemented 00218 00219 double m_AverageGradientMagnitudeSquared; 00220 double m_ConductanceParameter; 00221 TimeStepType m_TimeStep; 00222 }; 00223 00224 }// end namespace itk 00225 00226 #endif