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