ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkGradientNDAnisotropicDiffusionFunction.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 __itkGradientNDAnisotropicDiffusionFunction_h
00019 #define __itkGradientNDAnisotropicDiffusionFunction_h
00020 
00021 #include "itkScalarAnisotropicDiffusionFunction.h"
00022 #include "itkNeighborhoodAlgorithm.h"
00023 #include "itkNeighborhoodInnerProduct.h"
00024 #include "itkDerivativeOperator.h"
00025 
00026 namespace itk
00027 {
00060 template< class TImage >
00061 class ITK_EXPORT GradientNDAnisotropicDiffusionFunction:
00062   public ScalarAnisotropicDiffusionFunction< TImage >
00063 {
00064 public:
00066   typedef GradientNDAnisotropicDiffusionFunction       Self;
00067   typedef ScalarAnisotropicDiffusionFunction< TImage > Superclass;
00068   typedef SmartPointer< Self >                         Pointer;
00069   typedef SmartPointer< const Self >                   ConstPointer;
00070 
00072   itkNewMacro(Self);
00073 
00075   itkTypeMacro(GradientNDAnisotropicDiffusionFunction,
00076                ScalarAnisotropicDiffusionFunction);
00077 
00079   typedef typename Superclass::ImageType        ImageType;
00080   typedef typename Superclass::PixelType        PixelType;
00081   typedef typename Superclass::PixelRealType    PixelRealType;
00082   typedef typename Superclass::TimeStepType     TimeStepType;
00083   typedef typename Superclass::RadiusType       RadiusType;
00084   typedef typename Superclass::NeighborhoodType NeighborhoodType;
00085   typedef typename Superclass::FloatOffsetType  FloatOffsetType;
00086 
00087   typedef SizeValueType NeighborhoodSizeValueType;
00088 
00090   itkStaticConstMacro(ImageDimension, unsigned int, Superclass::ImageDimension);
00091 
00093   virtual PixelType ComputeUpdate(const NeighborhoodType & neighborhood,
00094                                   void *globalData,
00095                                   const FloatOffsetType & offset = FloatOffsetType(0.0)
00096                                   );
00097 
00099   virtual void InitializeIteration()
00100   {
00101     m_K = static_cast< PixelType >( this->GetAverageGradientMagnitudeSquared()
00102                                     * this->GetConductanceParameter() * this->GetConductanceParameter() * -2.0f );
00103   }
00104 
00105 protected:
00106   GradientNDAnisotropicDiffusionFunction();
00107   ~GradientNDAnisotropicDiffusionFunction() {}
00108 
00110   NeighborhoodInnerProduct< ImageType > m_InnerProduct;
00111 
00113   std::slice x_slice[ImageDimension];
00114   std::slice xa_slice[ImageDimension][ImageDimension];
00115   std::slice xd_slice[ImageDimension][ImageDimension];
00116 
00118   DerivativeOperator< PixelType, itkGetStaticConstMacro(ImageDimension) > dx_op;
00119 
00121   PixelType m_K;
00122 
00123   NeighborhoodSizeValueType m_Center;
00124   NeighborhoodSizeValueType m_Stride[ImageDimension];
00125 
00126   static double m_MIN_NORM;
00127 private:
00128   GradientNDAnisotropicDiffusionFunction(const Self &); //purposely not
00129                                                         // implemented
00130   void operator=(const Self &);                         //purposely not
00131 
00132   // implemented
00133 };
00134 } // end namespace itk
00135 
00136 #ifndef ITK_MANUAL_INSTANTIATION
00137 #include "itkGradientNDAnisotropicDiffusionFunction.hxx"
00138 #endif
00139 
00140 #endif
00141