00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkAnisotropicDiffusionFunction.h,v $ 00005 Language: C++ 00006 Date: $Date: 2008-10-07 14:49:29 $ 00007 Version: $Revision: 1.19 $ 00008 00009 Copyright (c) Insight Software 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 00134 template <class TImage> 00135 class ITK_EXPORT AnisotropicDiffusionFunction : 00136 public FiniteDifferenceFunction<TImage> 00137 { 00138 public: 00139 00141 typedef AnisotropicDiffusionFunction Self; 00142 typedef FiniteDifferenceFunction<TImage> Superclass; 00143 typedef SmartPointer<Self> Pointer; 00144 typedef SmartPointer<const Self> ConstPointer; 00145 00147 itkTypeMacro( AnisotropicDiffusionFunction, FiniteDifferenceFunction ); 00148 00150 typedef typename Superclass::ImageType ImageType; 00151 typedef typename Superclass::PixelType PixelType; 00152 typedef typename Superclass::PixelRealType PixelrealType; 00153 typedef typename Superclass::RadiusType RadiusType; 00154 typedef typename Superclass::NeighborhoodType NeighborhoodType; 00155 typedef typename Superclass::TimeStepType TimeStepType; 00156 typedef typename Superclass::FloatOffsetType FloatOffsetType; 00157 00159 itkStaticConstMacro(ImageDimension, unsigned int,Superclass::ImageDimension); 00160 00166 virtual void CalculateAverageGradientMagnitudeSquared(ImageType *) = 0; 00167 00171 void SetTimeStep(const TimeStepType &t) 00172 { 00173 m_TimeStep = t; 00174 } 00175 const TimeStepType &GetTimeStep() const 00176 { 00177 return m_TimeStep; 00178 } 00180 00182 void SetConductanceParameter(const double &c) 00183 { 00184 m_ConductanceParameter = c; 00185 } 00186 const double &GetConductanceParameter() const 00187 { 00188 return m_ConductanceParameter; 00189 } 00191 00193 const double &GetAverageGradientMagnitudeSquared() const 00194 { 00195 return m_AverageGradientMagnitudeSquared; 00196 } 00197 void SetAverageGradientMagnitudeSquared(const double &c) 00198 { 00199 m_AverageGradientMagnitudeSquared = c; 00200 } 00202 00205 virtual TimeStepType ComputeGlobalTimeStep(void *itkNotUsed(GlobalData)) const 00206 { 00207 return this->GetTimeStep(); 00208 } 00209 00212 virtual void *GetGlobalDataPointer() const 00213 { 00214 return 0; 00215 } 00216 00218 virtual void ReleaseGlobalDataPointer(void *itkNotUsed(GlobalData)) const 00219 { 00220 /* do nothing */ 00221 } 00222 00223 protected: 00224 AnisotropicDiffusionFunction() 00225 { 00226 m_AverageGradientMagnitudeSquared = 0.0; 00227 m_ConductanceParameter = 1.0; // default value 00228 m_TimeStep = 0.125f; // default value 00229 } 00230 ~AnisotropicDiffusionFunction() {} 00231 00232 void PrintSelf(std::ostream& os, Indent indent) const 00233 { 00234 Superclass::PrintSelf(os,indent); 00235 os << indent << "TimeStep: " << m_TimeStep << std::endl; 00236 os << indent << "ConductanceParameter: " << m_ConductanceParameter << 00237 std::endl; 00238 } 00239 00240 private: 00241 AnisotropicDiffusionFunction(const Self&); //purposely not implemented 00242 void operator=(const Self&); //purposely not implemented 00243 00244 double m_AverageGradientMagnitudeSquared; 00245 double m_ConductanceParameter; 00246 TimeStepType m_TimeStep; 00247 }; 00248 00249 }// end namespace itk 00250 00251 #endif 00252