ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkVectorCurvatureNDAnisotropicDiffusionFunction.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 __itkVectorCurvatureNDAnisotropicDiffusionFunction_h
00019 #define __itkVectorCurvatureNDAnisotropicDiffusionFunction_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 VectorCurvatureNDAnisotropicDiffusionFunction:
00045   public VectorAnisotropicDiffusionFunction< TImage >
00046 {
00047 public:
00049   typedef VectorCurvatureNDAnisotropicDiffusionFunction Self;
00050   typedef VectorAnisotropicDiffusionFunction< TImage >  Superclass;
00051   typedef SmartPointer< Self >                          Pointer;
00052   typedef SmartPointer< const Self >                    ConstPointer;
00053 
00055   itkNewMacro(Self);
00056 
00058   itkTypeMacro(VectorCurvatureNDAnisotropicDiffusionFunction,
00059                VectorAnisotropicDiffusionFunction);
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   typedef typename PixelType::ValueType         ScalarValueType;
00069 
00071   itkStaticConstMacro(ImageDimension, unsigned int,
00072                       Superclass::ImageDimension);
00073   itkStaticConstMacro(VectorDimension, unsigned int,
00074                       Superclass::VectorDimension);
00076 
00078   virtual PixelType ComputeUpdate(const NeighborhoodType & neighborhood,
00079                                   void *globalData,
00080                                   const FloatOffsetType & offset = FloatOffsetType(0.0)
00081                                   );
00082 
00084   virtual void InitializeIteration()
00085   {
00086     m_K = this->GetAverageGradientMagnitudeSquared() * this->GetConductanceParameter()
00087           * this->GetConductanceParameter() * -2.0f;
00088   }
00089 
00090 protected:
00091   VectorCurvatureNDAnisotropicDiffusionFunction();
00092   ~VectorCurvatureNDAnisotropicDiffusionFunction() {}
00093   void PrintSelf(std::ostream & os, Indent indent) const
00094   {  Superclass::PrintSelf(os, indent);   }
00095 private:
00096   VectorCurvatureNDAnisotropicDiffusionFunction(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, itkGetStaticConstMacro(ImageDimension) > dx_op;
00112 
00114   double m_K;
00115 
00116   static double m_MIN_NORM;
00117   SizeValueType m_Center;
00118   SizeValueType m_Stride[ImageDimension];
00119 };
00120 } // end namespace itk
00121 
00122 #ifndef ITK_MANUAL_INSTANTIATION
00123 #include "itkVectorCurvatureNDAnisotropicDiffusionFunction.hxx"
00124 #endif
00125 
00126 #endif
00127