ITK  4.13.0
Insight Segmentation and Registration Toolkit
Public Types | Public Member Functions | Static Public Attributes | Protected 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<typename 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. Stable values for most 2D and 3D functions are 0.125 and 0.0625, respectively, when the pixel spacing is unity or is turned off. 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 139 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 override
 
const double & GetAverageGradientMagnitudeSquared () const
 
const double & GetConductanceParameter () const
 
virtual void * GetGlobalDataPointer () const override
 
virtual const char * GetNameOfClass () const
 
const TimeStepTypeGetTimeStep () const
 
virtual void ReleaseGlobalDataPointer (void *) const override
 
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 noexcept
 

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 override
 
 ~AnisotropicDiffusionFunction () override
 
- Protected Member Functions inherited from itk::FiniteDifferenceFunction< TImage >
 FiniteDifferenceFunction ()
 
 ~FiniteDifferenceFunction () override
 
- 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 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 Attributes inherited from itk::FiniteDifferenceFunction< TImage >
RadiusType m_Radius
 
PixelRealType m_ScaleCoefficients [ImageDimension]
 
- Protected Attributes inherited from itk::LightObject
AtomicInt< int > m_ReferenceCount
 

Member Typedef Documentation

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

Definition at line 148 of file itkAnisotropicDiffusionFunction.h.

template<typename TImage >
typedef Superclass::FloatOffsetType itk::AnisotropicDiffusionFunction< TImage >::FloatOffsetType

Definition at line 160 of file itkAnisotropicDiffusionFunction.h.

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

Inherit some parameters from the superclass type

Definition at line 151 of file itkAnisotropicDiffusionFunction.h.

Definition at line 158 of file itkAnisotropicDiffusionFunction.h.

template<typename TImage >
typedef Superclass::PixelRealType itk::AnisotropicDiffusionFunction< TImage >::PixelrealType

Definition at line 156 of file itkAnisotropicDiffusionFunction.h.

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

Definition at line 155 of file itkAnisotropicDiffusionFunction.h.

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

Definition at line 147 of file itkAnisotropicDiffusionFunction.h.

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

Definition at line 157 of file itkAnisotropicDiffusionFunction.h.

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

Standard class typedefs.

Definition at line 145 of file itkAnisotropicDiffusionFunction.h.

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

Definition at line 146 of file itkAnisotropicDiffusionFunction.h.

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

Definition at line 159 of file itkAnisotropicDiffusionFunction.h.

Constructor & Destructor Documentation

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

Definition at line 228 of file itkAnisotropicDiffusionFunction.h.

template<typename TImage >
itk::AnisotropicDiffusionFunction< TImage >::~AnisotropicDiffusionFunction ( )
inlineoverrideprotected

Definition at line 235 of file itkAnisotropicDiffusionFunction.h.

Member Function Documentation

template<typename 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<typename TImage >
virtual TimeStepType itk::AnisotropicDiffusionFunction< TImage >::ComputeGlobalTimeStep ( void *  ) const
inlineoverridevirtual

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 209 of file itkAnisotropicDiffusionFunction.h.

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

Set/Get the average gradient magnitude squared.

Definition at line 197 of file itkAnisotropicDiffusionFunction.h.

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

Definition at line 191 of file itkAnisotropicDiffusionFunction.h.

template<typename TImage >
virtual void* itk::AnisotropicDiffusionFunction< TImage >::GetGlobalDataPointer ( ) const
inlineoverridevirtual

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 216 of file itkAnisotropicDiffusionFunction.h.

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

Definition at line 180 of file itkAnisotropicDiffusionFunction.h.

template<typename TImage >
void itk::AnisotropicDiffusionFunction< TImage >::PrintSelf ( std::ostream &  os,
Indent  indent 
) const
inlineoverrideprotectedvirtual

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::FiniteDifferenceFunction< TImage >.

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

Definition at line 237 of file itkAnisotropicDiffusionFunction.h.

template<typename TImage >
virtual void itk::AnisotropicDiffusionFunction< TImage >::ReleaseGlobalDataPointer ( void *  ) const
inlineoverridevirtual

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

Implements itk::FiniteDifferenceFunction< TImage >.

Definition at line 222 of file itkAnisotropicDiffusionFunction.h.

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

Definition at line 202 of file itkAnisotropicDiffusionFunction.h.

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

Set/Get the conductance parameter. The conductance parameter.

Definition at line 186 of file itkAnisotropicDiffusionFunction.h.

template<typename 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 175 of file itkAnisotropicDiffusionFunction.h.

Member Data Documentation

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

Inherit some parameters from the superclass type

Definition at line 163 of file itkAnisotropicDiffusionFunction.h.

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

Definition at line 246 of file itkAnisotropicDiffusionFunction.h.

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

Definition at line 249 of file itkAnisotropicDiffusionFunction.h.

template<typename 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: