ITK  4.3.0
Insight Segmentation and Registration Toolkit
Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
itk::AnisotropicDiffusionFunction< TImage > Class Template Referenceabstract

#include <itkAnisotropicDiffusionFunction.h>

+ Inheritance diagram for itk::AnisotropicDiffusionFunction< TImage >:
+ Collaboration diagram for itk::AnisotropicDiffusionFunction< TImage >:

Detailed Description

template<class TImage>
class itk::AnisotropicDiffusionFunction< TImage >

This class is a virtual base for anisotropic diffusion function objects. It is a component object in the finite difference solver hierarchy (see itkFiniteDifferenceImageFilter for an overview). AnisotropicDiffusionFunction objects are used by AnisotropicDiffusionImageFilter objects to perform non-linear diffusion on itk::Images.

Overview of anisotropic diffusion

Anisotropic diffusion methods are formulated to reduce noise (or unwanted detail) in images while preserving specific image features. For many applications, there is an assumption that light-dark transitions (edges) are interesting. Standard isotropic diffusion methods move and blur light-dark boundaries. Anisotropic diffusion methods are formulated to specifically preserve edges.

Anisotropic diffusion methods can be thought of as tools for calculating multi-scale descriptions of images. Embed an image $U(\mathbf{x})$ in a higher dimensional function of derived images, $U(\mathbf{x}, t)$. This higher dimensional function represents the solution of the heat diffusion equation,

\[\frac{d U(\mathbf{x})}{d t} = \nabla \cdot c \nabla U(\mathbf{x})\]

with constant $c$ and initial condition $U(\mathbf{x}, 0) = U_0(\mathbf{x})$, the original image.
Extending to the case where $c$ is not a constant, but a function of $\mathbf{x}$, gives

\[\frac{d U(\mathbf{x})}{d t} = C(\mathbf{x})\Delta U(\mathbf{x}) + \nabla C(\mathbf{x}) \nabla U(\mathbf{x})\]

Our choice of $C$ now varies the strength of diffusion anisotropically. Typically, $C$ is chosen as some function of image features to selectively preserve or remove those features. For example, edges tend to be preserved over smoother regions where $C$ is inversely scaled according to gradient magnitude as in

\[C(\mathbf{x}) = e^{-(\frac{\parallel \nabla U(\mathbf{x}) \parallel}{K})^2}\]

.
Several variations on the scheme presented above are implemented in Itk as subclasses of this equation. The equations are solved using an iterative, finite forward difference technique (see the FiniteDifferenceImageFilter class).
How to use this class
This class must be subclassed to provide the CalculateUpdate() methods of FiniteDifferenceFunction and the function CalculateAverageGradientMagnitudeSquared(), which is called before each iteration to recalibrate the conductance term.
Parameters
The parameters defined in this class apply to the basic anisotropic diffusion equation described in AnisotropicDiffusionFunction. Variations on the basic equation will be more or less sensitive to these parameters. For example, functions that perform higher-order derivative calculations may require smaller time-steps than those that only do first-derivative calculations. Wherever possibe, reasonable parameters settings are suggested in the documentation of a specific equation implementation.
TimeStep
In the anisotropic diffusion filter hierarchy, the time step is set explicitly by the user. The time step referred to here corresponds exactly to $ \Delta t $ in the finite difference update equation described in FiniteDifferenceImageFilter (see itkFiniteDifferenceImageFilter for more information). Appropriate time steps for solving this type of p.d.e. depend on the dimensionality of the image and the order of the equation. Typical values are less than 0.250. A stable value for most 2 and 3d functions is 0.125. In general, you should keep the time step below $(PixelSpacing)/2^{N+1}$, where $N$ is the number of image dimensions. A filter will automatically attempt to constrain its time step to a stable value and generate a run-time warning if the time step is set too high.
Conductance Parameter
The conductance parameter controls the sensitivity of the conductance term in the basic anisotropic diffusion equation. It affects the conductance term in different ways depending on the particular variation on the basic equation. As a general rule, the lower the value, the more strongly the diffusion equation preserves image features (such as high gradients or curvature). A high value for conductance will cause the filter to diffuse image features more readily. Typical values range from 0.5 to 2.0 for data like the Visible Human color data, but the correct value for your application is wholly dependent on the results you want from a specific data set and the number or iterations you perform.
References
Pietro Perona and Jitendra Malik, ``Scale-space and edge detection using anisotropic diffusion,'' IEEE Transactions on Pattern Analysis Machine Intelligence, vol. 12, pp. 629-639, 1990.
See Also
VectorAnisotropicDiffusionFunction
ScalarAnisotropicDiffusionFunction
GradientAnisotropicDiffusionFunction
CurvatureAnisotropicDiffusionFunction
VectorGradientAnisotropicDiffusionFunction
Todo:
Automatically generate the time step value from image dimensionality and order of the equations

Definition at line 138 of file itkAnisotropicDiffusionFunction.h.

Public Types

typedef SmartPointer< const SelfConstPointer
 
typedef Superclass::FloatOffsetType FloatOffsetType
 
typedef Superclass::ImageType ImageType
 
typedef
Superclass::NeighborhoodType 
NeighborhoodType
 
typedef Superclass::PixelRealType PixelrealType
 
typedef Superclass::PixelType PixelType
 
typedef SmartPointer< SelfPointer
 
typedef Superclass::RadiusType RadiusType
 
typedef
AnisotropicDiffusionFunction 
Self
 
typedef
FiniteDifferenceFunction
< TImage > 
Superclass
 
typedef Superclass::TimeStepType TimeStepType
 
- Public Types inherited from itk::FiniteDifferenceFunction< TImage >
typedef SmartPointer< const SelfConstPointer
 
typedef
ZeroFluxNeumannBoundaryCondition
< ImageType
DefaultBoundaryConditionType
 
typedef Vector< float,
itkGetStaticConstMacro(ImageDimension) > 
FloatOffsetType
 
typedef TImage ImageType
 
typedef Vector< PixelRealType,
itkGetStaticConstMacro(ImageDimension) > 
NeighborhoodScalesType
 
typedef
ConstNeighborhoodIterator
< TImage,
DefaultBoundaryConditionType
NeighborhoodType
 
typedef double PixelRealType
 
typedef ImageType::PixelType PixelType
 
typedef SmartPointer< SelfPointer
 
typedef
ConstNeighborhoodIterator
< TImage >::RadiusType 
RadiusType
 
typedef FiniteDifferenceFunction Self
 
typedef LightObject Superclass
 
typedef double TimeStepType
 
- Public Types inherited from itk::LightObject
typedef SmartPointer< const SelfConstPointer
 
typedef SmartPointer< SelfPointer
 
typedef LightObject Self
 

Public Member Functions

virtual void CalculateAverageGradientMagnitudeSquared (ImageType *)=0
 
virtual TimeStepType ComputeGlobalTimeStep (void *) const
 
const double & GetAverageGradientMagnitudeSquared () const
 
const double & GetConductanceParameter () const
 
virtual void * GetGlobalDataPointer () const
 
virtual const char * GetNameOfClass () const
 
const TimeStepTypeGetTimeStep () const
 
virtual void ReleaseGlobalDataPointer (void *) const
 
void SetAverageGradientMagnitudeSquared (const double &c)
 
void SetConductanceParameter (const double &c)
 
void SetTimeStep (const TimeStepType &t)
 
- Public Member Functions inherited from itk::FiniteDifferenceFunction< TImage >
const NeighborhoodScalesType ComputeNeighborhoodScales () const
 
virtual PixelType ComputeUpdate (const NeighborhoodType &neighborhood, void *globalData, const FloatOffsetType &offset=FloatOffsetType(0.0))=0
 
const RadiusTypeGetRadius () const
 
void GetScaleCoefficients (PixelRealType vals[ImageDimension]) const
 
virtual void InitializeIteration ()
 
void SetRadius (const RadiusType &r)
 
void SetScaleCoefficients (PixelRealType vals[ImageDimension])
 
- Public Member Functions inherited from itk::LightObject
virtual Pointer CreateAnother () const
 
virtual void Delete ()
 
virtual int GetReferenceCount () const
 
 itkCloneMacro (Self)
 
void Print (std::ostream &os, Indent indent=0) const
 
virtual void Register () const
 
virtual void SetReferenceCount (int)
 
virtual void UnRegister () const
 

Static Public Attributes

static const unsigned int ImageDimension = Superclass::ImageDimension
 
- Static Public Attributes inherited from itk::FiniteDifferenceFunction< TImage >
static const unsigned int ImageDimension
 

Protected Member Functions

 AnisotropicDiffusionFunction ()
 
void PrintSelf (std::ostream &os, Indent indent) const
 
 ~AnisotropicDiffusionFunction ()
 
- Protected Member Functions inherited from itk::FiniteDifferenceFunction< TImage >
 FiniteDifferenceFunction ()
 
void PrintSelf (std::ostream &os, Indent indent) const
 
 ~FiniteDifferenceFunction ()
 
- Protected Member Functions inherited from itk::LightObject
virtual LightObject::Pointer InternalClone () const
 
 LightObject ()
 
virtual void PrintHeader (std::ostream &os, Indent indent) const
 
virtual void PrintTrailer (std::ostream &os, Indent indent) const
 
virtual ~LightObject ()
 

Private Member Functions

 AnisotropicDiffusionFunction (const Self &)
 
void operator= (const Self &)
 

Private Attributes

double m_AverageGradientMagnitudeSquared
 
double m_ConductanceParameter
 
TimeStepType m_TimeStep
 

Additional Inherited Members

- Static Public Member Functions inherited from itk::LightObject
static void BreakOnError ()
 
static Pointer New ()
 
- Protected Types inherited from itk::LightObject
typedef int InternalReferenceCountType
 
- Protected Attributes inherited from itk::FiniteDifferenceFunction< TImage >
RadiusType m_Radius
 
PixelRealType m_ScaleCoefficients [ImageDimension]
 

Member Typedef Documentation

template<class TImage >
typedef SmartPointer< const Self > itk::AnisotropicDiffusionFunction< TImage >::ConstPointer

Definition at line 147 of file itkAnisotropicDiffusionFunction.h.

Definition at line 159 of file itkAnisotropicDiffusionFunction.h.

template<class TImage >
typedef Superclass::ImageType itk::AnisotropicDiffusionFunction< TImage >::ImageType

Inherit some parameters from the superclass type

Definition at line 150 of file itkAnisotropicDiffusionFunction.h.

Definition at line 157 of file itkAnisotropicDiffusionFunction.h.

Definition at line 155 of file itkAnisotropicDiffusionFunction.h.

template<class TImage >
typedef Superclass::PixelType itk::AnisotropicDiffusionFunction< TImage >::PixelType

Definition at line 154 of file itkAnisotropicDiffusionFunction.h.

template<class TImage >
typedef SmartPointer< Self > itk::AnisotropicDiffusionFunction< TImage >::Pointer

Definition at line 146 of file itkAnisotropicDiffusionFunction.h.

template<class TImage >
typedef Superclass::RadiusType itk::AnisotropicDiffusionFunction< TImage >::RadiusType

Definition at line 156 of file itkAnisotropicDiffusionFunction.h.

template<class TImage >
typedef AnisotropicDiffusionFunction itk::AnisotropicDiffusionFunction< TImage >::Self

Standard class typedefs.

Definition at line 144 of file itkAnisotropicDiffusionFunction.h.

template<class TImage >
typedef FiniteDifferenceFunction< TImage > itk::AnisotropicDiffusionFunction< TImage >::Superclass

Definition at line 145 of file itkAnisotropicDiffusionFunction.h.

template<class TImage >
typedef Superclass::TimeStepType itk::AnisotropicDiffusionFunction< TImage >::TimeStepType

Definition at line 158 of file itkAnisotropicDiffusionFunction.h.

Constructor & Destructor Documentation

template<class TImage >
itk::AnisotropicDiffusionFunction< TImage >::AnisotropicDiffusionFunction ( )
inlineprotected

Definition at line 227 of file itkAnisotropicDiffusionFunction.h.

template<class TImage >
itk::AnisotropicDiffusionFunction< TImage >::~AnisotropicDiffusionFunction ( )
inlineprotected

Definition at line 234 of file itkAnisotropicDiffusionFunction.h.

template<class TImage >
itk::AnisotropicDiffusionFunction< TImage >::AnisotropicDiffusionFunction ( const Self )
private

Member Function Documentation

template<class TImage >
virtual void itk::AnisotropicDiffusionFunction< TImage >::CalculateAverageGradientMagnitudeSquared ( ImageType )
pure virtual

This method is called before each iteration. It calculates a scalar value that is the average of the gradient magnitude squared at each pixel in the output image (intermediate solution). The average gradient magnitude value is typically used in the anisotropic diffusion equations to calibrate the conductance term.

Implemented in itk::VectorAnisotropicDiffusionFunction< TImage >, and itk::ScalarAnisotropicDiffusionFunction< TImage >.

template<class TImage >
virtual TimeStepType itk::AnisotropicDiffusionFunction< TImage >::ComputeGlobalTimeStep ( void *  ) const
inlinevirtual

Returns the time step supplied by the user. We don't need to use the global data supplied since we are returning a fixed value.

Implements itk::FiniteDifferenceFunction< TImage >.

Definition at line 208 of file itkAnisotropicDiffusionFunction.h.

template<class TImage >
const double& itk::AnisotropicDiffusionFunction< TImage >::GetAverageGradientMagnitudeSquared ( ) const
inline

Set/Get the average gradient magnitude squared.

Definition at line 196 of file itkAnisotropicDiffusionFunction.h.

template<class TImage >
const double& itk::AnisotropicDiffusionFunction< TImage >::GetConductanceParameter ( ) const
inline

Definition at line 190 of file itkAnisotropicDiffusionFunction.h.

template<class TImage >
virtual void* itk::AnisotropicDiffusionFunction< TImage >::GetGlobalDataPointer ( ) const
inlinevirtual

The anisotropic diffusion classes don't use this particular parameter so it's safe to return a null value.

Implements itk::FiniteDifferenceFunction< TImage >.

Definition at line 215 of file itkAnisotropicDiffusionFunction.h.

template<class TImage >
virtual const char* itk::AnisotropicDiffusionFunction< TImage >::GetNameOfClass ( ) const
virtual
template<class TImage >
const TimeStepType& itk::AnisotropicDiffusionFunction< TImage >::GetTimeStep ( ) const
inline

Definition at line 179 of file itkAnisotropicDiffusionFunction.h.

template<class TImage >
void itk::AnisotropicDiffusionFunction< TImage >::operator= ( const Self )
private
template<class TImage >
void itk::AnisotropicDiffusionFunction< TImage >::PrintSelf ( std::ostream &  os,
Indent  indent 
) const
inlineprotectedvirtual

Methods invoked by Print() to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.

Reimplemented from itk::LightObject.

Reimplemented in itk::VectorCurvatureNDAnisotropicDiffusionFunction< TImage >, and itk::VectorAnisotropicDiffusionFunction< TImage >.

Definition at line 236 of file itkAnisotropicDiffusionFunction.h.

template<class TImage >
virtual void itk::AnisotropicDiffusionFunction< TImage >::ReleaseGlobalDataPointer ( void *  ) const
inlinevirtual

Does nothing. No global data is used in this class of equations.

Implements itk::FiniteDifferenceFunction< TImage >.

Definition at line 221 of file itkAnisotropicDiffusionFunction.h.

template<class TImage >
void itk::AnisotropicDiffusionFunction< TImage >::SetAverageGradientMagnitudeSquared ( const double &  c)
inline

Definition at line 201 of file itkAnisotropicDiffusionFunction.h.

template<class TImage >
void itk::AnisotropicDiffusionFunction< TImage >::SetConductanceParameter ( const double &  c)
inline

Set/Get the conductance parameter. The conductance parameter.

Definition at line 185 of file itkAnisotropicDiffusionFunction.h.

template<class TImage >
void itk::AnisotropicDiffusionFunction< TImage >::SetTimeStep ( const TimeStepType t)
inline

Set/Get the time step. For this class of anisotropic diffusion filters, the time-step is supplied by the user and remains fixed for all updates.

Definition at line 174 of file itkAnisotropicDiffusionFunction.h.

Member Data Documentation

template<class TImage >
const unsigned int itk::AnisotropicDiffusionFunction< TImage >::ImageDimension = Superclass::ImageDimension
static

Inherit some parameters from the superclass type

Definition at line 162 of file itkAnisotropicDiffusionFunction.h.

template<class TImage >
double itk::AnisotropicDiffusionFunction< TImage >::m_AverageGradientMagnitudeSquared
private

Definition at line 248 of file itkAnisotropicDiffusionFunction.h.

template<class TImage >
double itk::AnisotropicDiffusionFunction< TImage >::m_ConductanceParameter
private

Definition at line 249 of file itkAnisotropicDiffusionFunction.h.

template<class TImage >
TimeStepType itk::AnisotropicDiffusionFunction< TImage >::m_TimeStep
private

Definition at line 250 of file itkAnisotropicDiffusionFunction.h.


The documentation for this class was generated from the following file: