00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkGradientNDAnisotropicDiffusionFunction.h,v $ 00005 Language: C++ 00006 Date: $Date: 2008-01-18 20:07:32 $ 00007 Version: $Revision: 1.16 $ 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 00105 void PrintSelf(std::ostream& os, Indent indent) const 00106 { Superclass::PrintSelf(os,indent); } 00107 00109 NeighborhoodInnerProduct<ImageType> m_InnerProduct; 00110 00112 std::slice x_slice[ImageDimension]; 00113 std::slice xa_slice[ImageDimension][ImageDimension]; 00114 std::slice xd_slice[ImageDimension][ImageDimension]; 00115 00117 DerivativeOperator<PixelType, itkGetStaticConstMacro(ImageDimension)> dx_op; 00118 00120 PixelType m_K; 00121 00122 unsigned long m_Center; 00123 unsigned long m_Stride[ImageDimension]; 00124 00125 static double m_MIN_NORM; 00126 00127 private: 00128 GradientNDAnisotropicDiffusionFunction(const Self&); //purposely not implemented 00129 void operator=(const Self&); //purposely not implemented 00130 00131 }; 00132 00133 }// end namespace itk 00134 00135 #ifndef ITK_MANUAL_INSTANTIATION 00136 #include "itkGradientNDAnisotropicDiffusionFunction.txx" 00137 #endif 00138 00139 #endif 00140