OpenVDB  1.2.0
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Static Protected Member Functions | List of all members
Grid< typename > Class Template Reference

Container class that associates a tree with a transform and metadata. More...

#include <Grid.h>

Inherits GridBase.

Classes

struct  ValueConverter
 ValueConverter<T>::Type is the type of a grid having the same hierarchy as this grid but a different value type, T. More...
 

Public Types

typedef boost::shared_ptr< GridPtr
 
typedef boost::shared_ptr
< const Grid
ConstPtr
 
typedef _TreeType TreeType
 
typedef _TreeType::Ptr TreePtrType
 
typedef _TreeType::ConstPtr ConstTreePtrType
 
typedef _TreeType::ValueType ValueType
 
typedef tree::ValueAccessor
< _TreeType > 
Accessor
 
typedef tree::ValueAccessor
< const _TreeType > 
ConstAccessor
 
typedef _TreeType::ValueOnIter ValueOnIter
 
typedef _TreeType::ValueOnCIter ValueOnCIter
 
typedef _TreeType::ValueOffIter ValueOffIter
 
typedef _TreeType::ValueOffCIter ValueOffCIter
 
typedef _TreeType::ValueAllIter ValueAllIter
 
typedef _TreeType::ValueAllCIter ValueAllCIter
 
typedef Ptr(* GridFactory )()
 
typedef std::map< Name,
Metadata::Ptr
MetadataMap
 
typedef MetadataMap::iterator MetaIterator
 
typedef MetadataMap::const_iterator ConstMetaIterator
 

Public Member Functions

 Grid ()
 Construct a new grid with background value zero. More...
 
 Grid (const ValueType &background)
 Construct a new grid with the given background value. More...
 
 Grid (TreePtrType)
 Construct a new grid that shares the given tree and associates with it an identity linear transform. More...
 
 Grid (const Grid &)
 Deep copy another grid's metadata, transform and tree. More...
 
 Grid (const Grid &, ShallowCopy)
 Deep copy another grid's metadata, but share its tree and transform. More...
 
 Grid (const GridBase &)
 Deep copy another grid's metadata and transform, but construct a new tree with background value zero. More...
 
virtual ~Grid ()
 
virtual Name type () const
 Return the name of this grid's type. More...
 
virtual Name valueType () const
 Return the name of the type of a voxel's value (e.g., "float" or "vec3d"). More...
 
const ValueTypebackground () const
 Return this grid's background value. More...
 
void setBackground (const ValueType &val)
 Replace this grid's background value. More...
 
virtual bool empty () const
 Return true if this grid contains only inactive background voxels. More...
 
virtual void clear ()
 Empty this grid, so that all voxels become inactive background voxels. More...
 
Accessor getAccessor ()
 Return an accessor that provides random read and write access to this grid's voxels. More...
 
void evalMinMax (ValueType &minVal, ValueType &maxVal) const
 Return the minimum and maximum active values in this grid. More...
 
void fill (const CoordBBox &bbox, const ValueType &value, bool active=true)
 Set all voxels within a given axis-aligned box to a constant value. More...
 
void signedFloodFill ()
 Set the values of all inactive voxels and tiles of a narrow-band level set from the signs of the active voxels, setting outside values to +background and inside values to -background. More...
 
void signedFloodFill (const ValueType &outside, const ValueType &inside)
 Set the values of all inactive voxels and tiles of a narrow-band level set from the signs of the active voxels, setting outside values to outside and inside values to inside. More...
 
void prune (const ValueType &tolerance=zeroVal< ValueType >())
 Reduce the memory footprint of this grid by increasing its sparseness either losslessly (tolerance = 0) or lossily (tolerance > 0). More...
 
virtual void pruneGrid (float tolerance=0.0)
 Reduce the memory footprint of this grid by increasing its sparseness. More...
 
void merge (Grid &other)
 Transfer active voxels from another grid to this grid wherever those voxels coincide with inactive voxels in this grid. More...
 
template<typename OtherTreeType >
void topologyUnion (const Grid< OtherTreeType > &other)
 Union this grid's set of active values with the active values of the other grid, whose value type may be different. More...
 
virtual Index64 activeVoxelCount () const
 Return the number of active voxels. More...
 
virtual CoordBBox evalActiveVoxelBoundingBox () const
 Return the axis-aligned bounding box of all active voxels. More...
 
virtual Coord evalActiveVoxelDim () const
 Return the dimensions of the axis-aligned bounding box of all active voxels. More...
 
virtual Index64 memUsage () const
 
virtual void setTree (TreeBase::Ptr)
 Associate the given tree with this grid, in place of its existing tree. More...
 
virtual void newTree ()
 Associate a new, empty tree with this grid, in place of its existing tree. More...
 
virtual void readTopology (std::istream &)
 Read the grid topology from a stream. This will read only the grid structure, not the actual data buffers. More...
 
virtual void writeTopology (std::ostream &) const
 Write the grid topology to a stream. This will write only the grid structure, not the actual data buffers. More...
 
virtual void readBuffers (std::istream &)
 Read all data buffers for this grid. More...
 
virtual void writeBuffers (std::ostream &) const
 Write out all data buffers for this grid. More...
 
virtual void print (std::ostream &=std::cout, int verboseLevel=1) const
 Output a human-readable description of this grid. More...
 
template<typename GridType >
bool isType () const
 Return true if this grid is of the same type as the template parameter. More...
 
template<typename GridType >
GridType::Ptr grid (const GridBase::Ptr &grid)
 
template<typename GridType >
GridType::ConstPtr grid (const GridBase::ConstPtr &grid)
 
template<typename GridType >
GridType::ConstPtr constGrid (const GridBase::Ptr &grid)
 
template<typename GridType >
GridType::ConstPtr constGrid (const GridBase::ConstPtr &grid)
 
std::string getName () const
 Return this grid's user-specified name. More...
 
void setName (const std::string &)
 Specify a name for this grid. More...
 
std::string getCreator () const
 Return the user-specified description of this grid's creator. More...
 
void setCreator (const std::string &)
 Provide a description of this grid's creator. More...
 
bool saveFloatAsHalf () const
 Return true if this grid should be written out with floating-point voxel values (including components of vectors) quantized to 16 bits. More...
 
void setSaveFloatAsHalf (bool)
 
GridClass getGridClass () const
 Return the class of volumetric data (level set, fog volume, etc.) stored in this grid. More...
 
void setGridClass (GridClass)
 Specify the class of volumetric data (level set, fog volume, etc.) stored in this grid. More...
 
void clearGridClass ()
 Remove the setting specifying the class of this grid's volumetric data. More...
 
VecType getVectorType () const
 Return the type of vector data (invariant, covariant, etc.) stored in this grid, assuming that this grid contains a vector-valued tree. More...
 
void setVectorType (VecType)
 Specify the type of vector data (invariant, covariant, etc.) stored in this grid, assuming that this grid contains a vector-valued tree. More...
 
void clearVectorType ()
 Remove the setting specifying the type of vector data stored in this grid. More...
 
bool isInWorldSpace () const
 
void setIsInWorldSpace (bool)
 Specify whether this grid's voxel values are in world space or in local space. More...
 
void addStatsMetadata ()
 Add metadata to this grid comprising the current values of statistics like the active voxel count and bounding box. More...
 
MetaMap::Ptr getStatsMetadata () const
 Return a new MetaMap containing just the metadata that was added to this grid with addStatsMetadata(). More...
 
void setTransform (math::Transform::Ptr)
 Associate the given transform with this grid, in place of its existing transform. More...
 
Vec3d voxelSize () const
 Return the size of this grid's voxels. More...
 
Vec3d voxelSize (const Vec3d &xyz) const
 Return the size of this grid's voxel at position (x, y, z). More...
 
bool hasUniformVoxels () const
 Return true if the voxels in world space are uniformly sized cubes. More...
 
Vec3d worldToIndex (const Vec3d &xyz) const
 Apply the inverse of this grid's transform to the given coordinates. More...
 
void readTransform (std::istream &is)
 Read in the transform for this grid. More...
 
void writeTransform (std::ostream &os) const
 Write out the transform for this grid. More...
 
MetaMap::Ptr copyMeta () const
 Return a copy of this map whose fields are shared with this map. More...
 
MetaMap::Ptr deepCopyMeta () const
 Return a deep copy of this map that shares no data with this map. More...
 
void readMeta (std::istream &)
 Read in all the Meta information the given stream. More...
 
void writeMeta (std::ostream &) const
 Write out all the Meta information to the given stream. More...
 
void insertMeta (const Name &name, const Metadata &metadata)
 
void removeMeta (const Name &name)
 
template<typename T >
T & metaValue (const Name &name)
 
template<typename T >
const T & metaValue (const Name &name) const
 
MetaIterator beginMeta ()
 Functions for iterating over the Metadata. More...
 
ConstMetaIterator beginMeta () const
 
MetaIterator endMeta ()
 
ConstMetaIterator endMeta () const
 
void clearMetadata ()
 
size_t metaCount () const
 
std::string str () const
 
Ptr copy (CopyPolicy treePolicy=CP_SHARE) const
 Return a new grid of the same type as this grid and whose metadata and transform are deep copies of this grid's. More...
 
virtual GridBase::Ptr copyGrid (CopyPolicy treePolicy=CP_SHARE) const
 Return a new grid of the same type as this grid and whose metadata and transform are deep copies of this grid's. More...
 
Ptr deepCopy () const
 Return a new grid whose metadata, transform and tree are deep copies of this grid's. More...
 
virtual GridBase::Ptr deepCopyGrid () const
 Return a new grid whose metadata, transform and tree are deep copies of this grid's. More...
 
ConstAccessor getAccessor () const
 Return an accessor that provides random read-only access to this grid's voxels. More...
 
ConstAccessor getConstAccessor () const
 Return an accessor that provides random read-only access to this grid's voxels. More...
 
ValueOnIter beginValueOn ()
 Return an iterator over all of this grid's active values (tile and voxel). More...
 
ValueOnCIter beginValueOn () const
 Return an iterator over all of this grid's active values (tile and voxel). More...
 
ValueOnCIter cbeginValueOn () const
 Return an iterator over all of this grid's active values (tile and voxel). More...
 
ValueOffIter beginValueOff ()
 Return an iterator over all of this grid's inactive values (tile and voxel). More...
 
ValueOffCIter beginValueOff () const
 Return an iterator over all of this grid's inactive values (tile and voxel). More...
 
ValueOffCIter cbeginValueOff () const
 Return an iterator over all of this grid's inactive values (tile and voxel). More...
 
ValueAllIter beginValueAll ()
 Return an iterator over all of this grid's values (tile and voxel). More...
 
ValueAllCIter beginValueAll () const
 Return an iterator over all of this grid's values (tile and voxel). More...
 
ValueAllCIter cbeginValueAll () const
 Return an iterator over all of this grid's values (tile and voxel). More...
 
TreePtrType treePtr ()
 Return a pointer to this grid's tree, which might be shared with other grids. The pointer is guaranteed to be non-null. More...
 
ConstTreePtrType treePtr () const
 Return a pointer to this grid's tree, which might be shared with other grids. The pointer is guaranteed to be non-null. More...
 
ConstTreePtrType constTreePtr () const
 Return a pointer to this grid's tree, which might be shared with other grids. The pointer is guaranteed to be non-null. More...
 
virtual TreeBase::ConstPtr constBaseTreePtr () const
 Return a pointer to this grid's tree, which might be shared with other grids. The pointer is guaranteed to be non-null. More...
 
TreeTypetree ()
 Return a reference to this grid's tree, which might be shared with other grids. More...
 
const TreeTypetree () const
 Return a reference to this grid's tree, which might be shared with other grids. More...
 
const TreeTypeconstTree () const
 Return a reference to this grid's tree, which might be shared with other grids. More...
 
TreeBase::Ptr baseTreePtr ()
 Return a pointer to this grid's tree, which might be shared with other grids. The pointer is guaranteed to be non-null. More...
 
TreeBase::ConstPtr baseTreePtr () const
 Return a pointer to this grid's tree, which might be shared with other grids. The pointer is guaranteed to be non-null. More...
 
TreeBasebaseTree ()
 Return a reference to this grid's tree, which might be shared with other grids. More...
 
const TreeBasebaseTree () const
 Return a reference to this grid's tree, which might be shared with other grids. More...
 
const TreeBaseconstBaseTree () const
 Return a reference to this grid's tree, which might be shared with other grids. More...
 
math::Transform::Ptr transformPtr ()
 Return a pointer to this grid's transform, which might be shared with other grids. More...
 
math::Transform::ConstPtr transformPtr () const
 Return a pointer to this grid's transform, which might be shared with other grids. More...
 
math::Transform::ConstPtr constTransformPtr () const
 Return a pointer to this grid's transform, which might be shared with other grids. More...
 
math::Transformtransform ()
 Return a reference to this grid's transform, which might be shared with other grids. More...
 
const math::Transformtransform () const
 Return a reference to this grid's transform, which might be shared with other grids. More...
 
const math::TransformconstTransform () const
 Return a reference to this grid's transform, which might be shared with other grids. More...
 
Vec3d indexToWorld (const Vec3d &xyz) const
 Apply this grid's transform to the given coordinates. More...
 
Vec3d indexToWorld (const Coord &ijk) const
 Apply this grid's transform to the given coordinates. More...
 
Metadata::Ptr operator[] (const Name &)
 
Metadata::ConstPtr operator[] (const Name &) const
 
template<typename T >
T::Ptr getMetadata (const Name &name)
 
template<typename T >
T::ConstPtr getMetadata (const Name &name) const
 

Static Public Member Functions

static Ptr create (const ValueType &background)
 Return a new grid with the given background value. More...
 
static Ptr create ()
 Return a new grid with background value zero. More...
 
static Ptr create (TreePtrType)
 Return a new grid that contains the given tree. More...
 
static Ptr create (const GridBase &other)
 Return a new, empty grid with the same transform and metadata as the given grid and with background value zero. More...
 
static Name gridType ()
 Return the name of this type of grid. More...
 
static bool isRegistered ()
 Return true if this grid type is registered. More...
 
static void registerGrid ()
 Register this grid type along with a factory function. More...
 
static void unregisterGrid ()
 Remove this grid type from the registry. More...
 
static Ptr createGrid (const Name &type)
 Create a new grid of the given (registered) type. More...
 
static bool isRegistered (const Name &type)
 Return true if the given grid type name is registered. More...
 
static void clearRegistry ()
 Clear the grid type registry. More...
 
static std::string gridClassToString (GridClass)
 Return the metadata string value for the given class of volumetric data. More...
 
static std::string gridClassToMenuName (GridClass)
 Return a formatted string version of the grid class. More...
 
static GridClass stringToGridClass (const std::string &)
 Return the class of volumetric data specified by the given string. More...
 
static std::string vecTypeToString (VecType)
 Return the metadata string value for the given type of vector data. More...
 
static std::string vecTypeExamples (VecType)
 
static std::string vecTypeDescription (VecType)
 Return a string describing how the given type of vector data is affected by transformations (e.g., "Does not transform", given VEC_INVARIANT). More...
 
static VecType stringToVecType (const std::string &)
 
template<typename GridType >
static GridType::Ptr grid (const GridBase::Ptr &)
 Return the result of downcasting a GridBase pointer to a Grid pointer of the specified type, or return a null pointer if the types are incompatible. More...
 
template<typename GridType >
static GridType::ConstPtr grid (const GridBase::ConstPtr &)
 Return the result of downcasting a GridBase pointer to a Grid pointer of the specified type, or return a null pointer if the types are incompatible. More...
 
template<typename GridType >
static GridType::ConstPtr constGrid (const GridBase::Ptr &)
 Return the result of downcasting a GridBase pointer to a Grid pointer of the specified type, or return a null pointer if the types are incompatible. More...
 
template<typename GridType >
static GridType::ConstPtr constGrid (const GridBase::ConstPtr &)
 Return the result of downcasting a GridBase pointer to a Grid pointer of the specified type, or return a null pointer if the types are incompatible. More...
 

Static Public Attributes

static const char *const META_GRID_CLASS
 
static const char *const META_GRID_CREATOR
 
static const char *const META_GRID_NAME
 
static const char *const META_SAVE_HALF_FLOAT
 
static const char *const META_IS_LOCAL_SPACE
 
static const char *const META_VECTOR_TYPE
 
static const char *const META_FILE_BBOX_MIN
 
static const char *const META_FILE_BBOX_MAX
 
static const char *const META_FILE_COMPRESSION
 
static const char *const META_FILE_MEM_BYTES
 
static const char *const META_FILE_VOXEL_COUNT
 

Static Protected Member Functions

static void registerGrid (const Name &type, GridFactory)
 Register a grid type along with a factory function. More...
 
static void unregisterGrid (const Name &type)
 Remove a grid type from the registry. More...
 

Detailed Description

template<typename>
class openvdb::v1_2_0::Grid< typename >

Container class that associates a tree with a transform and metadata.

Member Typedef Documentation

typedef tree::ValueAccessor<_TreeType> Accessor
typedef tree::ValueAccessor<const _TreeType> ConstAccessor
typedef MetadataMap::const_iterator ConstMetaIterator
inherited
typedef boost::shared_ptr<const Grid> ConstPtr
typedef _TreeType::ConstPtr ConstTreePtrType
typedef Ptr(* GridFactory)()
inherited
typedef std::map<Name, Metadata::Ptr> MetadataMap
inherited
typedef MetadataMap::iterator MetaIterator
inherited
typedef boost::shared_ptr<Grid> Ptr
typedef _TreeType::Ptr TreePtrType
typedef _TreeType TreeType
typedef _TreeType::ValueAllCIter ValueAllCIter
typedef _TreeType::ValueAllIter ValueAllIter
typedef _TreeType::ValueOffCIter ValueOffCIter
typedef _TreeType::ValueOffIter ValueOffIter
typedef _TreeType::ValueOnCIter ValueOnCIter
typedef _TreeType::ValueOnIter ValueOnIter
typedef _TreeType::ValueType ValueType

Constructor & Destructor Documentation

Grid ( )
inline

Construct a new grid with background value zero.

Grid ( const ValueType background)
inlineexplicit

Construct a new grid with the given background value.

Grid ( TreePtrType  tree)
inlineexplicit

Construct a new grid that shares the given tree and associates with it an identity linear transform.

Exceptions
ValueErrorif the tree pointer is null
Grid ( const Grid< typename > &  other)
inline

Deep copy another grid's metadata, transform and tree.

Grid ( const Grid< typename > &  other,
ShallowCopy   
)
inline

Deep copy another grid's metadata, but share its tree and transform.

Grid ( const GridBase other)
inline

Deep copy another grid's metadata and transform, but construct a new tree with background value zero.

virtual ~Grid ( )
inlinevirtual

Member Function Documentation

virtual Index64 activeVoxelCount ( ) const
inlinevirtual

Return the number of active voxels.

Implements GridBase.

void addStatsMetadata ( )
inherited

Add metadata to this grid comprising the current values of statistics like the active voxel count and bounding box.

Note
This metadata is not automatically kept up-to-date with changes to this grid.
const ValueType& background ( ) const
inline

Return this grid's background value.

TreeBase& baseTree ( )
inlineinherited

Return a reference to this grid's tree, which might be shared with other grids.

Note
Calling setTree() on this grid invalidates all references previously returned by this method.
const TreeBase& baseTree ( ) const
inlineinherited

Return a reference to this grid's tree, which might be shared with other grids.

Note
Calling setTree() on this grid invalidates all references previously returned by this method.
TreeBase::Ptr baseTreePtr ( )
inlineinherited

Return a pointer to this grid's tree, which might be shared with other grids. The pointer is guaranteed to be non-null.

TreeBase::ConstPtr baseTreePtr ( ) const
inlineinherited

Return a pointer to this grid's tree, which might be shared with other grids. The pointer is guaranteed to be non-null.

MetaIterator beginMeta ( )
inlineinherited

Functions for iterating over the Metadata.

ConstMetaIterator beginMeta ( ) const
inlineinherited
ValueAllIter beginValueAll ( )
inline

Return an iterator over all of this grid's values (tile and voxel).

ValueAllCIter beginValueAll ( ) const
inline

Return an iterator over all of this grid's values (tile and voxel).

ValueOffIter beginValueOff ( )
inline

Return an iterator over all of this grid's inactive values (tile and voxel).

ValueOffCIter beginValueOff ( ) const
inline

Return an iterator over all of this grid's inactive values (tile and voxel).

ValueOnIter beginValueOn ( )
inline

Return an iterator over all of this grid's active values (tile and voxel).

ValueOnCIter beginValueOn ( ) const
inline

Return an iterator over all of this grid's active values (tile and voxel).

ValueAllCIter cbeginValueAll ( ) const
inline

Return an iterator over all of this grid's values (tile and voxel).

ValueOffCIter cbeginValueOff ( ) const
inline

Return an iterator over all of this grid's inactive values (tile and voxel).

ValueOnCIter cbeginValueOn ( ) const
inline

Return an iterator over all of this grid's active values (tile and voxel).

virtual void clear ( )
inlinevirtual

Empty this grid, so that all voxels become inactive background voxels.

Implements GridBase.

void clearGridClass ( )
inherited

Remove the setting specifying the class of this grid's volumetric data.

void clearMetadata ( )
inlineinherited
static void clearRegistry ( )
staticinherited

Clear the grid type registry.

void clearVectorType ( )
inherited

Remove the setting specifying the type of vector data stored in this grid.

const TreeBase& constBaseTree ( ) const
inlineinherited

Return a reference to this grid's tree, which might be shared with other grids.

Note
Calling setTree() on this grid invalidates all references previously returned by this method.
virtual TreeBase::ConstPtr constBaseTreePtr ( ) const
inlinevirtual

Return a pointer to this grid's tree, which might be shared with other grids. The pointer is guaranteed to be non-null.

Implements GridBase.

static GridType::ConstPtr constGrid ( const GridBase::Ptr )
staticinherited

Return the result of downcasting a GridBase pointer to a Grid pointer of the specified type, or return a null pointer if the types are incompatible.

static GridType::ConstPtr constGrid ( const GridBase::ConstPtr )
staticinherited

Return the result of downcasting a GridBase pointer to a Grid pointer of the specified type, or return a null pointer if the types are incompatible.

GridType::ConstPtr constGrid ( const GridBase::Ptr grid)
inlineinherited
GridType::ConstPtr constGrid ( const GridBase::ConstPtr grid)
inlineinherited
const math::Transform& constTransform ( ) const
inlineinherited

Return a reference to this grid's transform, which might be shared with other grids.

Note
Calling setTransform() on this grid invalidates all references previously returned by this method.
math::Transform::ConstPtr constTransformPtr ( ) const
inlineinherited

Return a pointer to this grid's transform, which might be shared with other grids.

const TreeType& constTree ( ) const
inline

Return a reference to this grid's tree, which might be shared with other grids.

Note
Calling setTree() on this grid invalidates all references previously returned by this method.
ConstTreePtrType constTreePtr ( ) const
inline

Return a pointer to this grid's tree, which might be shared with other grids. The pointer is guaranteed to be non-null.

Grid< TreeT >::Ptr copy ( CopyPolicy  treePolicy = CP_SHARE) const
inline

Return a new grid of the same type as this grid and whose metadata and transform are deep copies of this grid's.

If treePolicy is CP_NEW, give the new grid a new, empty tree; if CP_SHARE, the new grid shares this grid's tree and transform; if CP_COPY, the new grid's tree is a deep copy of this grid's tree and transform

GridBase::Ptr copyGrid ( CopyPolicy  treePolicy = CP_SHARE) const
inlinevirtual

Return a new grid of the same type as this grid and whose metadata and transform are deep copies of this grid's.

If treePolicy is CP_NEW, give the new grid a new, empty tree; if CP_SHARE, the new grid shares this grid's tree and transform; if CP_COPY, the new grid's tree is a deep copy of this grid's tree and transform

Implements GridBase.

MetaMap::Ptr copyMeta ( ) const
inherited

Return a copy of this map whose fields are shared with this map.

Grid< TreeT >::Ptr create ( const ValueType background)
inlinestatic

Return a new grid with the given background value.

Grid< TreeT >::Ptr create ( )
inlinestatic

Return a new grid with background value zero.

Grid< TreeT >::Ptr create ( TreePtrType  tree)
inlinestatic

Return a new grid that contains the given tree.

Exceptions
ValueErrorif the tree pointer is null
Grid< TreeT >::Ptr create ( const GridBase other)
inlinestatic

Return a new, empty grid with the same transform and metadata as the given grid and with background value zero.

static Ptr createGrid ( const Name type)
staticinherited

Create a new grid of the given (registered) type.

Ptr deepCopy ( ) const
inline

Return a new grid whose metadata, transform and tree are deep copies of this grid's.

virtual GridBase::Ptr deepCopyGrid ( ) const
inlinevirtual

Return a new grid whose metadata, transform and tree are deep copies of this grid's.

Implements GridBase.

MetaMap::Ptr deepCopyMeta ( ) const
inherited

Return a deep copy of this map that shares no data with this map.

virtual bool empty ( ) const
inlinevirtual

Return true if this grid contains only inactive background voxels.

Implements GridBase.

MetaIterator endMeta ( )
inlineinherited
ConstMetaIterator endMeta ( ) const
inlineinherited
CoordBBox evalActiveVoxelBoundingBox ( ) const
inlinevirtual

Return the axis-aligned bounding box of all active voxels.

Implements GridBase.

Coord evalActiveVoxelDim ( ) const
inlinevirtual

Return the dimensions of the axis-aligned bounding box of all active voxels.

Implements GridBase.

void evalMinMax ( ValueType minVal,
ValueType maxVal 
) const
inline

Return the minimum and maximum active values in this grid.

void fill ( const CoordBBox bbox,
const ValueType value,
bool  active = true 
)
inline

Set all voxels within a given axis-aligned box to a constant value.

Parameters
bboxinclusive coordinates of opposite corners of an axis-aligned box
valuethe value to which to set voxels within the box
activeif true, mark voxels within the box as active, otherwise mark them as inactive
Note
This operation generates a sparse, but not always optimally sparse, representation of the filled box. Follow fill operations with a prune() operation for optimal sparseness.
Accessor getAccessor ( )
inline

Return an accessor that provides random read and write access to this grid's voxels.

ConstAccessor getAccessor ( ) const
inline

Return an accessor that provides random read-only access to this grid's voxels.

ConstAccessor getConstAccessor ( ) const
inline

Return an accessor that provides random read-only access to this grid's voxels.

std::string getCreator ( ) const
inherited

Return the user-specified description of this grid's creator.

GridClass getGridClass ( ) const
inherited

Return the class of volumetric data (level set, fog volume, etc.) stored in this grid.

T::Ptr getMetadata ( const Name name)
inlineinherited
Returns
pointer to TypedMetadata, NULL if type and name mismatch.
T::ConstPtr getMetadata ( const Name name) const
inlineinherited
Returns
pointer to TypedMetadata, NULL if type and name mismatch.
std::string getName ( ) const
inherited

Return this grid's user-specified name.

MetaMap::Ptr getStatsMetadata ( ) const
inherited

Return a new MetaMap containing just the metadata that was added to this grid with addStatsMetadata().

If addStatsMetadata() was never called on this grid, return an empty MetaMap.

VecType getVectorType ( ) const
inherited

Return the type of vector data (invariant, covariant, etc.) stored in this grid, assuming that this grid contains a vector-valued tree.

static GridType::Ptr grid ( const GridBase::Ptr )
staticinherited

Return the result of downcasting a GridBase pointer to a Grid pointer of the specified type, or return a null pointer if the types are incompatible.

static GridType::ConstPtr grid ( const GridBase::ConstPtr )
staticinherited

Return the result of downcasting a GridBase pointer to a Grid pointer of the specified type, or return a null pointer if the types are incompatible.

GridType::Ptr grid ( const GridBase::Ptr grid)
inlineinherited
GridType::ConstPtr grid ( const GridBase::ConstPtr grid)
inlineinherited
static std::string gridClassToMenuName ( GridClass  )
staticinherited

Return a formatted string version of the grid class.

static std::string gridClassToString ( GridClass  )
staticinherited

Return the metadata string value for the given class of volumetric data.

static Name gridType ( )
inlinestatic

Return the name of this type of grid.

bool hasUniformVoxels ( ) const
inlineinherited

Return true if the voxels in world space are uniformly sized cubes.

Vec3d indexToWorld ( const Vec3d xyz) const
inlineinherited

Apply this grid's transform to the given coordinates.

Vec3d indexToWorld ( const Coord ijk) const
inlineinherited

Apply this grid's transform to the given coordinates.

void insertMeta ( const Name name,
const Metadata metadata 
)
inherited

Insert a new metadata or overwrite existing. If Metadata with given name doesn't exist, a new Metadata field is added. If it does exist and given metadata is of the same type, then overwrite existing with new value. If it does exist and not of the same type, then throw an exception.

Parameters
namethe name of the metadata.
metadatathe actual metadata to store.
bool isInWorldSpace ( ) const
inherited

Return true if this grid's voxel values are in world space and should be affected by transformations, false if they are in local space and should not be affected by transformations.

static bool isRegistered ( const Name type)
staticinherited

Return true if the given grid type name is registered.

static bool isRegistered ( )
inlinestatic

Return true if this grid type is registered.

bool isType ( ) const
inlineinherited

Return true if this grid is of the same type as the template parameter.

virtual Index64 memUsage ( ) const
inlinevirtual

Return the number of bytes of memory used by this grid.

Implements GridBase.

void merge ( Grid< typename > &  other)
inline

Transfer active voxels from another grid to this grid wherever those voxels coincide with inactive voxels in this grid.

Note
This operation always empties the other tree.
size_t metaCount ( ) const
inlineinherited
T & metaValue ( const Name name)
inlineinherited
Returns
direct access to the underlying value stored by the given metadata name. Here T is the type of the value stored. If there is a mismatch, then throws an exception.
const T & metaValue ( const Name name) const
inlineinherited
void newTree ( )
inlinevirtual

Associate a new, empty tree with this grid, in place of its existing tree.

Note
The new tree has the same background value as the existing tree.

Implements GridBase.

Metadata::Ptr operator[] ( const Name name)
inlineinherited
Returns
a pointer to the metadata with the given name, NULL if no such field exists.
Metadata::ConstPtr operator[] ( const Name name) const
inlineinherited
Returns
a pointer to the metadata with the given name, NULL if no such field exists.
void print ( std::ostream &  os = std::cout,
int  verboseLevel = 1 
) const
inlinevirtual

Output a human-readable description of this grid.

Implements GridBase.

void prune ( const ValueType tolerance = zeroVal<ValueType>())
inline

Reduce the memory footprint of this grid by increasing its sparseness either losslessly (tolerance = 0) or lossily (tolerance > 0).

With tolerance > 0, sparsify regions where voxels have the same active state and have values that differ by no more than the tolerance.

void pruneGrid ( float  tolerance = 0.0)
inlinevirtual

Reduce the memory footprint of this grid by increasing its sparseness.

Implements GridBase.

void readBuffers ( std::istream &  is)
inlinevirtual

Read all data buffers for this grid.

Implements GridBase.

void readMeta ( std::istream &  )
inherited

Read in all the Meta information the given stream.

void readTopology ( std::istream &  is)
inlinevirtual

Read the grid topology from a stream. This will read only the grid structure, not the actual data buffers.

Implements GridBase.

void readTransform ( std::istream &  is)
inlineinherited

Read in the transform for this grid.

static void registerGrid ( const Name type,
GridFactory   
)
staticprotectedinherited

Register a grid type along with a factory function.

static void registerGrid ( )
inlinestatic

Register this grid type along with a factory function.

void removeMeta ( const Name name)
inherited

Removes an existing metadata field from the grid. If the metadata with the given name doesn't exist, do nothing.

Parameters
namethe name of the metadata field to remove.
bool saveFloatAsHalf ( ) const
inherited

Return true if this grid should be written out with floating-point voxel values (including components of vectors) quantized to 16 bits.

void setBackground ( const ValueType val)
inline

Replace this grid's background value.

void setCreator ( const std::string &  )
inherited

Provide a description of this grid's creator.

void setGridClass ( GridClass  )
inherited

Specify the class of volumetric data (level set, fog volume, etc.) stored in this grid.

void setIsInWorldSpace ( bool  )
inherited

Specify whether this grid's voxel values are in world space or in local space.

void setName ( const std::string &  )
inherited

Specify a name for this grid.

void setSaveFloatAsHalf ( bool  )
inherited
void setTransform ( math::Transform::Ptr  xform)
inlineinherited

Associate the given transform with this grid, in place of its existing transform.

Exceptions
ValueErrorif the transform pointer is null
Note
Invalidates all references previously returned by transform() or constTransform().
void setTree ( TreeBase::Ptr  tree)
inlinevirtual

Associate the given tree with this grid, in place of its existing tree.

Exceptions
ValueErrorif the tree pointer is null
TypeErrorif the tree is not of type TreeType
Note
Invalidates all references previously returned by baseTree(), constBaseTree(), tree() or constTree().

Implements GridBase.

void setVectorType ( VecType  )
inherited

Specify the type of vector data (invariant, covariant, etc.) stored in this grid, assuming that this grid contains a vector-valued tree.

void signedFloodFill ( )
inline

Set the values of all inactive voxels and tiles of a narrow-band level set from the signs of the active voxels, setting outside values to +background and inside values to -background.

Note
This operation should only be used on closed, narrow-band level sets!
void signedFloodFill ( const ValueType outside,
const ValueType inside 
)
inline

Set the values of all inactive voxels and tiles of a narrow-band level set from the signs of the active voxels, setting outside values to outside and inside values to inside.

Also, set this grid's background value to outside.

Note
This operation should only be used on closed, narrow-band level sets! Also, inside should be negative, and outside should be larger than inside.
std::string str ( ) const
inherited
Returns
string representation of MetaMap
static GridClass stringToGridClass ( const std::string &  )
staticinherited

Return the class of volumetric data specified by the given string.

If the string is not one of the ones returned by gridClassToString(), return GRID_UNKNOWN.

static VecType stringToVecType ( const std::string &  )
staticinherited
void topologyUnion ( const Grid< OtherTreeType > &  other)
inline

Union this grid's set of active values with the active values of the other grid, whose value type may be different.

The resulting state of a value is active if the corresponding value was already active OR if it is active in the other grid. Also, a resulting value maps to a voxel if the corresponding value already mapped to a voxel OR if it is a voxel in the other grid. Thus, a resulting value can only map to a tile if the corresponding value already mapped to a tile AND if it is a tile value in other grid.

Note
This operation modifies only active states, not values. Specifically, active tiles and voxels in this grid are not changed, and tiles or voxels that were inactive in this grid but active in the other grid are marked as active in this grid but left with their original values.
math::Transform& transform ( )
inlineinherited

Return a reference to this grid's transform, which might be shared with other grids.

Note
Calling setTransform() on this grid invalidates all references previously returned by this method.
const math::Transform& transform ( ) const
inlineinherited

Return a reference to this grid's transform, which might be shared with other grids.

Note
Calling setTransform() on this grid invalidates all references previously returned by this method.
math::Transform::Ptr transformPtr ( )
inlineinherited

Return a pointer to this grid's transform, which might be shared with other grids.

math::Transform::ConstPtr transformPtr ( ) const
inlineinherited

Return a pointer to this grid's transform, which might be shared with other grids.

TreeType& tree ( )
inline

Return a reference to this grid's tree, which might be shared with other grids.

Note
Calling setTree() on this grid invalidates all references previously returned by this method.
const TreeType& tree ( ) const
inline

Return a reference to this grid's tree, which might be shared with other grids.

Note
Calling setTree() on this grid invalidates all references previously returned by this method.
TreePtrType treePtr ( )
inline

Return a pointer to this grid's tree, which might be shared with other grids. The pointer is guaranteed to be non-null.

ConstTreePtrType treePtr ( ) const
inline

Return a pointer to this grid's tree, which might be shared with other grids. The pointer is guaranteed to be non-null.

virtual Name type ( ) const
inlinevirtual

Return the name of this grid's type.

Implements GridBase.

static void unregisterGrid ( const Name type)
staticprotectedinherited

Remove a grid type from the registry.

static void unregisterGrid ( )
inlinestatic

Remove this grid type from the registry.

virtual Name valueType ( ) const
inlinevirtual

Return the name of the type of a voxel's value (e.g., "float" or "vec3d").

Implements GridBase.

static std::string vecTypeDescription ( VecType  )
staticinherited

Return a string describing how the given type of vector data is affected by transformations (e.g., "Does not transform", given VEC_INVARIANT).

static std::string vecTypeExamples ( VecType  )
staticinherited

Return a string listing examples of the given type of vector data (e.g., "Gradient/Normal", given VEC_COVARIANT).

static std::string vecTypeToString ( VecType  )
staticinherited

Return the metadata string value for the given type of vector data.

Vec3d voxelSize ( ) const
inlineinherited

Return the size of this grid's voxels.

Vec3d voxelSize ( const Vec3d xyz) const
inlineinherited

Return the size of this grid's voxel at position (x, y, z).

Note
Frustum and perspective transforms have position-dependent voxel size.
Vec3d worldToIndex ( const Vec3d xyz) const
inlineinherited

Apply the inverse of this grid's transform to the given coordinates.

void writeBuffers ( std::ostream &  os) const
inlinevirtual

Write out all data buffers for this grid.

Implements GridBase.

void writeMeta ( std::ostream &  ) const
inherited

Write out all the Meta information to the given stream.

void writeTopology ( std::ostream &  os) const
inlinevirtual

Write the grid topology to a stream. This will write only the grid structure, not the actual data buffers.

Implements GridBase.

void writeTransform ( std::ostream &  os) const
inlineinherited

Write out the transform for this grid.

Member Data Documentation

const char* const META_FILE_BBOX_MAX
staticinherited
const char* const META_FILE_BBOX_MIN
staticinherited
const char* const META_FILE_COMPRESSION
staticinherited
const char* const META_FILE_MEM_BYTES
staticinherited
const char* const META_FILE_VOXEL_COUNT
staticinherited
const char* const META_GRID_CLASS
staticinherited
const char* const META_GRID_CREATOR
staticinherited
const char* const META_GRID_NAME
staticinherited
const char* const META_IS_LOCAL_SPACE
staticinherited
const char* const META_SAVE_HALF_FLOAT
staticinherited
const char* const META_VECTOR_TYPE
staticinherited

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