ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkVectorCurvatureAnisotropicDiffusionImageFilter.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 __itkVectorCurvatureAnisotropicDiffusionImageFilter_h
00019 #define __itkVectorCurvatureAnisotropicDiffusionImageFilter_h
00020 
00021 #include "itkMacro.h"
00022 #include "itkAnisotropicDiffusionImageFilter.h"
00023 #include "itkVectorCurvatureNDAnisotropicDiffusionFunction.h"
00024 
00025 namespace itk
00026 {
00062 template< class TInputImage, class TOutputImage >
00063 class ITK_EXPORT VectorCurvatureAnisotropicDiffusionImageFilter:
00064   public AnisotropicDiffusionImageFilter< TInputImage, TOutputImage >
00065 {
00066 public:
00068   typedef VectorCurvatureAnisotropicDiffusionImageFilter Self;
00069   typedef AnisotropicDiffusionImageFilter< TInputImage, TOutputImage >
00070   Superclass;
00071   typedef SmartPointer< Self >       Pointer;
00072   typedef SmartPointer< const Self > ConstPointer;
00073 
00075   itkNewMacro(Self);
00076 
00078   itkTypeMacro(VectorCurvatureAnisotropicDiffusionImageFilter,
00079                AnisotropicDiffusionImageFilter);
00080 
00082   typedef typename Superclass::UpdateBufferType UpdateBufferType;
00083 
00085   itkStaticConstMacro(ImageDimension, unsigned int,
00086                       Superclass::ImageDimension);
00087 
00088 #ifdef ITK_USE_CONCEPT_CHECKING
00089 
00090   itkConceptMacro( InputHasNumericTraitsCheck,
00091                    ( Concept::HasNumericTraits< typename TInputImage::PixelType::ValueType > ) );
00092   itkConceptMacro( OutputHasNumericTraitsCheck,
00093                    ( Concept::HasNumericTraits< typename TOutputImage::PixelType::ValueType > ) );
00094 
00096 #endif
00097 protected:
00098   VectorCurvatureAnisotropicDiffusionImageFilter()
00099   {
00100     typename VectorCurvatureNDAnisotropicDiffusionFunction< UpdateBufferType >::Pointer q =
00101       VectorCurvatureNDAnisotropicDiffusionFunction< UpdateBufferType >::New();
00102     this->SetDifferenceFunction(q);
00103   }
00105 
00106   ~VectorCurvatureAnisotropicDiffusionImageFilter() {}
00107 
00108   virtual void InitializeIteration()
00109   {
00110     Superclass::InitializeIteration();
00111     if ( this->GetTimeStep() >  0.5 / vcl_pow( 2.0, static_cast< double >( ImageDimension ) ) )
00112       {
00113       itkWarningMacro(
00114         << "Anisotropic diffusion has attempted to use a time step which may introduce instability into the solution.");
00115       }
00116   }
00117 
00118 private:
00119   VectorCurvatureAnisotropicDiffusionImageFilter(const Self &); //purposely not
00120                                                                 // implemented
00121   void operator=(const Self &);                                 //purposely not
00122 
00123   // implemented
00124 };
00125 } // end namspace itk
00126 
00127 #endif
00128