00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkCurvatureNDAnisotropicDiffusionFunction.h,v $ 00005 Language: C++ 00006 Date: $Date: 2008-10-13 18:54:28 $ 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 __itkCurvatureNDAnisotropicDiffusionFunction_h 00018 #define __itkCurvatureNDAnisotropicDiffusionFunction_h 00019 00020 #include "itkScalarAnisotropicDiffusionFunction.h" 00021 #include "itkNeighborhoodAlgorithm.h" 00022 #include "itkNeighborhoodInnerProduct.h" 00023 #include "itkDerivativeOperator.h" 00024 00025 namespace itk { 00026 00071 template <class TImage> 00072 class ITK_EXPORT CurvatureNDAnisotropicDiffusionFunction : 00073 public ScalarAnisotropicDiffusionFunction<TImage> 00074 { 00075 public: 00076 00078 typedef CurvatureNDAnisotropicDiffusionFunction Self; 00079 typedef ScalarAnisotropicDiffusionFunction<TImage> Superclass; 00080 typedef SmartPointer<Self> Pointer; 00081 typedef SmartPointer<const Self> ConstPointer; 00082 00084 itkNewMacro(Self); 00085 00087 itkTypeMacro( CurvatureNDAnisotropicDiffusionFunction, 00088 ScalarAnisotropicDiffusionFunction ); 00089 00091 typedef typename Superclass::ImageType ImageType; 00092 typedef typename Superclass::PixelType PixelType; 00093 typedef typename Superclass::TimeStepType TimeStepType; 00094 typedef typename Superclass::RadiusType RadiusType; 00095 typedef typename Superclass::NeighborhoodType NeighborhoodType; 00096 typedef typename Superclass::FloatOffsetType FloatOffsetType; 00097 00099 itkStaticConstMacro(ImageDimension, unsigned int,Superclass::ImageDimension); 00100 00102 virtual PixelType ComputeUpdate(const NeighborhoodType &neighborhood, 00103 void *globalData, 00104 const FloatOffsetType& offset = FloatOffsetType(0.0) 00105 ); 00106 00108 virtual void InitializeIteration() 00109 { 00110 m_K = static_cast<PixelType>(this->GetAverageGradientMagnitudeSquared() * 00111 this->GetConductanceParameter() * 00112 this->GetConductanceParameter() * -2.0f); 00113 } 00114 00115 protected: 00116 CurvatureNDAnisotropicDiffusionFunction(); 00117 ~CurvatureNDAnisotropicDiffusionFunction() {} 00118 00119 private: 00120 CurvatureNDAnisotropicDiffusionFunction(const Self&); //purposely not implemented 00121 void operator=(const Self&); //purposely not implemented 00122 00124 NeighborhoodInnerProduct<ImageType> m_InnerProduct; 00125 00127 std::slice x_slice[ImageDimension]; 00128 std::slice xa_slice[ImageDimension][ImageDimension]; 00129 std::slice xd_slice[ImageDimension][ImageDimension]; 00130 00132 DerivativeOperator<PixelType, itkGetStaticConstMacro(ImageDimension)> dx_op; 00133 00135 PixelType m_K; 00136 00138 static double m_MIN_NORM; 00139 00140 unsigned long m_Center; 00141 unsigned long m_Stride[ImageDimension]; 00142 00143 }; 00144 00145 00146 00147 }// end namespace itk 00148 00149 #ifndef ITK_MANUAL_INSTANTIATION 00150 #include "itkCurvatureNDAnisotropicDiffusionFunction.txx" 00151 #endif 00152 00153 #endif 00154