ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkCurvatureAnisotropicDiffusionImageFilter.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 __itkCurvatureAnisotropicDiffusionImageFilter_h
00019 #define __itkCurvatureAnisotropicDiffusionImageFilter_h
00020 
00021 #include "itkAnisotropicDiffusionImageFilter.h"
00022 #include "itkCurvatureNDAnisotropicDiffusionFunction.h"
00023 #include "itkMacro.h"
00024 namespace itk
00025 {
00057 template< class TInputImage, class TOutputImage >
00058 class ITK_EXPORT CurvatureAnisotropicDiffusionImageFilter:
00059   public AnisotropicDiffusionImageFilter< TInputImage, TOutputImage >
00060 {
00061 public:
00062 
00064   typedef CurvatureAnisotropicDiffusionImageFilter Self;
00065   typedef AnisotropicDiffusionImageFilter< TInputImage, TOutputImage >
00066   Superclass;
00067   typedef SmartPointer< Self >       Pointer;
00068   typedef SmartPointer< const Self > ConstPointer;
00069 
00071   itkNewMacro(Self);
00072 
00074   itkTypeMacro(CurvatureAnisotropicDiffusionImageFilter,
00075                AnisotropicDiffusionImageFilter);
00076 
00078   typedef typename Superclass::UpdateBufferType UpdateBufferType;
00079 
00081   itkStaticConstMacro(ImageDimension, unsigned int,
00082                       Superclass::ImageDimension);
00083 
00084 #ifdef ITK_USE_CONCEPT_CHECKING
00085 
00086   itkConceptMacro( OutputHasNumericTraitsCheck,
00087                    ( Concept::HasNumericTraits< typename TOutputImage::PixelType > ) );
00088 
00090 #endif
00091 protected:
00092   CurvatureAnisotropicDiffusionImageFilter()
00093   {
00094     typename CurvatureNDAnisotropicDiffusionFunction< UpdateBufferType >::Pointer q =
00095       CurvatureNDAnisotropicDiffusionFunction< UpdateBufferType >::New();
00096     this->SetDifferenceFunction(q);
00097   }
00099 
00100   ~CurvatureAnisotropicDiffusionImageFilter() {}
00101 
00102   virtual void InitializeIteration()
00103   {
00104     Superclass::InitializeIteration();
00105     if ( this->GetTimeStep() >  0.5 / vcl_pow( 2.0, static_cast< double >( ImageDimension ) ) )
00106       {
00107       itkWarningMacro(
00108         << "Anisotropic diffusion is using a time step which may introduce instability into the solution.");
00109       }
00110   }
00111 
00112 private:
00113   CurvatureAnisotropicDiffusionImageFilter(const Self &); //purposely not
00114                                                           // implemented
00115   void operator=(const Self &);                           //purposely not
00116 
00117   // implemented
00118 };
00119 } // end namspace itk
00120 
00121 #endif
00122