OpenVDB: LevelSetMeasure< GridT, InterruptT > Class Template Reference

OpenVDB 12.1.1

Loading...
Searching...
No Matches
LevelSetMeasure< GridT, InterruptT > Class Template Reference

Multi-threaded computation of surface area, volume and average mean-curvature for narrow band level sets. More...

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

## Public Types
using | GridType = GridT
using | TreeType = typename GridType::TreeType
using | ValueType = typename TreeType::ValueType
using | ManagerType = typename tree::LeafManager<const TreeType>

## Public Member Functions
| LevelSetMeasure (const GridType &grid, InterruptT *interrupt=nullptr)
| Main constructor from a grid.
void | init (const GridType &grid)
| Re-initialize using the specified grid.
virtual | ~LevelSetMeasure ()
| Destructor.
int | getGrainSize () const
void | setGrainSize (int grainsize)
| Set the grain-size used for multi-threading.
Real | area (bool useWorldUnits=true)
| Compute the surface area of the level set.
Real | volume (bool useWorldUnits=true)
| Compute the volume of the level set surface.
Real | totMeanCurvature (bool useWorldUnits=true)
| Compute the total mean curvature of the level set surface.
Real | totGaussianCurvature (bool useWorldUnits=true)
| Compute the total gaussian curvature of the level set surface.
Real | avgMeanCurvature (bool useWorldUnits=true)
| Compute the average mean curvature of the level set surface.
Real | avgGaussianCurvature (bool useWorldUnits=true)
| Compute the average gaussian curvature of the level set surface.
int | eulerCharacteristic ()
| Compute the Euler characteristic of the level set surface.
int | genus ()
| Compute the genus of the level set surface.

## Detailed Description

template<typename GridT, typename InterruptT = util::NullInterrupter>
class openvdb::v12_1::tools::LevelSetMeasure< GridT, InterruptT >

Multi-threaded computation of surface area, volume and average mean-curvature for narrow band level sets.

To reduce the risk of round-off errors (primarily due to catastrophic cancellation) and guarantee determinism during multi-threading this class is implemented using parallel_for, and delayed reduction of a sorted list.

## Member Typedef Documentation

## ◆ GridType

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

using GridType = GridT

## ◆ ManagerType

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

using ManagerType = typename tree::LeafManager<const TreeType>

## ◆ TreeType

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

using TreeType = typename GridType::TreeType

## ◆ ValueType

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

using ValueType = typename TreeType::ValueType

## Constructor & Destructor Documentation

## ◆ LevelSetMeasure()

template<typename GridT, typename InterruptT>

LevelSetMeasure | ( | const GridType & | grid,
|  | InterruptT * | interrupt = nullptr )
| inline

Main constructor from a grid.

Parameters

  grid | The level set to be measured.
  interrupt | Optional interrupter.

Exceptions

  RuntimeError | if the grid is not a level set or if it's empty.

## ◆ ~LevelSetMeasure()

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

virtual ~LevelSetMeasure | ( |  | ) |
| inlinevirtual

Destructor.

## Member Function Documentation

## ◆ area()

template<typename GridT, typename InterruptT>

Real area | ( | bool | useWorldUnits = true | ) |
| inline

Compute the surface area of the level set.

Parameters

  useWorldUnits | Specifies if the result is in world or voxel units.

Note
  Performs internal caching so only the initial call incurs actual computation.

## ◆ avgGaussianCurvature()

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

Real avgGaussianCurvature | ( | bool | useWorldUnits = true | ) |
| inline

Compute the average gaussian curvature of the level set surface.

Parameters

  useWorldUnits | Specifies if the result is in world or voxel units.

Note
  Performs internal caching so only the initial call incurs actual computation.

## ◆ avgMeanCurvature()

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

Real avgMeanCurvature | ( | bool | useWorldUnits = true | ) |
| inline

Compute the average mean curvature of the level set surface.

Parameters

  useWorldUnits | Specifies if the result is in world or voxel units.

Note
  Performs internal caching so only the initial call incurs actual computation.

## ◆ eulerCharacteristic()

template<typename GridT, typename InterruptT>

int eulerCharacteristic | ( |  | ) |
| inline

Compute the Euler characteristic of the level set surface.

Note
  Performs internal caching so only the initial call incurs actual computation.

## ◆ genus()

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

int genus | ( |  | ) |
| inline

Compute the genus of the level set surface.

Warning
  The genus is only well defined for a single connected surface.

Note
  Performs internal caching so only the initial call incurs actual computation.

## ◆ getGrainSize()

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

int getGrainSize | ( |  | ) | const
| inline

Returns
  the grain-size used for multi-threading

## ◆ init()

template<typename GridT, typename InterruptT>

void init | ( | const GridType & | grid | ) |
| inline

Re-initialize using the specified grid.

Parameters

  grid | The level set to be measured.

Exceptions

  RuntimeError | if the grid is not a level set or if it's empty.

## ◆ setGrainSize()

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

void setGrainSize | ( | int | grainsize | ) |
| inline

Set the grain-size used for multi-threading.

Note
  A grain size of 0 or less disables multi-threading!

## ◆ totGaussianCurvature()

template<typename GridT, typename InterruptT>

Real totGaussianCurvature | ( | bool | useWorldUnits = true | ) |
| inline

Compute the total gaussian curvature of the level set surface.

Parameters

  useWorldUnits | Specifies if the result is in world or voxel units.

Note
  Performs internal caching so only the initial call incurs actual computation.

## ◆ totMeanCurvature()

template<typename GridT, typename InterruptT>

Real totMeanCurvature | ( | bool | useWorldUnits = true | ) |
| inline

Compute the total mean curvature of the level set surface.

Parameters

  useWorldUnits | Specifies if the result is in world or voxel units.

Note
  Performs internal caching so only the initial call incurs actual computation.

## ◆ volume()

template<typename GridT, typename InterruptT>

Real volume | ( | bool | useWorldUnits = true | ) |
| inline

Compute the volume of the level set surface.

Parameters

  useWorldUnits | Specifies if the result is in world or voxel units.

Note
  Performs internal caching so only the initial call incurs actual computation.