00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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::BoundaryNeighborhoodType
00083 BoundaryNeighborhoodType;
00084 typedef typename Superclass::FloatOffsetType FloatOffsetType;
00085
00087 itkStaticConstMacro(ImageDimension, unsigned int,Superclass::ImageDimension);
00088
00090 virtual PixelType ComputeUpdate(const NeighborhoodType &neighborhood,
00091 void *globalData,
00092 const FloatOffsetType& offset = m_ZeroOffset
00093 ) const;
00094 virtual PixelType ComputeUpdate(const BoundaryNeighborhoodType
00095 &neighborhood, void *globalData,
00096 const FloatOffsetType& offset = m_ZeroOffset
00097 ) const;
00098
00100 virtual void InitializeIteration()
00101 {
00102 m_K = static_cast<PixelType>(this->GetAverageGradientMagnitudeSquared() *
00103 this->GetConductanceParameter() * -1.0f);
00104 }
00105
00106 protected:
00107 GradientNDAnisotropicDiffusionFunction();
00108 ~GradientNDAnisotropicDiffusionFunction() {}
00109
00110 void PrintSelf(std::ostream& os, Indent indent) const
00111 { Superclass::PrintSelf(os,indent); }
00112
00114 NeighborhoodInnerProduct<ImageType> m_InnerProduct;
00115
00117 SmartNeighborhoodInnerProduct<ImageType> m_SmartInnerProduct;
00118
00120 std::slice x_slice[ImageDimension];
00121 std::slice xa_slice[ImageDimension][ImageDimension];
00122 std::slice xd_slice[ImageDimension][ImageDimension];
00123
00125 DerivativeOperator<PixelType, itkGetStaticConstMacro(ImageDimension)> dx_op;
00126
00128 PixelType m_K;
00129
00130 unsigned long m_Center;
00131 unsigned long m_Stride[ImageDimension];
00132
00133 static double m_MIN_NORM;
00134
00135 private:
00136 GradientNDAnisotropicDiffusionFunction(const Self&);
00137 void operator=(const Self&);
00138
00139 };
00140
00141 }
00142
00143 #ifndef ITK_MANUAL_INSTANTIATION
00144 #include "itkGradientNDAnisotropicDiffusionFunction.txx"
00145 #endif
00146
00147 #endif