00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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
00070 template <class TImage>
00071 class CurvatureNDAnisotropicDiffusionFunction :
00072 public ScalarAnisotropicDiffusionFunction<TImage>
00073 {
00074 public:
00076 typedef CurvatureNDAnisotropicDiffusionFunction Self;
00077 typedef ScalarAnisotropicDiffusionFunction<TImage> Superclass;
00078 typedef SmartPointer<Self> Pointer;
00079 typedef SmartPointer<const Self> ConstPointer;
00080
00082 itkNewMacro(Self);
00083
00085 itkTypeMacro( CurvatureNDAnisotropicDiffusionFunction,
00086 ScalarAnisotropicDiffusionFunction );
00087
00089 typedef typename Superclass::ImageType ImageType;
00090 typedef typename Superclass::PixelType PixelType;
00091 typedef typename Superclass::TimeStepType TimeStepType;
00092 typedef typename Superclass::RadiusType RadiusType;
00093 typedef typename Superclass::NeighborhoodType NeighborhoodType;
00094 typedef typename Superclass::BoundaryNeighborhoodType
00095 BoundaryNeighborhoodType;
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 = m_ZeroOffset
00105 ) const;
00106 virtual PixelType ComputeUpdate(const BoundaryNeighborhoodType
00107 &neighborhood, void *globalData,
00108 const FloatOffsetType& offset = m_ZeroOffset
00109 ) const;
00110
00112 virtual void InitializeIteration()
00113 {
00114 m_K = static_cast<PixelType>(this->GetAverageGradientMagnitudeSquared() *
00115 this->GetConductanceParameter() * -1.0f);
00116 }
00117
00118 protected:
00119 CurvatureNDAnisotropicDiffusionFunction();
00120 ~CurvatureNDAnisotropicDiffusionFunction() {}
00121 void PrintSelf(std::ostream& os, Indent indent) const
00122 {
00123 Superclass::PrintSelf(os,indent);
00124 }
00125
00126 private:
00127 CurvatureNDAnisotropicDiffusionFunction(const Self&);
00128 void operator=(const Self&);
00129
00131 NeighborhoodInnerProduct<ImageType> m_InnerProduct;
00132
00134 SmartNeighborhoodInnerProduct<ImageType> m_SmartInnerProduct;
00135
00137 std::slice x_slice[ImageDimension];
00138 std::slice xa_slice[ImageDimension][ImageDimension];
00139 std::slice xd_slice[ImageDimension][ImageDimension];
00140
00142 DerivativeOperator<PixelType, itkGetStaticConstMacro(ImageDimension)> dx_op;
00143
00145 PixelType m_K;
00146
00148 static double m_MIN_NORM;
00149
00150 unsigned long m_Center;
00151 unsigned long m_Stride[ImageDimension];
00152
00153 };
00154
00155
00156
00157 }
00158
00159 #ifndef ITK_MANUAL_INSTANTIATION
00160 #include "itkCurvatureNDAnisotropicDiffusionFunction.txx"
00161 #endif
00162
00163 #endif