00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkGradientNDAnisotropicDiffusionFunction.h,v $ 00005 Language: C++ 00006 Date: $Date: 2002/12/17 17:50:35 $ 00007 Version: $Revision: 1.10 $ 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 __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 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::TimeStepType TimeStepType; 00080 typedef typename Superclass::RadiusType RadiusType; 00081 typedef typename Superclass::NeighborhoodType NeighborhoodType; 00082 typedef typename Superclass::FloatOffsetType FloatOffsetType; 00083 00085 itkStaticConstMacro(ImageDimension, unsigned int,Superclass::ImageDimension); 00086 00088 virtual PixelType ComputeUpdate(const NeighborhoodType &neighborhood, 00089 void *globalData, 00090 const FloatOffsetType& offset = FloatOffsetType(0.0) 00091 ) const; 00092 00094 virtual void InitializeIteration() 00095 { 00096 m_K = static_cast<PixelType>(this->GetAverageGradientMagnitudeSquared() * 00097 this->GetConductanceParameter() * -1.0f); 00098 } 00099 00100 protected: 00101 GradientNDAnisotropicDiffusionFunction(); 00102 ~GradientNDAnisotropicDiffusionFunction() {} 00103 00104 void PrintSelf(std::ostream& os, Indent indent) const 00105 { Superclass::PrintSelf(os,indent); } 00106 00108 NeighborhoodInnerProduct<ImageType> m_InnerProduct; 00109 00111 std::slice x_slice[ImageDimension]; 00112 std::slice xa_slice[ImageDimension][ImageDimension]; 00113 std::slice xd_slice[ImageDimension][ImageDimension]; 00114 00116 DerivativeOperator<PixelType, itkGetStaticConstMacro(ImageDimension)> dx_op; 00117 00119 PixelType m_K; 00120 00121 unsigned long m_Center; 00122 unsigned long m_Stride[ImageDimension]; 00123 00124 static double m_MIN_NORM; 00125 00126 private: 00127 GradientNDAnisotropicDiffusionFunction(const Self&); //purposely not implemented 00128 void operator=(const Self&); //purposely not implemented 00129 00130 }; 00131 00132 }// end namespace itk 00133 00134 #ifndef ITK_MANUAL_INSTANTIATION 00135 #include "itkGradientNDAnisotropicDiffusionFunction.txx" 00136 #endif 00137 00138 #endif