00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkGradientNDAnisotropicDiffusionFunction.h,v $ 00005 Language: C++ 00006 Date: $Date: 2008-10-16 16:45:08 $ 00007 Version: $Revision: 1.17 $ 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 __itkGradientNDAnisotropicDiffusionFunction_h 00018 #define __itkGradientNDAnisotropicDiffusionFunction_h 00019 00020 #include "itkScalarAnisotropicDiffusionFunction.h" 00021 #include "itkNeighborhoodAlgorithm.h" 00022 #include "itkNeighborhoodInnerProduct.h" 00023 #include "itkDerivativeOperator.h" 00024 00025 namespace itk { 00026 00058 template <class TImage> 00059 class ITK_EXPORT GradientNDAnisotropicDiffusionFunction : 00060 public ScalarAnisotropicDiffusionFunction<TImage> 00061 { 00062 public: 00064 typedef GradientNDAnisotropicDiffusionFunction Self; 00065 typedef ScalarAnisotropicDiffusionFunction<TImage> Superclass; 00066 typedef SmartPointer<Self> Pointer; 00067 typedef SmartPointer<const Self> ConstPointer; 00068 00070 itkNewMacro(Self); 00071 00073 itkTypeMacro( GradientNDAnisotropicDiffusionFunction, 00074 ScalarAnisotropicDiffusionFunction ); 00075 00077 typedef typename Superclass::ImageType ImageType; 00078 typedef typename Superclass::PixelType PixelType; 00079 typedef typename Superclass::PixelRealType PixelRealType; 00080 typedef typename Superclass::TimeStepType TimeStepType; 00081 typedef typename Superclass::RadiusType RadiusType; 00082 typedef typename Superclass::NeighborhoodType NeighborhoodType; 00083 typedef typename Superclass::FloatOffsetType FloatOffsetType; 00084 00086 itkStaticConstMacro(ImageDimension, unsigned int,Superclass::ImageDimension); 00087 00089 virtual PixelType ComputeUpdate(const NeighborhoodType &neighborhood, 00090 void *globalData, 00091 const FloatOffsetType& offset = FloatOffsetType(0.0) 00092 ); 00093 00095 virtual void InitializeIteration() 00096 { 00097 m_K = static_cast<PixelType>(this->GetAverageGradientMagnitudeSquared() * 00098 this->GetConductanceParameter() * this->GetConductanceParameter() * -2.0f); 00099 } 00100 00101 protected: 00102 GradientNDAnisotropicDiffusionFunction(); 00103 ~GradientNDAnisotropicDiffusionFunction() {} 00104 00106 NeighborhoodInnerProduct<ImageType> m_InnerProduct; 00107 00109 std::slice x_slice[ImageDimension]; 00110 std::slice xa_slice[ImageDimension][ImageDimension]; 00111 std::slice xd_slice[ImageDimension][ImageDimension]; 00112 00114 DerivativeOperator<PixelType, itkGetStaticConstMacro(ImageDimension)> dx_op; 00115 00117 PixelType m_K; 00118 00119 unsigned long m_Center; 00120 unsigned long m_Stride[ImageDimension]; 00121 00122 static double m_MIN_NORM; 00123 00124 private: 00125 GradientNDAnisotropicDiffusionFunction(const Self&); //purposely not implemented 00126 void operator=(const Self&); //purposely not implemented 00127 00128 }; 00129 00130 }// end namespace itk 00131 00132 #ifndef ITK_MANUAL_INSTANTIATION 00133 #include "itkGradientNDAnisotropicDiffusionFunction.txx" 00134 #endif 00135 00136 #endif 00137