ITK  5.2.0
Insight Toolkit
Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Private Attributes | List of all members

#include <itkAnisotropicDiffusionFunction.h>

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

Public Types

using ConstPointer = SmartPointer< const Self >
 
using FloatOffsetType = typename Superclass::FloatOffsetType
 
using ImageType = typename Superclass::ImageType
 
using NeighborhoodType = typename Superclass::NeighborhoodType
 
using PixelrealType = typename Superclass::PixelRealType
 
using PixelType = typename Superclass::PixelType
 
using Pointer = SmartPointer< Self >
 
using RadiusType = typename Superclass::RadiusType
 
using Self = AnisotropicDiffusionFunction
 
using Superclass = FiniteDifferenceFunction< TImage >
 
using TimeStepType = typename Superclass::TimeStepType
 
- Public Types inherited from itk::FiniteDifferenceFunction< TImage >
using ConstPointer = SmartPointer< const Self >
 
using DefaultBoundaryConditionType = ZeroFluxNeumannBoundaryCondition< ImageType >
 
using FloatOffsetType = Vector< float, Self::ImageDimension >
 
using ImageType = TImage
 
using NeighborhoodScalesType = Vector< PixelRealType, Self::ImageDimension >
 
using NeighborhoodType = ConstNeighborhoodIterator< TImage, DefaultBoundaryConditionType >
 
using PixelRealType = double
 
using PixelType = typename ImageType::PixelType
 
using Pointer = SmartPointer< Self >
 
using RadiusType = typename ConstNeighborhoodIterator< TImage >::RadiusType
 
using Self = FiniteDifferenceFunction
 
using Superclass = LightObject
 
using TimeStepType = double
 
- Public Types inherited from itk::LightObject
using ConstPointer = SmartPointer< const Self >
 
using Pointer = SmartPointer< Self >
 
using Self = LightObject
 

Public Member Functions

virtual void CalculateAverageGradientMagnitudeSquared (ImageType *)=0
 
TimeStepType ComputeGlobalTimeStep (void *) const override
 
const double & GetAverageGradientMagnitudeSquared () const
 
const double & GetConductanceParameter () const
 
void * GetGlobalDataPointer () const override
 
virtual const char * GetNameOfClass () const
 
const TimeStepTypeGetTimeStep () const
 
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 (const PixelRealType vals[ImageDimension])
 
- Public Member Functions inherited from itk::LightObject
Pointer Clone () const
 
virtual Pointer CreateAnother () const
 
virtual void Delete ()
 
virtual int GetReferenceCount () const
 
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 constexpr unsigned int ImageDimension = Superclass::ImageDimension
 
- Static Public Attributes inherited from itk::FiniteDifferenceFunction< TImage >
static constexpr unsigned int ImageDimension
 

Protected Member Functions

 AnisotropicDiffusionFunction ()
 
void PrintSelf (std::ostream &os, Indent indent) const override
 
 ~AnisotropicDiffusionFunction () override=default
 
- Protected Member Functions inherited from itk::FiniteDifferenceFunction< TImage >
 FiniteDifferenceFunction ()
 
void PrintSelf (std::ostream &os, Indent indent) const override
 
 ~FiniteDifferenceFunction () override=default
 
- 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
std::atomic< int > m_ReferenceCount
 

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 possible, 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.

Member Typedef Documentation

◆ ConstPointer

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

Definition at line 149 of file itkAnisotropicDiffusionFunction.h.

◆ FloatOffsetType

template<typename TImage >
using itk::AnisotropicDiffusionFunction< TImage >::FloatOffsetType = typename Superclass::FloatOffsetType

Definition at line 161 of file itkAnisotropicDiffusionFunction.h.

◆ ImageType

template<typename TImage >
using itk::AnisotropicDiffusionFunction< TImage >::ImageType = typename Superclass::ImageType

Inherit some parameters from the superclass type

Definition at line 155 of file itkAnisotropicDiffusionFunction.h.

◆ NeighborhoodType

template<typename TImage >
using itk::AnisotropicDiffusionFunction< TImage >::NeighborhoodType = typename Superclass::NeighborhoodType

Definition at line 159 of file itkAnisotropicDiffusionFunction.h.

◆ PixelrealType

template<typename TImage >
using itk::AnisotropicDiffusionFunction< TImage >::PixelrealType = typename Superclass::PixelRealType

Definition at line 157 of file itkAnisotropicDiffusionFunction.h.

◆ PixelType

template<typename TImage >
using itk::AnisotropicDiffusionFunction< TImage >::PixelType = typename Superclass::PixelType

Definition at line 156 of file itkAnisotropicDiffusionFunction.h.

◆ Pointer

template<typename TImage >
using itk::AnisotropicDiffusionFunction< TImage >::Pointer = SmartPointer<Self>

Definition at line 148 of file itkAnisotropicDiffusionFunction.h.

◆ RadiusType

template<typename TImage >
using itk::AnisotropicDiffusionFunction< TImage >::RadiusType = typename Superclass::RadiusType

Definition at line 158 of file itkAnisotropicDiffusionFunction.h.

◆ Self

template<typename TImage >
using itk::AnisotropicDiffusionFunction< TImage >::Self = AnisotropicDiffusionFunction

Standard class type aliases.

Definition at line 146 of file itkAnisotropicDiffusionFunction.h.

◆ Superclass

template<typename TImage >
using itk::AnisotropicDiffusionFunction< TImage >::Superclass = FiniteDifferenceFunction<TImage>

Definition at line 147 of file itkAnisotropicDiffusionFunction.h.

◆ TimeStepType

template<typename TImage >
using itk::AnisotropicDiffusionFunction< TImage >::TimeStepType = typename Superclass::TimeStepType

Definition at line 160 of file itkAnisotropicDiffusionFunction.h.

Constructor & Destructor Documentation

◆ AnisotropicDiffusionFunction()

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

Definition at line 239 of file itkAnisotropicDiffusionFunction.h.

◆ ~AnisotropicDiffusionFunction()

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

Member Function Documentation

◆ CalculateAverageGradientMagnitudeSquared()

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.

◆ ComputeGlobalTimeStep()

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

◆ GetAverageGradientMagnitudeSquared()

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

Set/Get the average gradient magnitude squared.

Definition at line 204 of file itkAnisotropicDiffusionFunction.h.

◆ GetConductanceParameter()

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

Definition at line 197 of file itkAnisotropicDiffusionFunction.h.

◆ GetGlobalDataPointer()

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

◆ GetNameOfClass()

template<typename TImage >
virtual const char* itk::AnisotropicDiffusionFunction< TImage >::GetNameOfClass ( ) const
virtual

◆ GetTimeStep()

template<typename TImage >
const TimeStepType& itk::AnisotropicDiffusionFunction< TImage >::GetTimeStep ( ) const
inline

Definition at line 184 of file itkAnisotropicDiffusionFunction.h.

◆ PrintSelf()

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::LightObject.

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

Definition at line 249 of file itkAnisotropicDiffusionFunction.h.

◆ ReleaseGlobalDataPointer()

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

◆ SetAverageGradientMagnitudeSquared()

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

Definition at line 210 of file itkAnisotropicDiffusionFunction.h.

◆ SetConductanceParameter()

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

Set/Get the conductance parameter. The conductance parameter.

Definition at line 191 of file itkAnisotropicDiffusionFunction.h.

◆ SetTimeStep()

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

Member Data Documentation

◆ ImageDimension

template<typename TImage >
constexpr unsigned int itk::AnisotropicDiffusionFunction< TImage >::ImageDimension = Superclass::ImageDimension
staticconstexpr

Inherit some parameters from the superclass type

Definition at line 164 of file itkAnisotropicDiffusionFunction.h.

◆ m_AverageGradientMagnitudeSquared

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

Definition at line 257 of file itkAnisotropicDiffusionFunction.h.

◆ m_ConductanceParameter

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

Definition at line 258 of file itkAnisotropicDiffusionFunction.h.

◆ m_TimeStep

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

Definition at line 259 of file itkAnisotropicDiffusionFunction.h.


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