OpenVDB 12.0.0
 
Loading...
Searching...
No Matches
LevelSetTracker< GridT, InterruptT > Class Template Reference

Performs multi-threaded interface tracking of narrow band level sets. More...

#include <openvdb/tools/LevelSetTracker.h>

Classes

struct  State
 Lightweight struct that stores the state of the LevelSetTracker. More...
 

Public Types

using TrimMode = lstrack::TrimMode
 
using GridType = GridT
 
using TreeType = typename GridT::TreeType
 
using LeafType = typename TreeType::LeafNodeType
 
using ValueType = typename TreeType::ValueType
 
using LeafManagerType = typename tree::LeafManager<TreeType>
 
using LeafRange = typename LeafManagerType::LeafRange
 
using BufferType = typename LeafManagerType::BufferType
 
using MaskTreeType = typename TreeType::template ValueConverter<ValueMask>::Type
 

Public Member Functions

 LevelSetTracker (GridT &grid, InterruptT *interrupt=nullptr)
 Main constructor.
 
virtual ~LevelSetTracker ()
 
template<typename MaskType>
void normalize (const MaskType *mask)
 Iterative normalization, i.e. solving the Eikonal equation.
 
void normalize ()
 Iterative normalization, i.e. solving the Eikonal equation.
 
void track ()
 Track the level set interface, i.e. rebuild and normalize the narrow band of the level set.
 
void prune ()
 Set voxels that are outside the narrow band to the background value (if trimming is enabled) and prune the grid.
 
void dilate (int iterations=1)
 Fast but approximate dilation of the narrow band - one layer at a time. Normally we recommend using the resize method below which internally calls dilate (or erode) with the correct number of iterations to achieve the desired half voxel width of the narrow band (3 is recommended for most level set applications).
 
void erode (int iterations=1)
 Erodes the width of the narrow-band and update the background values.
 
bool resize (Index halfWidth=static_cast< Index >(LEVEL_SET_HALF_WIDTH))
 Resize the width of the narrow band, i.e. perform dilation and renormalization or erosion as required.
 
ValueType getHalfWidth () const
 Return the half width of the narrow band in floating-point voxel units.
 
State getState () const
 Return the state of the tracker (see struct defined above)
 
void setState (const State &s)
 Set the state of the tracker (see struct defined above)
 
math::BiasedGradientScheme getSpatialScheme () const
 
void setSpatialScheme (math::BiasedGradientScheme s)
 Set the spatial finite difference scheme.
 
math::TemporalIntegrationScheme getTemporalScheme () const
 
void setTemporalScheme (math::TemporalIntegrationScheme s)
 Set the spatial finite difference scheme.
 
int getNormCount () const
 
void setNormCount (int n)
 Set the number of normalizations performed per track or normalize call.
 
int getGrainSize () const
 
void setGrainSize (int grainsize)
 Set the grain-size used for multi-threading.
 
TrimMode trimming () const
 Return the trimming mode for voxels outside the narrow band.
 
void setTrimming (TrimMode mode)
 Specify whether to trim voxels outside the narrow band prior to pruning.
 
ValueType voxelSize () const
 
void startInterrupter (const char *msg)
 
void endInterrupter ()
 
bool checkInterrupter ()
 
const GridTypegrid () const
 
LeafManagerTypeleafs ()
 
const LeafManagerTypeleafs () const
 
template<typename MaskT>
void normalize (const MaskT *mask)
 

Detailed Description

template<typename GridT, typename InterruptT = util::NullInterrupter>
class openvdb::v12_0::tools::LevelSetTracker< GridT, InterruptT >

Performs multi-threaded interface tracking of narrow band level sets.

Member Typedef Documentation

◆ BufferType

template<typename GridT, typename InterruptT = util::NullInterrupter>
using BufferType = typename LeafManagerType::BufferType

◆ GridType

template<typename GridT, typename InterruptT = util::NullInterrupter>
using GridType = GridT

◆ LeafManagerType

template<typename GridT, typename InterruptT = util::NullInterrupter>
using LeafManagerType = typename tree::LeafManager<TreeType>

◆ LeafRange

template<typename GridT, typename InterruptT = util::NullInterrupter>
using LeafRange = typename LeafManagerType::LeafRange

◆ LeafType

template<typename GridT, typename InterruptT = util::NullInterrupter>
using LeafType = typename TreeType::LeafNodeType

◆ MaskTreeType

template<typename GridT, typename InterruptT = util::NullInterrupter>
using MaskTreeType = typename TreeType::template ValueConverter<ValueMask>::Type

◆ TreeType

template<typename GridT, typename InterruptT = util::NullInterrupter>
using TreeType = typename GridT::TreeType

◆ TrimMode

template<typename GridT, typename InterruptT = util::NullInterrupter>
using TrimMode = lstrack::TrimMode

◆ ValueType

template<typename GridT, typename InterruptT = util::NullInterrupter>
using ValueType = typename TreeType::ValueType

Constructor & Destructor Documentation

◆ LevelSetTracker()

template<typename GridT, typename InterruptT>
LevelSetTracker ( GridT & grid,
InterruptT * interrupt = nullptr )

Main constructor.

Exceptions
RuntimeErrorif the grid is not a level set

◆ ~LevelSetTracker()

template<typename GridT, typename InterruptT = util::NullInterrupter>
virtual ~LevelSetTracker ( )
inlinevirtual

Member Function Documentation

◆ checkInterrupter()

template<typename GridT, typename InterruptT>
bool checkInterrupter ( )
inline
Returns
false if the process was interrupted

◆ dilate()

template<typename GridT, typename InterruptT>
void dilate ( int iterations = 1)

Fast but approximate dilation of the narrow band - one layer at a time. Normally we recommend using the resize method below which internally calls dilate (or erode) with the correct number of iterations to achieve the desired half voxel width of the narrow band (3 is recommended for most level set applications).

Note
Since many level set applications perform interface-tracking, which in turn rebuilds the narrow-band accurately, this dilate method can often be used with a single iterations of low-order re-normalization. This effectively allows very narrow bands to be created from points or polygons (e.g. with a half voxel width of 1), followed by a fast but approximate dilation (typically with a half voxel width of 3). This can be significantly faster than generating the final width of the narrow band from points or polygons.

◆ endInterrupter()

template<typename GridT, typename InterruptT>
void endInterrupter ( )
inline

◆ erode()

template<typename GridT, typename InterruptT>
void erode ( int iterations = 1)

Erodes the width of the narrow-band and update the background values.

Exceptions
ValueErrorif iterations is larger than the current half-width.

◆ getGrainSize()

template<typename GridT, typename InterruptT = util::NullInterrupter>
int getGrainSize ( ) const
inline
Returns
the grain-size used for multi-threading

◆ getHalfWidth()

template<typename GridT, typename InterruptT = util::NullInterrupter>
ValueType getHalfWidth ( ) const
inline

Return the half width of the narrow band in floating-point voxel units.

◆ getNormCount()

template<typename GridT, typename InterruptT = util::NullInterrupter>
int getNormCount ( ) const
inline
Returns
The number of normalizations performed per track or normalize call.

◆ getSpatialScheme()

template<typename GridT, typename InterruptT = util::NullInterrupter>
math::BiasedGradientScheme getSpatialScheme ( ) const
inline
Returns
the spatial finite difference scheme

◆ getState()

template<typename GridT, typename InterruptT = util::NullInterrupter>
State getState ( ) const
inline

Return the state of the tracker (see struct defined above)

◆ getTemporalScheme()

template<typename GridT, typename InterruptT = util::NullInterrupter>
math::TemporalIntegrationScheme getTemporalScheme ( ) const
inline
Returns
the temporal integration scheme

◆ grid()

template<typename GridT, typename InterruptT = util::NullInterrupter>
const GridType & grid ( ) const
inline

◆ leafs() [1/2]

template<typename GridT, typename InterruptT = util::NullInterrupter>
LeafManagerType & leafs ( )
inline

◆ leafs() [2/2]

template<typename GridT, typename InterruptT = util::NullInterrupter>
const LeafManagerType & leafs ( ) const
inline

◆ normalize() [1/3]

template<typename GridT, typename InterruptT = util::NullInterrupter>
void normalize ( )
inline

Iterative normalization, i.e. solving the Eikonal equation.

◆ normalize() [2/3]

template<typename GridT, typename InterruptT = util::NullInterrupter>
template<typename MaskT>
void normalize ( const MaskT * mask)

◆ normalize() [3/3]

template<typename GridT, typename InterruptT = util::NullInterrupter>
template<typename MaskType>
void normalize ( const MaskType * mask)

Iterative normalization, i.e. solving the Eikonal equation.

Note
The mask it optional and by default it is ignored.

◆ prune()

template<typename GridT, typename InterruptT>
void prune ( )

Set voxels that are outside the narrow band to the background value (if trimming is enabled) and prune the grid.

Pruning is done automatically as a step in tracking.

See also
setTrimming, trimming

◆ resize()

template<typename GridT, typename InterruptT>
bool resize ( Index halfWidth = static_cast<Index>(LEVEL_SET_HALF_WIDTH))

Resize the width of the narrow band, i.e. perform dilation and renormalization or erosion as required.

◆ setGrainSize()

template<typename GridT, typename InterruptT = util::NullInterrupter>
void setGrainSize ( int grainsize)
inline

Set the grain-size used for multi-threading.

Note
A grainsize of 0 or less disables multi-threading!

◆ setNormCount()

template<typename GridT, typename InterruptT = util::NullInterrupter>
void setNormCount ( int n)
inline

Set the number of normalizations performed per track or normalize call.

◆ setSpatialScheme()

template<typename GridT, typename InterruptT = util::NullInterrupter>
void setSpatialScheme ( math::BiasedGradientScheme s)
inline

Set the spatial finite difference scheme.

◆ setState()

template<typename GridT, typename InterruptT = util::NullInterrupter>
void setState ( const State & s)
inline

Set the state of the tracker (see struct defined above)

◆ setTemporalScheme()

template<typename GridT, typename InterruptT = util::NullInterrupter>
void setTemporalScheme ( math::TemporalIntegrationScheme s)
inline

Set the spatial finite difference scheme.

◆ setTrimming()

template<typename GridT, typename InterruptT = util::NullInterrupter>
void setTrimming ( TrimMode mode)
inline

Specify whether to trim voxels outside the narrow band prior to pruning.

See also
trimming, prune

◆ startInterrupter()

template<typename GridT, typename InterruptT>
void startInterrupter ( const char * msg)
inline

◆ track()

template<typename GridT, typename InterruptT>
void track ( )

Track the level set interface, i.e. rebuild and normalize the narrow band of the level set.

◆ trimming()

template<typename GridT, typename InterruptT = util::NullInterrupter>
TrimMode trimming ( ) const
inline

Return the trimming mode for voxels outside the narrow band.

Trimming is enabled by default and is applied automatically prior to pruning.

See also
setTrimming, prune

◆ voxelSize()

template<typename GridT, typename InterruptT = util::NullInterrupter>
ValueType voxelSize ( ) const
inline