HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
openvdb::OPENVDB_VERSION_NAME::tools::LevelSetFilter< GridT, MaskT, InterruptT > Class Template Reference

Filtering (e.g. diffusion) of narrow-band level sets. An optional scalar field can be used to produce a (smooth) alpha mask for the filtering. More...

#include <LevelSetFilter.h>

+ Inheritance diagram for openvdb::OPENVDB_VERSION_NAME::tools::LevelSetFilter< GridT, MaskT, InterruptT >:

Public Types

using BaseType = LevelSetTracker< GridT, InterruptT >
 
using GridType = GridT
 
using MaskType = MaskT
 
using TreeType = typename GridType::TreeType
 
using ValueType = typename TreeType::ValueType
 
using AlphaType = typename MaskType::ValueType
 
- Public Types inherited from openvdb::OPENVDB_VERSION_NAME::tools::LevelSetTracker< GridT, InterruptT >
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

 LevelSetFilter (GridType &grid, InterruptT *interrupt=nullptr)
 Main constructor from a grid. More...
 
 ~LevelSetFilter () override
 Default destructor. More...
 
AlphaType minMask () const
 Return the minimum value of the mask to be used for the derivation of a smooth alpha value. More...
 
AlphaType maxMask () const
 Return the maximum value of the mask to be used for the derivation of a smooth alpha value. More...
 
void setMaskRange (AlphaType min, AlphaType max)
 Define the range for the (optional) scalar mask. More...
 
bool isMaskInverted () const
 Return true if the mask is inverted, i.e. min->max in the original mask maps to 1->0 in the inverted alpha mask. More...
 
void invertMask (bool invert=true)
 Invert the optional mask, i.e. min->max in the original mask maps to 1->0 in the inverted alpha mask. More...
 
void meanCurvature (const MaskType *mask=nullptr)
 One iteration of mean-curvature flow of the level set. More...
 
void laplacian (const MaskType *mask=nullptr)
 One iteration of Laplacian flow of the level set. More...
 
void gaussian (int width=1, const MaskType *mask=nullptr)
 One iteration of a fast separable Gaussian filter. More...
 
void offset (ValueType offset, const MaskType *mask=nullptr)
 Offset the level set by the specified (world) distance. More...
 
void median (int width=1, const MaskType *mask=nullptr)
 One iteration of median-value flow of the level set. More...
 
void mean (int width=1, const MaskType *mask=nullptr)
 One iteration of mean-value flow of the level set. More...
 
- Public Member Functions inherited from openvdb::OPENVDB_VERSION_NAME::tools::LevelSetTracker< GridT, InterruptT >
 LevelSetTracker (GridT &grid, InterruptT *interrupt=nullptr)
 Main constructor. More...
 
virtual ~LevelSetTracker ()
 
template<typename MaskType >
void normalize (const MaskType *mask)
 Iterative normalization, i.e. solving the Eikonal equation. More...
 
void normalize ()
 Iterative normalization, i.e. solving the Eikonal equation. More...
 
void track ()
 Track the level set interface, i.e. rebuild and normalize the narrow band of the level set. More...
 
void prune ()
 Set voxels that are outside the narrow band to the background value (if trimming is enabled) and prune the grid. More...
 
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 recomended for most level set applications). More...
 
void erode (int iterations=1)
 Erodes the width of the narrow-band and update the background values. More...
 
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. More...
 
ValueType getHalfWidth () const
 Return the half width of the narrow band in floating-point voxel units. More...
 
State getState () const
 Return the state of the tracker (see struct defined above) More...
 
void setState (const State &s)
 Set the state of the tracker (see struct defined above) More...
 
math::BiasedGradientScheme getSpatialScheme () const
 
void setSpatialScheme (math::BiasedGradientScheme s)
 Set the spatial finite difference scheme. More...
 
math::TemporalIntegrationScheme getTemporalScheme () const
 
void setTemporalScheme (math::TemporalIntegrationScheme s)
 Set the spatial finite difference scheme. More...
 
int getNormCount () const
 
void setNormCount (int n)
 Set the number of normalizations performed per track or normalize call. More...
 
int getGrainSize () const
 
void setGrainSize (int grainsize)
 Set the grain-size used for multi-threading. More...
 
TrimMode trimming () const
 Return the trimming mode for voxels outside the narrow band. More...
 
void setTrimming (TrimMode mode)
 Specify whether to trim voxels outside the narrow band prior to pruning. More...
 
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 MaskT = typename GridT::template ValueConverter<float>::Type, typename InterruptT = util::NullInterrupter>
class openvdb::OPENVDB_VERSION_NAME::tools::LevelSetFilter< GridT, MaskT, InterruptT >

Filtering (e.g. diffusion) of narrow-band level sets. An optional scalar field can be used to produce a (smooth) alpha mask for the filtering.

Note
This class performs proper interface tracking which allows for unrestricted surface deformations

Definition at line 66 of file LevelSetFilter.h.

Member Typedef Documentation

template<typename GridT, typename MaskT = typename GridT::template ValueConverter<float>::Type, typename InterruptT = util::NullInterrupter>
using openvdb::OPENVDB_VERSION_NAME::tools::LevelSetFilter< GridT, MaskT, InterruptT >::AlphaType = typename MaskType::ValueType

Definition at line 74 of file LevelSetFilter.h.

template<typename GridT, typename MaskT = typename GridT::template ValueConverter<float>::Type, typename InterruptT = util::NullInterrupter>
using openvdb::OPENVDB_VERSION_NAME::tools::LevelSetFilter< GridT, MaskT, InterruptT >::BaseType = LevelSetTracker<GridT, InterruptT>

Definition at line 69 of file LevelSetFilter.h.

template<typename GridT, typename MaskT = typename GridT::template ValueConverter<float>::Type, typename InterruptT = util::NullInterrupter>
using openvdb::OPENVDB_VERSION_NAME::tools::LevelSetFilter< GridT, MaskT, InterruptT >::GridType = GridT

Definition at line 70 of file LevelSetFilter.h.

template<typename GridT, typename MaskT = typename GridT::template ValueConverter<float>::Type, typename InterruptT = util::NullInterrupter>
using openvdb::OPENVDB_VERSION_NAME::tools::LevelSetFilter< GridT, MaskT, InterruptT >::MaskType = MaskT

Definition at line 71 of file LevelSetFilter.h.

template<typename GridT, typename MaskT = typename GridT::template ValueConverter<float>::Type, typename InterruptT = util::NullInterrupter>
using openvdb::OPENVDB_VERSION_NAME::tools::LevelSetFilter< GridT, MaskT, InterruptT >::TreeType = typename GridType::TreeType

Definition at line 72 of file LevelSetFilter.h.

template<typename GridT, typename MaskT = typename GridT::template ValueConverter<float>::Type, typename InterruptT = util::NullInterrupter>
using openvdb::OPENVDB_VERSION_NAME::tools::LevelSetFilter< GridT, MaskT, InterruptT >::ValueType = typename TreeType::ValueType

Definition at line 73 of file LevelSetFilter.h.

Constructor & Destructor Documentation

template<typename GridT, typename MaskT = typename GridT::template ValueConverter<float>::Type, typename InterruptT = util::NullInterrupter>
openvdb::OPENVDB_VERSION_NAME::tools::LevelSetFilter< GridT, MaskT, InterruptT >::LevelSetFilter ( GridType grid,
InterruptT *  interrupt = nullptr 
)
inline

Main constructor from a grid.

Parameters
gridThe level set to be filtered.
interruptOptional interrupter.

Definition at line 81 of file LevelSetFilter.h.

template<typename GridT, typename MaskT = typename GridT::template ValueConverter<float>::Type, typename InterruptT = util::NullInterrupter>
openvdb::OPENVDB_VERSION_NAME::tools::LevelSetFilter< GridT, MaskT, InterruptT >::~LevelSetFilter ( )
inlineoverride

Default destructor.

Definition at line 89 of file LevelSetFilter.h.

Member Function Documentation

template<typename GridT, typename MaskT = typename GridT::template ValueConverter<float>::Type, typename InterruptT = util::NullInterrupter>
void openvdb::OPENVDB_VERSION_NAME::tools::LevelSetFilter< GridT, MaskT, InterruptT >::gaussian ( int  width = 1,
const MaskType mask = nullptr 
)
inline

One iteration of a fast separable Gaussian filter.

Parameters
widthWidth of the Gaussian kernel in voxel units.
maskOptional alpha mask.
Note
This is approximated as 4 iterations of a separable mean filter which typically leads an approximation that's better than 95%!

Definition at line 138 of file LevelSetFilter.h.

template<typename GridT, typename MaskT = typename GridT::template ValueConverter<float>::Type, typename InterruptT = util::NullInterrupter>
void openvdb::OPENVDB_VERSION_NAME::tools::LevelSetFilter< GridT, MaskT, InterruptT >::invertMask ( bool  invert = true)
inline

Invert the optional mask, i.e. min->max in the original mask maps to 1->0 in the inverted alpha mask.

Definition at line 116 of file LevelSetFilter.h.

template<typename GridT, typename MaskT = typename GridT::template ValueConverter<float>::Type, typename InterruptT = util::NullInterrupter>
bool openvdb::OPENVDB_VERSION_NAME::tools::LevelSetFilter< GridT, MaskT, InterruptT >::isMaskInverted ( ) const
inline

Return true if the mask is inverted, i.e. min->max in the original mask maps to 1->0 in the inverted alpha mask.

Definition at line 113 of file LevelSetFilter.h.

template<typename GridT, typename MaskT = typename GridT::template ValueConverter<float>::Type, typename InterruptT = util::NullInterrupter>
void openvdb::OPENVDB_VERSION_NAME::tools::LevelSetFilter< GridT, MaskT, InterruptT >::laplacian ( const MaskType mask = nullptr)
inline

One iteration of Laplacian flow of the level set.

Parameters
maskOptional alpha mask.

Definition at line 127 of file LevelSetFilter.h.

template<typename GridT, typename MaskT = typename GridT::template ValueConverter<float>::Type, typename InterruptT = util::NullInterrupter>
AlphaType openvdb::OPENVDB_VERSION_NAME::tools::LevelSetFilter< GridT, MaskT, InterruptT >::maxMask ( ) const
inline

Return the maximum value of the mask to be used for the derivation of a smooth alpha value.

Definition at line 96 of file LevelSetFilter.h.

template<typename GridT, typename MaskT = typename GridT::template ValueConverter<float>::Type, typename InterruptT = util::NullInterrupter>
void openvdb::OPENVDB_VERSION_NAME::tools::LevelSetFilter< GridT, MaskT, InterruptT >::mean ( int  width = 1,
const MaskType mask = nullptr 
)
inline

One iteration of mean-value flow of the level set.

Parameters
widthWidth of the mean-value kernel in voxel units.
maskOptional alpha mask.
Note
This filter is separable so it's fast!

Definition at line 167 of file LevelSetFilter.h.

template<typename GridT, typename MaskT = typename GridT::template ValueConverter<float>::Type, typename InterruptT = util::NullInterrupter>
void openvdb::OPENVDB_VERSION_NAME::tools::LevelSetFilter< GridT, MaskT, InterruptT >::meanCurvature ( const MaskType mask = nullptr)
inline

One iteration of mean-curvature flow of the level set.

Parameters
maskOptional alpha mask.

Definition at line 120 of file LevelSetFilter.h.

template<typename GridT, typename MaskT = typename GridT::template ValueConverter<float>::Type, typename InterruptT = util::NullInterrupter>
void openvdb::OPENVDB_VERSION_NAME::tools::LevelSetFilter< GridT, MaskT, InterruptT >::median ( int  width = 1,
const MaskType mask = nullptr 
)
inline

One iteration of median-value flow of the level set.

Parameters
widthWidth of the median-value kernel in voxel units.
maskOptional alpha mask.
Warning
This filter is not separable and is hence relatively slow!

Definition at line 157 of file LevelSetFilter.h.

template<typename GridT, typename MaskT = typename GridT::template ValueConverter<float>::Type, typename InterruptT = util::NullInterrupter>
AlphaType openvdb::OPENVDB_VERSION_NAME::tools::LevelSetFilter< GridT, MaskT, InterruptT >::minMask ( ) const
inline

Return the minimum value of the mask to be used for the derivation of a smooth alpha value.

Definition at line 93 of file LevelSetFilter.h.

template<typename GridT, typename MaskT = typename GridT::template ValueConverter<float>::Type, typename InterruptT = util::NullInterrupter>
void openvdb::OPENVDB_VERSION_NAME::tools::LevelSetFilter< GridT, MaskT, InterruptT >::offset ( ValueType  offset,
const MaskType mask = nullptr 
)
inline

Offset the level set by the specified (world) distance.

Parameters
offsetValue of the offset.
maskOptional alpha mask.

Definition at line 146 of file LevelSetFilter.h.

template<typename GridT, typename MaskT = typename GridT::template ValueConverter<float>::Type, typename InterruptT = util::NullInterrupter>
void openvdb::OPENVDB_VERSION_NAME::tools::LevelSetFilter< GridT, MaskT, InterruptT >::setMaskRange ( AlphaType  min,
AlphaType  max 
)
inline

Define the range for the (optional) scalar mask.

Parameters
minMinimum value of the range.
maxMaximum value of the range.

Mask values outside the range maps to alpha values of respectfully zero and one, and values inside the range maps smoothly to 0->1 (unless of course the mask is inverted).

Exceptions
ValueErrorif min is not smaller than max.

Definition at line 104 of file LevelSetFilter.h.


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