ITK  4.0.0
Insight Segmentation and Registration Toolkit
itkVectorGradientNDAnisotropicDiffusionFunction.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkVectorGradientNDAnisotropicDiffusionFunction_h
00019 #define __itkVectorGradientNDAnisotropicDiffusionFunction_h
00020 
00021 #include "itkVectorAnisotropicDiffusionFunction.h"
00022 #include "itkNeighborhoodAlgorithm.h"
00023 #include "itkVectorNeighborhoodInnerProduct.h"
00024 #include "itkDerivativeOperator.h"
00025 
00026 namespace itk
00027 {
00043 template< class TImage >
00044 class ITK_EXPORT VectorGradientNDAnisotropicDiffusionFunction:
00045   public VectorAnisotropicDiffusionFunction< TImage >
00046 {
00047 public:
00049   typedef VectorGradientNDAnisotropicDiffusionFunction Self;
00050   typedef VectorAnisotropicDiffusionFunction< TImage > Superclass;
00051   typedef SmartPointer< Self >                         Pointer;
00052   typedef SmartPointer< const Self >                   ConstPointer;
00053 
00055   itkNewMacro(Self);
00056 
00058   itkTypeMacro(VectorGradientNDAnisotropicDiffusionFunction,
00059                ScalarAnisotropicDiffusionFunction);
00060 
00062   typedef typename Superclass::ImageType        ImageType;
00063   typedef typename Superclass::PixelType        PixelType;
00064   typedef typename Superclass::TimeStepType     TimeStepType;
00065   typedef typename Superclass::RadiusType       RadiusType;
00066   typedef typename Superclass::NeighborhoodType NeighborhoodType;
00067   typedef typename Superclass::FloatOffsetType  FloatOffsetType;
00068 
00070   itkStaticConstMacro(ImageDimension, unsigned int,
00071                       Superclass::ImageDimension);
00072   itkStaticConstMacro(VectorDimension, unsigned int,
00073                       Superclass::VectorDimension);
00075 
00077   typedef typename PixelType::ValueType ScalarValueType;
00078 
00080   virtual PixelType ComputeUpdate(const NeighborhoodType & neighborhood,
00081                                   void *globalData,
00082                                   const FloatOffsetType & offset = FloatOffsetType(0.0)
00083                                   );
00084 
00086   virtual void InitializeIteration()
00087   {
00088     m_K = this->GetAverageGradientMagnitudeSquared() * this->GetConductanceParameter()
00089           * this->GetConductanceParameter() * -2.0f;
00090   }
00091 
00092 protected:
00093   VectorGradientNDAnisotropicDiffusionFunction();
00094   ~VectorGradientNDAnisotropicDiffusionFunction() {}
00095 private:
00096   VectorGradientNDAnisotropicDiffusionFunction(const Self &); //purposely not
00097                                                               // implemented
00098   void operator=(const Self &);                               //purposely not
00099 
00100   // implemented
00101 
00103   VectorNeighborhoodInnerProduct< ImageType > m_InnerProduct;
00104 
00106   std::slice x_slice[ImageDimension];
00107   std::slice xa_slice[ImageDimension][ImageDimension];
00108   std::slice xd_slice[ImageDimension][ImageDimension];
00109 
00111   DerivativeOperator< ScalarValueType,
00112                       itkGetStaticConstMacro(ImageDimension) > dx_op;
00113 
00115   ScalarValueType m_K;
00116 
00117   static double m_MIN_NORM;
00118 
00119   SizeValueType m_Stride[ImageDimension];
00120   SizeValueType m_Center;
00121 };
00122 } // end namespace itk
00123 
00124 #ifndef ITK_MANUAL_INSTANTIATION
00125 #include "itkVectorGradientNDAnisotropicDiffusionFunction.hxx"
00126 #endif
00127 
00128 #endif
00129