ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkCurvatureNDAnisotropicDiffusionFunction.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 __itkCurvatureNDAnisotropicDiffusionFunction_h
00019 #define __itkCurvatureNDAnisotropicDiffusionFunction_h
00020 
00021 #include "itkScalarAnisotropicDiffusionFunction.h"
00022 #include "itkNeighborhoodAlgorithm.h"
00023 #include "itkNeighborhoodInnerProduct.h"
00024 #include "itkDerivativeOperator.h"
00025 
00026 namespace itk
00027 {
00074 template< class TImage >
00075 class ITK_EXPORT CurvatureNDAnisotropicDiffusionFunction:
00076   public ScalarAnisotropicDiffusionFunction< TImage >
00077 {
00078 public:
00079 
00081   typedef CurvatureNDAnisotropicDiffusionFunction      Self;
00082   typedef ScalarAnisotropicDiffusionFunction< TImage > Superclass;
00083   typedef SmartPointer< Self >                         Pointer;
00084   typedef SmartPointer< const Self >                   ConstPointer;
00085 
00087   itkNewMacro(Self);
00088 
00090   itkTypeMacro(CurvatureNDAnisotropicDiffusionFunction,
00091                ScalarAnisotropicDiffusionFunction);
00092 
00094   typedef typename Superclass::ImageType        ImageType;
00095   typedef typename Superclass::PixelType        PixelType;
00096   typedef typename Superclass::TimeStepType     TimeStepType;
00097   typedef typename Superclass::RadiusType       RadiusType;
00098   typedef typename Superclass::NeighborhoodType NeighborhoodType;
00099   typedef typename Superclass::FloatOffsetType  FloatOffsetType;
00100 
00101   typedef typename NeighborhoodType::SizeValueType NeighborhoodSizeValueType;
00102 
00104   itkStaticConstMacro(ImageDimension, unsigned int, Superclass::ImageDimension);
00105 
00107   virtual PixelType ComputeUpdate(const NeighborhoodType & neighborhood,
00108                                   void *globalData,
00109                                   const FloatOffsetType & offset = FloatOffsetType(0.0)
00110                                   );
00111 
00113   virtual void InitializeIteration()
00114   {
00115     m_K = static_cast< PixelType >( this->GetAverageGradientMagnitudeSquared()
00116                                     * this->GetConductanceParameter()
00117                                     * this->GetConductanceParameter() * -2.0f );
00118   }
00119 
00120 protected:
00121   CurvatureNDAnisotropicDiffusionFunction();
00122   ~CurvatureNDAnisotropicDiffusionFunction() {}
00123 private:
00124   CurvatureNDAnisotropicDiffusionFunction(const Self &); //purposely not
00125                                                          // implemented
00126   void operator=(const Self &);                          //purposely not
00127 
00128   // implemented
00129 
00131   NeighborhoodInnerProduct< ImageType > m_InnerProduct;
00132 
00134   std::slice x_slice[ImageDimension];
00135   std::slice xa_slice[ImageDimension][ImageDimension];
00136   std::slice xd_slice[ImageDimension][ImageDimension];
00137 
00139   DerivativeOperator< PixelType, itkGetStaticConstMacro(ImageDimension) > dx_op;
00140 
00142   PixelType m_K;
00143 
00145   static double m_MIN_NORM;
00146 
00147   NeighborhoodSizeValueType m_Center;
00148   NeighborhoodSizeValueType m_Stride[ImageDimension];
00149 };
00150 } // end namespace itk
00151 
00152 #ifndef ITK_MANUAL_INSTANTIATION
00153 #include "itkCurvatureNDAnisotropicDiffusionFunction.hxx"
00154 #endif
00155 
00156 #endif
00157