00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkVectorGradientNDAnisotropicDiffusionFunction_h_
00018 #define __itkVectorGradientNDAnisotropicDiffusionFunction_h_
00019
00020 #include "itkVectorAnisotropicDiffusionFunction.h"
00021 #include "itkNeighborhoodAlgorithm.h"
00022 #include "itkVectorNeighborhoodInnerProduct.h"
00023 #include "itkDerivativeOperator.h"
00024
00025 namespace itk {
00026
00033 template <class TImage>
00034 class VectorGradientNDAnisotropicDiffusionFunction :
00035 public VectorAnisotropicDiffusionFunction<TImage>
00036 {
00037 public:
00039 typedef VectorGradientNDAnisotropicDiffusionFunction Self;
00040 typedef VectorAnisotropicDiffusionFunction<TImage> Superclass;
00041 typedef SmartPointer<Self> Pointer;
00042 typedef SmartPointer<const Self> ConstPointer;
00043
00045 itkNewMacro(Self);
00046
00048 itkTypeMacro( VectorGradientNDAnisotropicDiffusionFunction,
00049 ScalarAnisotropicDiffusionFunction );
00050
00052 typedef typename Superclass::ImageType ImageType;
00053 typedef typename Superclass::PixelType PixelType;
00054 typedef typename Superclass::TimeStepType TimeStepType;
00055 typedef typename Superclass::RadiusType RadiusType;
00056 typedef typename Superclass::NeighborhoodType NeighborhoodType;
00057 typedef typename Superclass::BoundaryNeighborhoodType
00058 BoundaryNeighborhoodType;
00059 typedef typename Superclass::FloatOffsetType FloatOffsetType;
00060
00062 itkStaticConstMacro(ImageDimension, unsigned int,
00063 Superclass::ImageDimension );
00064 itkStaticConstMacro(VectorDimension, unsigned int,
00065 Superclass::VectorDimension );
00066
00068 typedef typename PixelType::ValueType ScalarValueType;
00069
00071 virtual PixelType ComputeUpdate(const NeighborhoodType &neighborhood,
00072 void * globalData,
00073 const FloatOffsetType& offset = m_ZeroOffset
00074 ) const;
00075 virtual PixelType ComputeUpdate(const BoundaryNeighborhoodType
00076 &neighborhood, void * globalData,
00077 const FloatOffsetType& offset = m_ZeroOffset
00078 ) const;
00079
00081 virtual void InitializeIteration()
00082 {
00083 m_K = this->GetAverageGradientMagnitudeSquared() *
00084 this->GetConductanceParameter() * -1.0f;
00085 }
00086
00087 protected:
00088 VectorGradientNDAnisotropicDiffusionFunction();
00089 ~VectorGradientNDAnisotropicDiffusionFunction() {}
00090
00091 private:
00092 VectorGradientNDAnisotropicDiffusionFunction(const Self&);
00093 void operator=(const Self&);
00094
00096 VectorNeighborhoodInnerProduct<ImageType> m_InnerProduct;
00097
00099 SmartVectorNeighborhoodInnerProduct<ImageType> m_SmartInnerProduct;
00100
00102 std::slice x_slice[ImageDimension];
00103 std::slice xa_slice[ImageDimension][ImageDimension];
00104 std::slice xd_slice[ImageDimension][ImageDimension];
00105
00107 DerivativeOperator<ScalarValueType,
00108 itkGetStaticConstMacro(ImageDimension)> dx_op;
00109
00111 ScalarValueType m_K;
00112
00113 static double m_MIN_NORM;
00114
00115 unsigned long int m_Stride[ImageDimension];
00116 unsigned long int m_Center;
00117
00118 };
00119
00120
00121
00122 }
00123
00124 #ifndef ITK_MANUAL_INSTANTIATION
00125 #include "itkVectorGradientNDAnisotropicDiffusionFunction.txx"
00126 #endif
00127
00128 #endif