ITK  6.0.0 Insight Toolkit
itk::LevelSetFunction< TImageType > Class Template Reference

#include <itkLevelSetFunction.h>

## Detailed Description

### template<typename TImageType> class itk::LevelSetFunction< TImageType >

The LevelSetFunction class is a generic function object which can be used to create a level set method filter when combined with an appropriate finite difference image filter. (See FiniteDifferenceImageFilter.)

LevelSetFunction implements a generic level set function. This function is an expanded form of the basic equation developed in [1].

$$\phi_{t} + \alpha \stackrel{\rightharpoonup}{A}(\mathbf{x})\cdot\nabla\phi + \beta P(\mathbf{x})\mid\nabla\phi\mid = \gamma Z(\mathbf{x})\kappa\mid\nabla\phi\mid$$

where $$\stackrel{\rightharpoonup}{A}$$ is an advection term, $$P$$ is a propagation (growth) term, and $$Z$$ is a spatial modifier term for the mean curvature $$\kappa$$. $$\alpha$$, $$\beta$$, and $$\gamma$$ are all scalar constants.

Terms in the equation above are supplied through virtual methods, which must be subclassed to complete an implementation. Terms can be eliminated from the equation by setting the corresponding constants to zero. A wide variety of level set methods can be implemented by subclassing this basic equation.

In ITK, the usual sign convention is that the INSIDE of a surface contains NEGATIVE values and the OUTSIDE of the surface contains POSITIVE values.

Warning
You MUST call Initialize() in the constructor of subclasses of this object to set it up properly to do level-set Calculations. The argument that you pass Initialize is the radius of the neighborhood needed to perform the calculations. If your subclass does not do any additional neighborhood processing, then the default radius should be 1 in each direction.
REFERENCES
[1] Sethian, J.A. Level Set Methods. Cambridge University Press. 1996.

Definition at line 66 of file itkLevelSetFunction.h.

Inheritance diagram for itk::LevelSetFunction< TImageType >:
Collaboration diagram for itk::LevelSetFunction< TImageType >:

## Classes

struct  GlobalDataStruct

## Public Types

using ConstPointer = SmartPointer< const Self >

using Pointer = SmartPointer< Self >

using ScalarValueType = PixelType

using Self = LevelSetFunction

using Superclass = FiniteDifferenceFunction< TImageType >

using TimeStepType = double

using VectorType = FixedArray< ScalarValueType, Self::ImageDimension >

Public Types inherited from itk::FiniteDifferenceFunction< TImageType >
using ConstPointer = SmartPointer< const Self >

using DefaultBoundaryConditionType = ZeroFluxNeumannBoundaryCondition< ImageType >

using FloatOffsetType = Vector< float, Self::ImageDimension >

using ImageType = TImageType

using NeighborhoodScalesType = Vector< PixelRealType, Self::ImageDimension >

using NeighborhoodType = ConstNeighborhoodIterator< TImageType, DefaultBoundaryConditionType >

using PixelRealType = double

using PixelType = typename ImageType::PixelType

using Pointer = SmartPointer< Self >

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 VectorType AdvectionField (const NeighborhoodType &, const FloatOffsetType &, GlobalDataStruct *=0) const

virtual ScalarValueType Compute3DMinimalCurvature (const NeighborhoodType &, const FloatOffsetType &, GlobalDataStruct *gd=0)

virtual ScalarValueType ComputeCurvatureTerm (const NeighborhoodType &, const FloatOffsetType &, GlobalDataStruct *gd=0)

TimeStepType ComputeGlobalTimeStep (void *GlobalData) const override

virtual ScalarValueType ComputeMeanCurvature (const NeighborhoodType &, const FloatOffsetType &, GlobalDataStruct *gd=0)

virtual ScalarValueType ComputeMinimalCurvature (const NeighborhoodType &, const FloatOffsetType &, GlobalDataStruct *gd=0)

PixelType ComputeUpdate (const NeighborhoodType &it, void *globalData, const FloatOffsetType &=FloatOffsetType(0.0)) override

virtual ScalarValueType CurvatureSpeed (const NeighborhoodType &, const FloatOffsetType &, GlobalDataStruct *=nullptr) const

void * GetGlobalDataPointer () const override

const char * GetNameOfClass () const override

bool GetUseMinimalCurvature () const

virtual void Initialize (const RadiusType &r)

virtual ScalarValueType LaplacianSmoothingSpeed (const NeighborhoodType &, const FloatOffsetType &, GlobalDataStruct *=0) const

virtual ScalarValueType PropagationSpeed (const NeighborhoodType &, const FloatOffsetType &, GlobalDataStruct *=0) const

void ReleaseGlobalDataPointer (void *GlobalData) const override

void SetUseMinimalCurvature (bool b)

void UseMinimalCurvatureOff ()

void UseMinimalCurvatureOn ()

virtual void SetAdvectionWeight (const ScalarValueType a)

virtual void SetPropagationWeight (const ScalarValueType p)

ScalarValueType GetPropagationWeight () const

virtual void SetCurvatureWeight (const ScalarValueType c)

ScalarValueType GetCurvatureWeight () const

void SetLaplacianSmoothingWeight (const ScalarValueType c)

ScalarValueType GetLaplacianSmoothingWeight () const

void SetEpsilonMagnitude (const ScalarValueType e)

ScalarValueType GetEpsilonMagnitude () const

Public Member Functions inherited from itk::FiniteDifferenceFunction< TImageType >
const NeighborhoodScalesType ComputeNeighborhoodScales () const

void GetScaleCoefficients (PixelRealType vals[ImageDimension]) const

virtual void InitializeIteration ()

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 Member Functions

static double GetMaximumCurvatureTimeStep ()

static double GetMaximumPropagationTimeStep ()

static Pointer New ()

static void SetMaximumCurvatureTimeStep (double n)

static void SetMaximumPropagationTimeStep (double n)

Static Public Member Functions inherited from itk::LightObject
static void BreakOnError ()

static Pointer New ()

## Static Public Attributes

static constexpr unsigned int ImageDimension = Superclass::ImageDimension

Static Public Attributes inherited from itk::FiniteDifferenceFunction< TImageType >
static constexpr unsigned int ImageDimension = ImageType::ImageDimension

## Protected Member Functions

LevelSetFunction ()

void PrintSelf (std::ostream &os, Indent indent) const override

~LevelSetFunction () override=default

Protected Member Functions inherited from itk::FiniteDifferenceFunction< TImageType >
FiniteDifferenceFunction ()

~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 ()

## Static Protected Member Functions

static VectorType InitializeZeroVectorConstant ()

## Protected Attributes

OffsetValueType m_Center { 0 }

ScalarValueType m_CurvatureWeight {}

ScalarValueType m_EpsilonMagnitude {}

ScalarValueType m_LaplacianSmoothingWeight {}

ScalarValueType m_PropagationWeight {}

bool m_UseMinimalCurvature { false }

OffsetValueType m_xStride [Self::ImageDimension] {}

std::slice x_slice [Self::ImageDimension]

Protected Attributes inherited from itk::FiniteDifferenceFunction< TImageType >

PixelRealType m_ScaleCoefficients [ImageDimension] {}

Protected Attributes inherited from itk::LightObject
std::atomic< int > m_ReferenceCount {}

## Static Protected Attributes

static double m_DT

static double m_WaveDT

static VectorType m_ZeroVectorConstant

## ◆ ConstPointer

template<typename TImageType >
 using itk::LevelSetFunction< TImageType >::ConstPointer = SmartPointer

Definition at line 75 of file itkLevelSetFunction.h.

## ◆ Pointer

template<typename TImageType >
 using itk::LevelSetFunction< TImageType >::Pointer = SmartPointer

Definition at line 74 of file itkLevelSetFunction.h.

## ◆ ScalarValueType

template<typename TImageType >
 using itk::LevelSetFunction< TImageType >::ScalarValueType = PixelType

Definition at line 90 of file itkLevelSetFunction.h.

## ◆ Self

template<typename TImageType >
 using itk::LevelSetFunction< TImageType >::Self = LevelSetFunction

Standard class type aliases.

Definition at line 72 of file itkLevelSetFunction.h.

## ◆ Superclass

template<typename TImageType >
 using itk::LevelSetFunction< TImageType >::Superclass = FiniteDifferenceFunction

Definition at line 73 of file itkLevelSetFunction.h.

## ◆ TimeStepType

template<typename TImageType >
 using itk::LevelSetFunction< TImageType >::TimeStepType = double

Convenient type alias.

Definition at line 87 of file itkLevelSetFunction.h.

## ◆ VectorType

template<typename TImageType >
 using itk::LevelSetFunction< TImageType >::VectorType = FixedArray

The vector type that will be used in the calculations.

Definition at line 99 of file itkLevelSetFunction.h.

## ◆ LevelSetFunction()

template<typename TImageType >
 itk::LevelSetFunction< TImageType >::LevelSetFunction ( )
inlineprotected

Definition at line 340 of file itkLevelSetFunction.h.

## ◆ ~LevelSetFunction()

template<typename TImageType >
 itk::LevelSetFunction< TImageType >::~LevelSetFunction ( )
overrideprotecteddefault

## Member Function Documentation

template<typename TImageType >
 virtual VectorType itk::LevelSetFunction< TImageType >::AdvectionField ( const NeighborhoodType & , const FloatOffsetType & , GlobalDataStruct * = 0 ) const
inlinevirtual

Advection field. Default implementation returns a vector of zeros.

Reimplemented in itk::SegmentationLevelSetFunction< TImageType, TFeatureImageType >.

Definition at line 126 of file itkLevelSetFunction.h.

## ◆ Compute3DMinimalCurvature()

template<typename TImageType >
 virtual ScalarValueType itk::LevelSetFunction< TImageType >::Compute3DMinimalCurvature ( const NeighborhoodType & , const FloatOffsetType & , GlobalDataStruct * gd = 0 )
virtual

## ◆ ComputeCurvatureTerm()

template<typename TImageType >
 virtual ScalarValueType itk::LevelSetFunction< TImageType >::ComputeCurvatureTerm ( const NeighborhoodType & , const FloatOffsetType & , GlobalDataStruct * gd = 0 )
virtual

## ◆ ComputeGlobalTimeStep()

template<typename TImageType >
 TimeStepType itk::LevelSetFunction< TImageType >::ComputeGlobalTimeStep ( void * GlobalData ) const
overridevirtual

Computes the time step for an update given a global data structure. The data used in the computation may take different forms depending on the nature of the equations. This global data cannot be kept in the instance of the equation object itself since the equation object must remain stateless for thread safety. The global data is therefore managed for each thread by the finite difference solver filters.

Implements itk::FiniteDifferenceFunction< TImageType >.

## ◆ ComputeMeanCurvature()

template<typename TImageType >
 virtual ScalarValueType itk::LevelSetFunction< TImageType >::ComputeMeanCurvature ( const NeighborhoodType & , const FloatOffsetType & , GlobalDataStruct * gd = 0 )
virtual

## ◆ ComputeMinimalCurvature()

template<typename TImageType >
 virtual ScalarValueType itk::LevelSetFunction< TImageType >::ComputeMinimalCurvature ( const NeighborhoodType & , const FloatOffsetType & , GlobalDataStruct * gd = 0 )
virtual

## ◆ ComputeUpdate()

template<typename TImageType >
 PixelType itk::LevelSetFunction< TImageType >::ComputeUpdate ( const NeighborhoodType & it, void * globalData, const FloatOffsetType & = FloatOffsetType(0.0) )
overridevirtual

Compute the equation value.

Implements itk::FiniteDifferenceFunction< TImageType >.

## ◆ CurvatureSpeed()

template<typename TImageType >
 virtual ScalarValueType itk::LevelSetFunction< TImageType >::CurvatureSpeed ( const NeighborhoodType & , const FloatOffsetType & , GlobalDataStruct * = nullptr ) const
inlinevirtual

Curvature speed. Can be used to spatially modify the effects of curvature . The default implementation returns one.

Definition at line 142 of file itkLevelSetFunction.h.

References itk::NumericTraits< T >::OneValue().

template<typename TImageType >
 ScalarValueType itk::LevelSetFunction< TImageType >::GetAdvectionWeight ( ) const
inline

Alpha. Scales all advection term values.

Definition at line 162 of file itkLevelSetFunction.h.

## ◆ GetCurvatureWeight()

template<typename TImageType >
 ScalarValueType itk::LevelSetFunction< TImageType >::GetCurvatureWeight ( ) const
inline

Gamma. Scales all curvature weight values

Definition at line 188 of file itkLevelSetFunction.h.

## ◆ GetEpsilonMagnitude()

template<typename TImageType >
 ScalarValueType itk::LevelSetFunction< TImageType >::GetEpsilonMagnitude ( ) const
inline

Epsilon.

Definition at line 214 of file itkLevelSetFunction.h.

## ◆ GetGlobalDataPointer()

template<typename TImageType >
 void* itk::LevelSetFunction< TImageType >::GetGlobalDataPointer ( ) const
inlineoverridevirtual

Returns a pointer to a global data structure that is passed to this object from the solver at each calculation. The idea is that the solver holds the state of any global values needed to calculate the time step, while the equation object performs the actual calculations. The global data should also be initialized in this method. Global data can be used for caching any values used or reused by the FunctionObject. Each thread should receive its own global data struct.

Implements itk::FiniteDifferenceFunction< TImageType >.

Definition at line 243 of file itkLevelSetFunction.h.

## ◆ GetLaplacianSmoothingWeight()

template<typename TImageType >
 ScalarValueType itk::LevelSetFunction< TImageType >::GetLaplacianSmoothingWeight ( ) const
inline

Weight of the laplacian smoothing term

Definition at line 201 of file itkLevelSetFunction.h.

## ◆ GetMaximumCurvatureTimeStep()

template<typename TImageType >
 static double itk::LevelSetFunction< TImageType >::GetMaximumCurvatureTimeStep ( )
inlinestatic

Definition at line 318 of file itkLevelSetFunction.h.

## ◆ GetMaximumPropagationTimeStep()

template<typename TImageType >
 static double itk::LevelSetFunction< TImageType >::GetMaximumPropagationTimeStep ( )
inlinestatic

Definition at line 334 of file itkLevelSetFunction.h.

## ◆ GetNameOfClass()

template<typename TImageType >
 const char* itk::LevelSetFunction< TImageType >::GetNameOfClass ( ) const
overridevirtual

## ◆ GetPropagationWeight()

template<typename TImageType >
 ScalarValueType itk::LevelSetFunction< TImageType >::GetPropagationWeight ( ) const
inline

Beta. Scales all propagation term values.

Definition at line 175 of file itkLevelSetFunction.h.

## ◆ GetUseMinimalCurvature()

template<typename TImageType >
 bool itk::LevelSetFunction< TImageType >::GetUseMinimalCurvature ( ) const
inline

Definition at line 290 of file itkLevelSetFunction.h.

## ◆ Initialize()

template<typename TImageType >
 virtual void itk::LevelSetFunction< TImageType >::Initialize ( const RadiusType & r )
virtual

This method creates the appropriate member variable operators for the level-set calculations. The argument to this function is a the radius necessary for performing the level-set calculations.

## ◆ InitializeZeroVectorConstant()

template<typename TImageType >
 static VectorType itk::LevelSetFunction< TImageType >::InitializeZeroVectorConstant ( )
staticprotected

This method's only purpose is to initialize the zero vector constant.

## ◆ LaplacianSmoothingSpeed()

template<typename TImageType >
 virtual ScalarValueType itk::LevelSetFunction< TImageType >::LaplacianSmoothingSpeed ( const NeighborhoodType & , const FloatOffsetType & , GlobalDataStruct * = 0 ) const
inlinevirtual

Laplacian smoothing speed. Can be used to spatially modify the effects of laplacian smoothing of the level set function

Definition at line 150 of file itkLevelSetFunction.h.

References itk::NumericTraits< T >::OneValue().

## ◆ New()

template<typename TImageType >
 static Pointer itk::LevelSetFunction< TImageType >::New ( )
static

Method for creation through the object factory.

## ◆ PrintSelf()

template<typename TImageType >
 void itk::LevelSetFunction< TImageType >::PrintSelf ( std::ostream & os, Indent indent ) const
overrideprotectedvirtual

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< TImageType >.

## ◆ PropagationSpeed()

template<typename TImageType >
 virtual ScalarValueType itk::LevelSetFunction< TImageType >::PropagationSpeed ( const NeighborhoodType & , const FloatOffsetType & , GlobalDataStruct * = 0 ) const
inlinevirtual

Propagation speed. This term controls surface expansion/contraction. Default implementation returns zero.

Definition at line 134 of file itkLevelSetFunction.h.

## ◆ ReleaseGlobalDataPointer()

template<typename TImageType >
 void itk::LevelSetFunction< TImageType >::ReleaseGlobalDataPointer ( void * GlobalData ) const
inlineoverridevirtual

When the finite difference solver filter has finished using a global data pointer, it passes it to this method, which frees the memory. The solver cannot free the memory because it does not know the type to which the pointer points.

Implements itk::FiniteDifferenceFunction< TImageType >.

Definition at line 264 of file itkLevelSetFunction.h.

template<typename TImageType >
 virtual void itk::LevelSetFunction< TImageType >::SetAdvectionWeight ( const ScalarValueType a )
inlinevirtual

Alpha. Scales all advection term values.

Definition at line 157 of file itkLevelSetFunction.h.

## ◆ SetCurvatureWeight()

template<typename TImageType >
 virtual void itk::LevelSetFunction< TImageType >::SetCurvatureWeight ( const ScalarValueType c )
inlinevirtual

Gamma. Scales all curvature weight values

Definition at line 183 of file itkLevelSetFunction.h.

## ◆ SetEpsilonMagnitude()

template<typename TImageType >
 void itk::LevelSetFunction< TImageType >::SetEpsilonMagnitude ( const ScalarValueType e )
inline

Epsilon.

Definition at line 209 of file itkLevelSetFunction.h.

References itk::Math::e.

## ◆ SetLaplacianSmoothingWeight()

template<typename TImageType >
 void itk::LevelSetFunction< TImageType >::SetLaplacianSmoothingWeight ( const ScalarValueType c )
inline

Weight of the laplacian smoothing term

Definition at line 196 of file itkLevelSetFunction.h.

## ◆ SetMaximumCurvatureTimeStep()

template<typename TImageType >
 static void itk::LevelSetFunction< TImageType >::SetMaximumCurvatureTimeStep ( double n )
inlinestatic

Set/Get the maximum constraint for the curvature term factor in the time step calculation. Changing this value from the default is not recommended or necessary, but can be used to speed up the surface evolution at the risk of creating an unstable solution.

Definition at line 312 of file itkLevelSetFunction.h.

## ◆ SetMaximumPropagationTimeStep()

template<typename TImageType >
 static void itk::LevelSetFunction< TImageType >::SetMaximumPropagationTimeStep ( double n )
inlinestatic

Set/Get the maximum constraint for the scalar/vector term factor of the time step calculation. Changing this value from the default is not recommended or necessary, but can be used to speed up the surface evolution at the risk of creating an unstable solution.

Definition at line 328 of file itkLevelSetFunction.h.

## ◆ SetPropagationWeight()

template<typename TImageType >
 virtual void itk::LevelSetFunction< TImageType >::SetPropagationWeight ( const ScalarValueType p )
inlinevirtual

Beta. Scales all propagation term values.

Definition at line 170 of file itkLevelSetFunction.h.

## ◆ SetUseMinimalCurvature()

template<typename TImageType >
 void itk::LevelSetFunction< TImageType >::SetUseMinimalCurvature ( bool b )
inline

Definition at line 284 of file itkLevelSetFunction.h.

## ◆ UseMinimalCurvatureOff()

template<typename TImageType >
 void itk::LevelSetFunction< TImageType >::UseMinimalCurvatureOff ( )
inline

Definition at line 302 of file itkLevelSetFunction.h.

## ◆ UseMinimalCurvatureOn()

template<typename TImageType >
 void itk::LevelSetFunction< TImageType >::UseMinimalCurvatureOn ( )
inline

Definition at line 296 of file itkLevelSetFunction.h.

## ◆ ImageDimension

template<typename TImageType >
 constexpr unsigned int itk::LevelSetFunction< TImageType >::ImageDimension = Superclass::ImageDimension
staticconstexpr

Extract some parameters from the superclass.

Definition at line 84 of file itkLevelSetFunction.h.

template<typename TImageType >
protected

Alpha.

Definition at line 379 of file itkLevelSetFunction.h.

## ◆ m_Center

template<typename TImageType >
 OffsetValueType itk::LevelSetFunction< TImageType >::m_Center { 0 }
protected

The offset of the center pixel in the neighborhood.

Definition at line 360 of file itkLevelSetFunction.h.

## ◆ m_CurvatureWeight

template<typename TImageType >
 ScalarValueType itk::LevelSetFunction< TImageType >::m_CurvatureWeight {}
protected

Gamma.

Definition at line 385 of file itkLevelSetFunction.h.

## ◆ m_DT

template<typename TImageType >
 double itk::LevelSetFunction< TImageType >::m_DT
staticprotected

Definition at line 354 of file itkLevelSetFunction.h.

## ◆ m_EpsilonMagnitude

template<typename TImageType >
 ScalarValueType itk::LevelSetFunction< TImageType >::m_EpsilonMagnitude {}
protected

Epsilon magnitude controls the lower limit for gradient magnitude.

Definition at line 376 of file itkLevelSetFunction.h.

## ◆ m_LaplacianSmoothingWeight

template<typename TImageType >
 ScalarValueType itk::LevelSetFunction< TImageType >::m_LaplacianSmoothingWeight {}
protected

Laplacian smoothing term

Definition at line 388 of file itkLevelSetFunction.h.

## ◆ m_PropagationWeight

template<typename TImageType >
 ScalarValueType itk::LevelSetFunction< TImageType >::m_PropagationWeight {}
protected

Beta.

Definition at line 382 of file itkLevelSetFunction.h.

## ◆ m_UseMinimalCurvature

template<typename TImageType >
 bool itk::LevelSetFunction< TImageType >::m_UseMinimalCurvature { false }
protected

Definition at line 365 of file itkLevelSetFunction.h.

## ◆ m_WaveDT

template<typename TImageType >
 double itk::LevelSetFunction< TImageType >::m_WaveDT
staticprotected

Constants used in the time step calculation.

Definition at line 353 of file itkLevelSetFunction.h.

## ◆ m_xStride

template<typename TImageType >
 OffsetValueType itk::LevelSetFunction< TImageType >::m_xStride[Self::ImageDimension] {}
protected

Stride length along the y-dimension.

Definition at line 363 of file itkLevelSetFunction.h.

## ◆ m_ZeroVectorConstant

template<typename TImageType >
 VectorType itk::LevelSetFunction< TImageType >::m_ZeroVectorConstant
staticprotected

Zero vector constant.

Definition at line 373 of file itkLevelSetFunction.h.

## ◆ x_slice

template<typename TImageType >
 std::slice itk::LevelSetFunction< TImageType >::x_slice[Self::ImageDimension]
protected

Slices for the ND neighborhood.

Definition at line 357 of file itkLevelSetFunction.h.

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