ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkAnisotropicDiffusionFunction.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 __itkAnisotropicDiffusionFunction_h
00019 #define __itkAnisotropicDiffusionFunction_h
00020 
00021 #include "itkFiniteDifferenceFunction.h"
00022 
00023 namespace itk
00024 {
00137 template< class TImage >
00138 class ITK_EXPORT AnisotropicDiffusionFunction:
00139   public FiniteDifferenceFunction< TImage >
00140 {
00141 public:
00142 
00144   typedef AnisotropicDiffusionFunction       Self;
00145   typedef FiniteDifferenceFunction< TImage > Superclass;
00146   typedef SmartPointer< Self >               Pointer;
00147   typedef SmartPointer< const Self >         ConstPointer;
00148 
00150   itkTypeMacro(AnisotropicDiffusionFunction, FiniteDifferenceFunction);
00151 
00153   typedef typename Superclass::ImageType        ImageType;
00154   typedef typename Superclass::PixelType        PixelType;
00155   typedef typename Superclass::PixelRealType    PixelrealType;
00156   typedef typename Superclass::RadiusType       RadiusType;
00157   typedef typename Superclass::NeighborhoodType NeighborhoodType;
00158   typedef typename Superclass::TimeStepType     TimeStepType;
00159   typedef typename Superclass::FloatOffsetType  FloatOffsetType;
00160 
00162   itkStaticConstMacro(ImageDimension, unsigned int, Superclass::ImageDimension);
00163 
00169   virtual void CalculateAverageGradientMagnitudeSquared(ImageType *) = 0;
00170 
00174   void SetTimeStep(const TimeStepType & t)
00175   {
00176     m_TimeStep = t;
00177   }
00178 
00179   const TimeStepType & GetTimeStep() const
00180   {
00181     return m_TimeStep;
00182   }
00183 
00185   void SetConductanceParameter(const double & c)
00186   {
00187     m_ConductanceParameter = c;
00188   }
00189 
00190   const double & GetConductanceParameter() const
00191   {
00192     return m_ConductanceParameter;
00193   }
00194 
00196   const double & GetAverageGradientMagnitudeSquared() const
00197   {
00198     return m_AverageGradientMagnitudeSquared;
00199   }
00200 
00201   void SetAverageGradientMagnitudeSquared(const double & c)
00202   {
00203     m_AverageGradientMagnitudeSquared = c;
00204   }
00205 
00208   virtual TimeStepType ComputeGlobalTimeStep( void *itkNotUsed(GlobalData) ) const
00209   {
00210     return this->GetTimeStep();
00211   }
00212 
00215   virtual void * GetGlobalDataPointer() const
00216   {
00217     return 0;
00218   }
00219 
00221   virtual void ReleaseGlobalDataPointer( void *itkNotUsed(GlobalData) ) const
00222   {
00223     /* do nothing */
00224   }
00225 
00226 protected:
00227   AnisotropicDiffusionFunction()
00228   {
00229     m_AverageGradientMagnitudeSquared = 0.0;
00230     m_ConductanceParameter     = 1.0;     // default value
00231     m_TimeStep                 = 0.125f;  // default value
00232   }
00233 
00234   ~AnisotropicDiffusionFunction() {}
00235 
00236   void PrintSelf(std::ostream & os, Indent indent) const
00237   {
00238     Superclass::PrintSelf(os, indent);
00239     os << indent << "TimeStep: " << m_TimeStep << std::endl;
00240     os << indent << "ConductanceParameter: " << m_ConductanceParameter
00241        << std::endl;
00242   }
00243 
00244 private:
00245   AnisotropicDiffusionFunction(const Self &); //purposely not implemented
00246   void operator=(const Self &);               //purposely not implemented
00247 
00248   double       m_AverageGradientMagnitudeSquared;
00249   double       m_ConductanceParameter;
00250   TimeStepType m_TimeStep;
00251 };
00252 } // end namespace itk
00253 
00254 #endif
00255