OpenVDB: FastSweeping< SdfGridT, ExtValueT >::InitSdf Struct Reference

OpenVDB 12.0.0 |

Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | List of all members
FastSweeping< SdfGridT, ExtValueT >::InitSdf Struct Reference

`#include <openvdb/tools/FastSweeping.h>`

## Public Types
using | LeafRange = typename tree::LeafManager<SdfTreeT>::LeafRange

## Public Member Functions
| InitSdf (FastSweeping &parent)
| InitSdf (const InitSdf &)=default
InitSdf & | operator= (const InitSdf &)=delete
void | run (SdfValueT isoValue)
void | operator() (const LeafRange &r) const
template<typename RootOrInternalNodeT>
void | operator() (const RootOrInternalNodeT &node) const
bool | initExt (const SdfGridT &fogGrid, const OpT &op, const ExtValueT &background, SdfValueT isoValue, bool isInputSdf, FastSweepingDomain mode, const typename ExtGridT::ConstPtr extGrid)
| FastSweeping ()
| Constructor.
| FastSweeping (const FastSweeping &)=delete
| Disallow copy construction.
| ~FastSweeping ()
| Destructor.
FastSweeping & | operator= (const FastSweeping &)=delete
| Disallow copy assignment.
SdfGridT::Ptr | sdfGrid ()
| Returns a shared pointer to the signed distance field computed by this class.
ExtGridT::Ptr | extGrid ()
| Returns a shared pointer to the extension field computed by this class.
ExtGridT::Ptr | extGridInput ()
| Returns a shared pointer to the extension grid input. This is non-NULL if this class is used to extend a field with a non-default sweep direction.
bool | initSdf (const SdfGridT &sdfGrid, SdfValueT isoValue, bool isInputSdf)
| Initializer for input grids that are either a signed distance field or a scalar fog volume.
bool | initExt (const SdfGridT &sdfGrid, const ExtOpT &op, const ExtValueT &background, SdfValueT isoValue, bool isInputSdf, FastSweepingDomain mode=FastSweepingDomain::SWEEP_ALL, const typename ExtGridT::ConstPtr extGrid=nullptr)
| Initializer used whenever velocity extension is performed in addition to the computation of signed distance fields.
bool | initExt (const SdfGridT &fogGrid, const OpT &op, const ExtValueT &background, SdfValueT isoValue, bool isInputSdf, FastSweepingDomain mode, const typename ExtGridT::ConstPtr extGrid)
bool | initDilate (const SdfGridT &sdfGrid, int dilation, NearestNeighbors nn=NN_FACE, FastSweepingDomain mode=FastSweepingDomain::SWEEP_ALL)
| Initializer used when dilating an existing signed distance field.
bool | initMask (const SdfGridT &sdfGrid, const Grid< MaskTreeT > &mask, bool ignoreActiveTiles=false)
| Initializer used for the extension of an existing signed distance field into the active values of an input mask of arbitrary value type.
void | sweep (int nIter=1, bool finalize=true)
| Perform nIter iterations of the fast sweeping algorithm.
void | clear ()
| Clears all the grids and counters so initialization can be called again.
size_t | sweepingVoxelCount () const
| Return the number of voxels that will be solved for.
size_t | boundaryVoxelCount () const
| Return the number of voxels that defined the boundary condition.
bool | isValid () const
| Return true if there are voxels and boundaries to solve for.
FastSweepingDomain | sweepDirection () const
| Return whether the sweep update is in all direction (SWEEP_ALL), greater than isovalue (SWEEP_GREATER_THAN_ISOVALUE), or less than isovalue (SWEEP_LESS_THAN_ISOVALUE).
bool | isInputSdf ()
| Return whether the fast-sweeping input grid a signed distance function or not (fog).

## Public Attributes
FastSweeping * | mParent
SdfGridT * | mSdfGrid
SdfValueT | mIsoValue
SdfValueT | mAboveSign

## Member Typedef Documentation

## ◆ LeafRange

template<typename SdfGridT, typename ExtValueT = typename SdfGridT::ValueType>

using LeafRange = typename tree::LeafManager<SdfTreeT>::LeafRange

## Constructor & Destructor Documentation

## ◆ InitSdf() [1/2]

template<typename SdfGridT, typename ExtValueT = typename SdfGridT::ValueType>

InitSdf | ( | FastSweeping & | parent | ) |
| inline

## ◆ InitSdf() [2/2]

template<typename SdfGridT, typename ExtValueT = typename SdfGridT::ValueType>

InitSdf | ( | const InitSdf & |  | ) |
| default

## ◆ ~FastSweeping()

~FastSweeping | ( |  | ) |
| inline

Destructor.

## Member Function Documentation

## ◆ boundaryVoxelCount()

size_t boundaryVoxelCount | ( |  | ) | const
| inline

Return the number of voxels that defined the boundary condition.

## ◆ clear()

void clear | ( |  | ) |

Clears all the grids and counters so initialization can be called again.

## ◆ extGrid()

ExtGridT::Ptr extGrid | ( |  | ) |
| inline

Returns a shared pointer to the extension field computed by this class.

Warning
  This shared pointer might point to NULL if the grid has not been initialize (by one of the init methods) or computed (by the sweep method).

## ◆ extGridInput()

ExtGridT::Ptr extGridInput | ( |  | ) |
| inline

Returns a shared pointer to the extension grid input. This is non-NULL if this class is used to extend a field with a non-default sweep direction.

Warning
  This shared pointer might point to NULL. This is non-NULL if this class is used to extend a field with a non-default sweep direction, i.e. SWEEP_LESS_THAN_ISOVALUE or SWEEP_GREATER_THAN_ISOVALUE.

## ◆ FastSweeping() [1/2]

FastSweeping | ( |  | ) |

Constructor.

## ◆ FastSweeping() [2/2]

FastSweeping | ( | const FastSweeping & |  | ) |
| delete

Disallow copy construction.

## ◆ initDilate()

bool initDilate | ( | const SdfGridT & | sdfGrid,
|  | int | dilation,
|  | NearestNeighbors | nn = NN_FACE,
|  | FastSweepingDomain | mode = FastSweepingDomain::SWEEP_ALL )

Initializer used when dilating an existing signed distance field.

Returns
  True if the initialization succeeded.

Parameters

  sdfGrid | Input signed distance field to to be dilated.
  dilation | Numer of voxels that the input SDF will be dilated.
  nn | Stencil-pattern used for dilation
  mode | Determines the direction of the dilation. SWEEP_ALL will dilate in both sides of the signed distance function, SWEEP_GREATER_THAN_ISOVALUE will dilate in the positive side of the iso-surface, SWEEP_LESS_THAN_ISOVALUE will dilate in the negative side of the iso-surface.

This, or any of ther other initialization methods, should be called before any call to sweep(). Failure to do so will throw a RuntimeError.

Warning
  Note, if this method fails, i.e. returns false, a subsequent call to sweep will trow a RuntimeError. Instead call clear and try again.

## ◆ initExt() [1/3]

bool initExt | ( | const SdfGridT & | fogGrid,
|  | const OpT & | op,
|  | const ExtValueT & | background,
|  | SdfValueT | isoValue,
|  | bool | isInputSdf,
|  | FastSweepingDomain | mode,
|  | const typename ExtGridT::ConstPtr | extGrid )

## ◆ initExt() [2/3]

bool initExt | ( | const SdfGridT & | fogGrid,
|  | const OpT & | op,
|  | const ExtValueT & | background,
|  | SdfValueT | isoValue,
|  | bool | isInputSdf,
|  | FastSweepingDomain | mode,
|  | const typename ExtGridT::ConstPtr | extGrid )

## ◆ initExt() [3/3]

bool initExt | ( | const SdfGridT & | sdfGrid,
|  | const ExtOpT & | op,
|  | const ExtValueT & | background,
|  | SdfValueT | isoValue,
|  | bool | isInputSdf,
|  | FastSweepingDomain | mode = FastSweepingDomain::SWEEP_ALL,
|  | const typename ExtGridT::ConstPtr | extGrid = nullptr )

Initializer used whenever velocity extension is performed in addition to the computation of signed distance fields.

Returns
  True if the initialization succeeded.

Parameters

  sdfGrid | Input scalar grid that represents an existing signed distance field or a fog volume (signified by isInputSdf).
  op | Functor with signature [](const Vec3R &xyz)->ExtValueT that defines the Dirichlet boundary condition, on the iso-surface, of the field to be extended. Strictly the return type of this functor is only required to be convertible to ExtValueT!
  background | Background value of return grid with the extension field.
  isoValue | Iso-value to be used for the boundary condition of the fast sweeping algorithm (typically 0 for sdfs and a positive value for fog volumes).
  isInputSdf | Used to determine if sdfGrid is a sigend distance field (true) or a scalar fog volume (false).
  mode | Determines the mode of updating the extension field. SWEEP_ALL will update all voxels of the extension field affected by the fast sweeping algorithm. SWEEP_GREATER_THAN_ISOVALUE will update all voxels corresponding to fog values that are greater than a given isovalue. SWEEP_LESS_THAN_ISOVALUE will update all voxels corresponding to fog values that are less than a given isovalue. If a mode other than SWEEP_ALL is chosen, a user needs to supply extGrid.
  extGrid | Optional parameter required to supply a default value for the extension field when SWEEP_GREATER_THAN_ISOVALUE or SWEEP_LESS_THAN_ISOVALUE mode is picked for mode. When SWEEP_GREATER_THAN_ISOVALUE is supplied as an argument for mode, the extension field voxel will default to the value of the extGrid in that position if it corresponds to a level-set value that is less than the isovalue. Otherwise, the extension field voxel value will be computed by the Fast Sweeping algorithm. The opposite convention is implemented when SWEEP_LESS_THAN_ISOVALUE is supplied as an argument for mode.

This, or any of ther other initialization methods, should be called before any call to sweep(). Failure to do so will throw a RuntimeError.

Warning
  Note, if this method fails, i.e. returns false, a subsequent call to sweep will trow a RuntimeError. Instead call clear and try again.

## ◆ initMask()

bool initMask | ( | const SdfGridT & | sdfGrid,
|  | const Grid< MaskTreeT > & | mask,
|  | bool | ignoreActiveTiles = false )

Initializer used for the extension of an existing signed distance field into the active values of an input mask of arbitrary value type.

Returns
  True if the initialization succeeded.

Parameters

  sdfGrid | Input signed distance field to be extended into the mask.
  mask | Mask used to identify the topology of the output SDF. Note this mask is assume to overlap with the sdfGrid.
  ignoreActiveTiles | If false, active tiles in the mask are treated as active voxels. Else they are ignored.

This, or any of ther other initialization methods, should be called before any call to sweep(). Failure to do so will throw a RuntimeError.

Warning
  Note, if this method fails, i.e. returns false, a subsequent call to sweep will trow a RuntimeError. Instead call clear and try again.

## ◆ initSdf()

bool initSdf | ( | const SdfGridT & | sdfGrid,
|  | SdfValueT | isoValue,
|  | bool | isInputSdf )

Initializer for input grids that are either a signed distance field or a scalar fog volume.

Returns
  True if the initialization succeeded.

Parameters

  sdfGrid | Input scalar grid that represents an existing signed distance field or a fog volume (signified by isInputSdf).
  isoValue | Iso-value to be used to define the Dirichlet boundary condition of the fast sweeping algorithm (typically 0 for sdfs and a positive value for fog volumes).
  isInputSdf | Used to determine if sdfGrid is a sigend distance field (true) or a scalar fog volume (false).

This, or any of ther other initialization methods, should be called before any call to sweep(). Failure to do so will throw a RuntimeError.

Warning
  Note, if this method fails, i.e. returns false, a subsequent call to sweep will trow a RuntimeError. Instead call clear and try again.

## ◆ isInputSdf()

bool isInputSdf | ( |  | ) |
| inline

Return whether the fast-sweeping input grid a signed distance function or not (fog).

## ◆ isValid()

bool isValid | ( |  | ) | const
| inline

Return true if there are voxels and boundaries to solve for.

## ◆ operator()() [1/2]

template<typename SdfGridT, typename ExtValueT = typename SdfGridT::ValueType>

void operator() | ( | const LeafRange & | r | ) | const
| inline

## ◆ operator()() [2/2]

template<typename SdfGridT, typename ExtValueT = typename SdfGridT::ValueType>
template<typename RootOrInternalNodeT>

void operator() | ( | const RootOrInternalNodeT & | node | ) | const
| inline

## ◆ operator=() [1/2]

FastSweeping & operator= | ( | const FastSweeping & |  | ) |
| delete

Disallow copy assignment.

## ◆ operator=() [2/2]

template<typename SdfGridT, typename ExtValueT = typename SdfGridT::ValueType>

InitSdf & operator= | ( | const InitSdf & |  | ) |
| delete

## ◆ run()

template<typename SdfGridT, typename ExtValueT = typename SdfGridT::ValueType>

void run | ( | SdfValueT | isoValue | ) |
| inline

## ◆ sdfGrid()

SdfGridT::Ptr sdfGrid | ( |  | ) |
| inline

Returns a shared pointer to the signed distance field computed by this class.

Warning
  This shared pointer might point to NULL if the grid has not been initialize (by one of the init methods) or computed (by the sweep method).

## ◆ sweep()

void sweep | ( | int | nIter = 1,
|  | bool | finalize = true )

Perform nIter iterations of the fast sweeping algorithm.

Parameters

  nIter | Number of iterations of the fast sweeping algorithm. Each iteration performs 2^3 = 8 individual sweeps.
  finalize | If true the (possibly asymmetric) inside and outside values of the resulting signed distance field are properly set. Unless you're an expert this should remain true!

Exceptions

  RuntimeError | if sweepingVoxelCount() or boundaryVoxelCount() return zero. This might happen if none of the initialization methods above were called or if that initialization failed.

## ◆ sweepDirection()

FastSweepingDomain sweepDirection | ( |  | ) | const
| inline

Return whether the sweep update is in all direction (SWEEP_ALL), greater than isovalue (SWEEP_GREATER_THAN_ISOVALUE), or less than isovalue (SWEEP_LESS_THAN_ISOVALUE).

Note
  SWEEP_GREATER_THAN_ISOVALUE and SWEEP_LESS_THAN_ISOVALUE modes are used in dilating the narrow-band of a levelset or in extending a field.

## ◆ sweepingVoxelCount()

size_t sweepingVoxelCount | ( |  | ) | const
| inline

Return the number of voxels that will be solved for.

## Member Data Documentation

## ◆ mAboveSign

template<typename SdfGridT, typename ExtValueT = typename SdfGridT::ValueType>

SdfValueT mAboveSign

## ◆ mIsoValue

template<typename SdfGridT, typename ExtValueT = typename SdfGridT::ValueType>

SdfValueT mIsoValue

## ◆ mParent

template<typename SdfGridT, typename ExtValueT = typename SdfGridT::ValueType>

FastSweeping* mParent

## ◆ mSdfGrid

template<typename SdfGridT, typename ExtValueT = typename SdfGridT::ValueType>

SdfGridT* mSdfGrid