pyopenvdb.Vec3SGrid

Module pyopenvdb :: Class Vec3SGrid |
[hide private]
[frames] | no frames]

# Class Vec3SGrid

     object --+
              |
    ??.instance --+
                  |
                 Vec3SGrid

OpenVDB grid with voxels of type vec3s

Nested Classes | [hide private]
| Accessor Read/write access by (i, j, k) index coordinates to the voxels of a Vec3SGrid
| ConstAccessor Read-only access by (i, j, k) index coordinates to the voxels of a Vec3SGrid
| Value Proxy for a tile or voxel value in a Vec3SGrid
| ValueAllCIter Read-only iterator over all tile and voxel values of a Vec3SGrid
| ValueAllIter Read/write iterator over all tile and voxel values of a Vec3SGrid
| ValueOffCIter Read-only iterator over the inactive values (tile and voxel) of a Vec3SGrid
| ValueOffIter Read/write iterator over the inactive values (tile and voxel) of a Vec3SGrid
| ValueOnCIter Read-only iterator over the active values (tile and voxel) of a Vec3SGrid
| ValueOnIter Read/write iterator over the active values (tile and voxel) of a Vec3SGrid

Instance Methods | [hide private]
bool |
__contains__(name) Return True if this grid contains metadata with the given name. |
__delitem__(name) Remove the metadata with the given name. |
value |
__getitem__(name) Return the metadata value associated with the given name. |
__getstate__(...) |
__init__(...) Initialize with a background value of (0.0, 0.0, 0.0). |
iterator |
__iter__() Return an iterator over this grid's metadata keys. |
__nonzero__(...) |
__reduce__(...) helper for pickle |
__setitem__(name, value) Add metadata to this grid, replacing any existing item having the same name as the new item. |
__setstate__(...) |
int |
activeLeafVoxelCount() Return the number of active voxels that are stored in the leaf nodes of this grid's tree. |
int |
activeVoxelCount() Return the number of active voxels in this grid. |
addStatsMetadata() Add metadata to this grid comprising the current values of statistics like the active voxel count and bounding box. |
iterator |
citerAllValues() Return a read-only iterator over all of this grid's tile and voxel values. |
iterator |
citerOffValues() Return a read-only iterator over this grid's inactive tile and voxel values. |
iterator |
citerOnValues() Return a read-only iterator over this grid's active tile and voxel values. |
clear() Remove all tiles from this grid and all nodes other than the root node. |
combine(grid, function) Compute function(self, other) over all corresponding pairs of values (tile or voxel) of this grid and the other grid and store the result in this grid. |
points, triangles, quads |
convertToPolygons(isovalue=0, adaptivity=0) Adaptively mesh a scalar grid that has a continuous isosurface at the given isovalue. |
points, quads |
convertToQuads(isovalue=0) Uniformly mesh a scalar grid that has a continuous isosurface at the given isovalue. |
Vec3SGrid |
copy() Return a shallow copy of this grid, i.e., a grid that shares its voxel data with this grid. |
copyFromArray(array, ijk=(0, 0, 0), tolerance=0) Populate this grid, starting at voxel (i, j, k), with values from a four-dimensional array. |
copyToArray(array, ijk=(0, 0, 0)) Populate a four-dimensional array with values from this grid, starting at voxel (i, j, k). |
Vec3SGrid |
deepCopy() Return a deep copy of this grid. |
bool |
empty() Return True if this grid contains only background voxels. |
xyzMin, xyzMax |
evalActiveVoxelBoundingBox() Return the coordinates of opposite corners of the axis-aligned bounding box of all active voxels. |
x, y, z |
evalActiveVoxelDim() Return the dimensions of the axis-aligned bounding box of all active voxels. |
xyzMin, xyzMax |
evalLeafBoundingBox() Return the coordinates of opposite corners of the axis-aligned bounding box of all leaf nodes. |
x, y, z |
evalLeafDim() Return the dimensions of the axis-aligned bounding box of all leaf nodes. |
min, max |
evalMinMax() Return the minimum and maximum active values in this grid. |
fill(min, max, value, active=True) Set all voxels within a given axis-aligned box to a constant value (either active or inactive). |
Vec3SGridAccessor |
getAccessor() Return an accessor that provides random read and write access to this grid's voxels. |
Vec3SGridAccessor |
getConstAccessor() Return an accessor that provides random read-only access to this grid's voxels. |
min, max |
getIndexRange() Return the minimum and maximum coordinates that are represented in this grid. |
dict |
getStatsMetadata() Return a (possibly empty) dict containing just the metadata that was added to this grid with addStatsMetadata(). |
str |
info(verbosity=1) Return a string containing information about this grid with a specified level of verbosity. |
iterator |
iterAllValues() Return a read/write iterator over all of this grid's tile and voxel values. |
iterator |
iterOffValues() Return a read/write iterator over this grid's inactive tile and voxel values. |
iterator |
iterOnValues() Return a read/write iterator over this grid's active tile and voxel values. |
iterator |
iterkeys() Return an iterator over this grid's metadata keys. |
int |
leafCount() Return the number of leaf nodes in this grid's tree. |
mapAll(function) Iterate over all values (tile and voxel) of this grid and replace each value with function(value). |
mapOff(function) Iterate over all the inactive ("off") values (tile and voxel) of this grid and replace each value with function(value). |
mapOn(function) Iterate over all the active ("on") values (tile and voxel) of this grid and replace each value with function(value). |
int |
memUsage() Return the memory usage of this grid in bytes. |
merge(Vec3SGrid) Move child nodes from the other grid into this grid wherever those nodes correspond to constant-value tiles in this grid, and replace leaf-level inactive voxels in this grid with corresponding voxels in the other grid that are active. |
nodeLog2Dims(...) list of Log2Dims of the nodes of this grid's tree in order from root to leaf |
int |
nonLeafCount() Return the number of non-leaf nodes in this grid's tree. |
prune(tolerance=0) Remove nodes whose values all have the same active state and are equal to within a given tolerance. |
pruneInactive(value=None) Remove nodes whose values are all inactive and replace them with either background tiles or tiles of the given value (if the value is not None). |
bool |
sharesWith(Vec3SGrid) Return True if this grid shares its voxel data with the given grid. |
signedFloodFill() Propagate the sign from a narrow-band level set into inactive voxels and tiles. |
updateMetadata(dict) Add metadata to this grid, replacing any existing items having the same names as the new items. |
Inherited from `unreachable.instance`: `__new__` Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Static Methods | [hide private]
Vec3SGrid |
createLevelSetFromPolygons(points, triangles=None, quads=None, transform=None, halfWidth=3) Convert a triangle and/or quad mesh to a narrow-band level set volume. |

Class Variables | [hide private]
| __getstate_manages_dict__ = `True`
| __instance_size__ = `32`
| __safe_for_unpickling__ = `True`

Properties | [hide private]
| background value of this grid's background voxels
| creator description of this grid's creator
| gridClass the class of volumetric data (level set, fog volume, etc.) stored in this grid
| metadata dict of this grid's metadata
| name this grid's name
| oneValue
| saveFloatAsHalf if True, write floating-point voxel values as 16-bit half floats
| transform transform associated with this grid
| treeDepth depth of this grid's tree from root node to leaf node
| valueTypeName
| vectorType how transforms are applied to values stored in this grid
| zeroValue
Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(...) (Constructor) |
Initialize with a background value of (0.0, 0.0, 0.0). Initialize with the given background value. Overrides: object.__init__

### __reduce__(...) |
helper for pickle Overrides: object.__reduce__ (inherited documentation)

### addStatsMetadata() |
Add metadata to this grid comprising the current values of statistics like the active voxel count and bounding box. (This metadata is not automatically kept up-to-date with changes to this grid.)

### combine(grid, function) |
Compute function(self, other) over all corresponding pairs of values (tile or voxel) of this grid and the other grid and store the result in this grid. Note: this operation always empties the other grid. Example: grid.combine(otherGrid, lambda a, b: min(a, b))

### convertToPolygons(isovalue=0, adaptivity=0) |
Adaptively mesh a scalar grid that has a continuous isosurface at the given isovalue. Return a NumPy array of world-space points and NumPy arrays of 3- and 4-tuples of point indices, which specify the vertices of the triangles and quadrilaterals that form the mesh. Adaptivity can vary from 0 to 1, where 0 produces a high-polygon-count mesh that closely approximates the isosurface, and 1 produces a lower-polygon-count mesh with some loss of surface detail. Returns: points, triangles, quads

### convertToQuads(isovalue=0) |
Uniformly mesh a scalar grid that has a continuous isosurface at the given isovalue. Return a NumPy array of world-space points and a NumPy array of 4-tuples of point indices, which specify the vertices of the quadrilaterals that form the mesh. Returns: points, quads

### copyFromArray(array, ijk=(0, 0, 0), tolerance=0) |
Populate this grid, starting at voxel (i, j, k), with values from a four-dimensional array. Mark voxels as inactive if and only if their values are equal to this grid's background value within the given tolerance.

### createLevelSetFromPolygons(points, triangles=None, quads=None, transform=None, halfWidth=3) Static Method |
Convert a triangle and/or quad mesh to a narrow-band level set volume. The mesh must form a closed surface, but the surface need not be manifold and may have self intersections and degenerate faces. The mesh is described by a NumPy array of world-space points and NumPy arrays of 3- and 4-tuples of point indices that specify the vertices of the triangles and quadrilaterals that form the mesh. Either the triangle or the quad array may be empty or None. The resulting volume will have the given transform (or the identity transform if no transform is given) and a narrow band width of 2 x halfWidth voxels. Returns: Vec3SGrid

### getIndexRange() |
Return the minimum and maximum coordinates that are represented in this grid. These might include background voxels. Returns: min, max

### mapAll(function) |
Iterate over all values (tile and voxel) of this grid and replace each value with function(value). Example: grid.mapAll(lambda x: x * 2 if x < 0.5 else x)

### mapOff(function) |
Iterate over all the inactive ("off") values (tile and voxel) of this grid and replace each value with function(value). Example: grid.mapOff(lambda x: x * 2 if x < 0.5 else x)

### mapOn(function) |
Iterate over all the active ("on") values (tile and voxel) of this grid and replace each value with function(value). Example: grid.mapOn(lambda x: x * 2 if x < 0.5 else x)

### merge(Vec3SGrid) |
Move child nodes from the other grid into this grid wherever those nodes correspond to constant-value tiles in this grid, and replace leaf-level inactive voxels in this grid with corresponding voxels in the other grid that are active. Note: this operation always empties the other grid.

Property Details | [hide private]

### background value of this grid's background voxels Get Method: unreachable(...) Set Method: unreachable(...)

### creator description of this grid's creator Get Method: unreachable(...) Set Method: unreachable(...)

### gridClass the class of volumetric data (level set, fog volume, etc.) stored in this grid Get Method: unreachable(...) Set Method: unreachable(...)

### metadata dict of this grid's metadata Setting this attribute replaces all of this grid's metadata, but mutating it in place has no effect on the grid, since the value of this attribute is a only a copy of the metadata. Use either indexing or updateMetadata() to mutate metadata in place. Get Method: unreachable(...) Set Method: unreachable(...)

### name this grid's name Get Method: unreachable(...) Set Method: unreachable(...)

### oneValue Get Method: unreachable(...)

### saveFloatAsHalf if True, write floating-point voxel values as 16-bit half floats Get Method: unreachable(...) Set Method: unreachable(...)

### transform transform associated with this grid Get Method: unreachable(...) Set Method: unreachable(...)

### treeDepth depth of this grid's tree from root node to leaf node Get Method: unreachable(...)

### valueTypeName Get Method: unreachable(...)

### vectorType how transforms are applied to values stored in this grid Get Method: unreachable(...) Set Method: unreachable(...)

### zeroValue Get Method: unreachable(...)