OpenVDB  12.0.0
Classes | Namespaces | Enumerations | Functions
Morphology.h File Reference

Implementation of morphological dilation and erosion. More...

#include "Activate.h"
#include "Prune.h"
#include "ValueTransformer.h"
#include <openvdb/Types.h>
#include <openvdb/Grid.h>
#include <openvdb/tree/ValueAccessor.h>
#include <openvdb/tree/LeafManager.h>
#include <openvdb/openvdb.h>
#include <openvdb/points/PointDataGrid.h>
#include <openvdb/util/Assert.h>
#include <tbb/task_arena.h>
#include <tbb/enumerable_thread_specific.h>
#include <tbb/parallel_for.h>
#include <type_traits>
#include <vector>

Go to the source code of this file.

Classes

class  Morphology< TreeType >
 Dilation/Erosion operations over a Trees leaf level voxel topology. More...
 
struct  Morphology< TreeType >::NodeMaskOp
 Node Mask dilation/erosion operations for individual leaf nodes on a given tree. The leaf node may optionally belong to a different tree than the provided accessor, which will have the effect of dilating the leaf node mask into a different tree, or eroding the node mask based on corresponding neighbors in a different tree. More...
 

Namespaces

 openvdb
 
 openvdb::v12_0
 
 openvdb::v12_0::tools
 
 openvdb::v12_0::tools::morphology
 

Enumerations

enum  NearestNeighbors { NN_FACE = 6, NN_FACE_EDGE = 18, NN_FACE_EDGE_VERTEX = 26 }
 Voxel topology of nearest neighbors. More...
 
enum  TilePolicy { IGNORE_TILES, EXPAND_TILES, PRESERVE_TILES }
 Different policies when dilating trees with active tiles. More...
 

Functions

template<typename TreeOrLeafManagerT >
void dilateActiveValues (TreeOrLeafManagerT &tree, const int iterations=1, const NearestNeighbors nn=NN_FACE, const TilePolicy mode=PRESERVE_TILES, const bool threaded=true)
 Topologically dilate all active values (i.e. both voxels and tiles) in a tree using one of three nearest neighbor connectivity patterns. More...
 
template<typename TreeOrLeafManagerT >
void erodeActiveValues (TreeOrLeafManagerT &tree, const int iterations=1, const NearestNeighbors nn=NN_FACE, const TilePolicy mode=PRESERVE_TILES, const bool threaded=true)
 Topologically erode all active values (i.e. both voxels and tiles) in a tree using one of three nearest neighbor connectivity patterns. More...
 
template<typename TreeT >
std::enable_if< std::is_same< TreeT, typename TreeT::template ValueConverter< ValueMask >::Type >::value, typename TreeT::template ValueConverter< ValueMask >::Type * >::type getMaskTree (TreeT &tree)
 
template<typename TreeT >
std::enable_if<!std::is_same< TreeT, typename TreeT::template ValueConverter< ValueMask >::Type >::value, typename TreeT::template ValueConverter< ValueMask >::Type * >::type getMaskTree (TreeT &)
 

Detailed Description

Implementation of morphological dilation and erosion.

Authors
Ken Museth, Nick Avramoussis
Note
By design the morphological operations only change the state of voxels, not their values. If one desires to change the values of voxels that change state an efficient technique is to construct a boolean mask by performing a topology difference between the original and final grids.