OpenVDB  7.1.0
Classes | Namespaces | Functions
FastSweeping.h File Reference

Defined the six functions {fog,sdf}To{Sdf,Ext,SdfAndExt} in addition to the two functions maskSdf and dilateSdf. Sdf denotes a signed-distance field (i.e. negative values are inside), fog is a scalar fog volume (i.e. higher values are inside), and Ext is a field (of arbitrary type) that is extended off the iso-surface. All these functions are implemented with the methods in the class named FastSweeping. More...

#include <type_traits>
#include <cmath>
#include <limits>
#include <deque>
#include <unordered_map>
#include <utility>
#include <tbb/parallel_for.h>
#include <tbb/enumerable_thread_specific.h>
#include <tbb/task_group.h>
#include <openvdb/math/Math.h>
#include <openvdb/math/Stencils.h>
#include <openvdb/tree/LeafManager.h>
#include "LevelSetUtil.h"
#include "Morphology.h"
#include "Statistics.h"

Go to the source code of this file.

Classes

class  FastSweeping< SdfGridT, ExtValueT >
 Computes signed distance values from an initial iso-surface and optionally performs velocty extension at the same time. This is done by means of a novel sparse and parallel fast sweeping algorithm based on a first order Goudonov's scheme. More...
 
struct  FastSweeping< SdfGridT, ExtValueT >::MinMaxKernel
 
struct  FastSweeping< SdfGridT, ExtValueT >::DilateKernel
 Private class of FastSweeping to perform multi-threaded initialization. More...
 
struct  FastSweeping< SdfGridT, ExtValueT >::InitSdf
 
struct  FastSweeping< SdfGridT, ExtValueT >::SweepingKernel
 Private class of FastSweeping to perform concurrent fast sweeping in two directions. More...
 
struct  FastSweeping< SdfGridT, ExtValueT >::SweepingKernel::NN
 

Namespaces

 openvdb
 
 openvdb::v7_1
 
 openvdb::v7_1::tools
 

Functions

template<typename GridT >
GridT::Ptr fogToSdf (const GridT &fogGrid, typename GridT::ValueType isoValue, int nIter=1)
 Converts a scalar fog volume into a signed distance function. Active input voxels with scalar values above the given isoValue will have NEGATIVE distance values on output, i.e. they are assumed to be INSIDE the iso-surface. More...
 
template<typename GridT >
GridT::Ptr sdfToSdf (const GridT &sdfGrid, typename GridT::ValueType isoValue=0, int nIter=1)
 Given an existing approximate SDF it solves the Eikonal equation for all its active voxels. Active input voxels with a signed distance value above the given isoValue will have POSITIVE distance values on output, i.e. they are assumed to be OUTSIDE the iso-surface. More...
 
template<typename FogGridT , typename ExtOpT , typename ExtValueT >
FogGridT::template ValueConverter< ExtValueT >::Type::Ptr fogToExt (const FogGridT &fogGrid, const ExtOpT &op, const ExtValueT &background, typename FogGridT::ValueType isoValue, int nIter=1)
 Computes the extension of a field, defined by the specified functor, off an iso-surface from an input FOG volume. More...
 
template<typename SdfGridT , typename ExtOpT , typename ExtValueT >
SdfGridT::template ValueConverter< ExtValueT >::Type::Ptr sdfToExt (const SdfGridT &sdfGrid, const ExtOpT &op, const ExtValueT &background, typename SdfGridT::ValueType isoValue=0, int nIter=1)
 Computes the extension of a scalar field, defined by the specified functor, off an iso-surface from an input SDF volume. More...
 
template<typename FogGridT , typename ExtOpT , typename ExtValueT >
std::pair< typename FogGridT::Ptr, typename FogGridT::template ValueConverter< ExtValueT >::Type::Ptr > fogToSdfAndExt (const FogGridT &fogGrid, const ExtOpT &op, const ExtValueT &background, typename FogGridT::ValueType isoValue, int nIter=1)
 Computes the signed distance field and the extension of a scalar field, defined by the specified functor, off an iso-surface from an input FOG volume. More...
 
template<typename SdfGridT , typename ExtOpT , typename ExtValueT >
std::pair< typename SdfGridT::Ptr, typename SdfGridT::template ValueConverter< ExtValueT >::Type::Ptr > sdfToSdfAndExt (const SdfGridT &sdfGrid, const ExtOpT &op, const ExtValueT &background, typename SdfGridT::ValueType isoValue=0, int nIter=1)
 Computes the signed distance field and the extension of a scalar field, defined by the specified functor, off an iso-surface from an input SDF volume. More...
 
template<typename GridT >
GridT::Ptr dilateSdf (const GridT &sdfGrid, int dilation, NearestNeighbors nn=NN_FACE, int nIter=1)
 Dilates an existing signed distance filed by a specified number of voxels. More...
 
template<typename GridT , typename MaskTreeT >
GridT::Ptr maskSdf (const GridT &sdfGrid, const Grid< MaskTreeT > &mask, bool ignoreActiveTiles=false, int nIter=1)
 Fills mask by extending an existing signed distance field into the active values of this input ree of arbitrary value type. More...
 
template<typename SdfGridT , typename OpT , typename ExtValueT >
SdfGridT::template ValueConverter< ExtValueT >::Type::Ptr sdfToExt (const SdfGridT &sdfGrid, const OpT &op, const ExtValueT &background, typename SdfGridT::ValueType isoValue, int nIter)
 

Detailed Description

Defined the six functions {fog,sdf}To{Sdf,Ext,SdfAndExt} in addition to the two functions maskSdf and dilateSdf. Sdf denotes a signed-distance field (i.e. negative values are inside), fog is a scalar fog volume (i.e. higher values are inside), and Ext is a field (of arbitrary type) that is extended off the iso-surface. All these functions are implemented with the methods in the class named FastSweeping.

Author
Ken Museth
Note
Solves the (simplified) Eikonal Eq: $|\nabla \phi|^2 = 1$ and performs velocity extension, $\nabla f\nabla \phi = 0$, both by means of the fast sweeping algorithm detailed in: "A Fast Sweeping Method For Eikonal Equations" by H. Zhao, Mathematics of Computation, Vol 74(230), pp 603-627, 2004

The algorithm used below for parallel fast sweeping was first publised in: "New Algorithm for Sparse and Parallel Fast Sweeping: Efficient Computation of Sparse Distance Fields" by K. Museth, ACM SIGGRAPH Talk, 2017, http://www.museth.org/Ken/Publications_files/Museth_SIG17.pdf