#include <UT_VoxelArray.h>
Public Member Functions | |
| UT_VoxelArray () | |
| virtual | ~UT_VoxelArray () |
| UT_VoxelArray (const UT_VoxelArray< T > &src) | |
| Copy constructor:. | |
| const UT_VoxelArray< T > & | operator= (const UT_VoxelArray< T > &src) |
| Assignment operator:. | |
| void | size (int xres, int yres, int zres) |
| void | match (const UT_VoxelArray< T > &src) |
| bool | isMatching (const UT_VoxelArray< T > &src) const |
| int | getXRes () const |
| int | getYRes () const |
| int | getZRes () const |
| int | getRes (int axis) const |
| int64 | getMemoryUsage () const |
| Return the amount of memory used by this array. | |
| void | constant (T t) |
| bool | isConstant (T *cval=0) const |
| bool | hasNan () const |
| Returns true if any element of the voxel array is NAN. | |
| T | operator() (UT_Vector3D pos) const |
| T | operator() (UT_Vector3F pos) const |
| T | evaluate (const UT_Vector3 &pos, const UT_Filter &filter, fpreal radius) const |
| void | resample (const UT_VoxelArray< T > &src, UT_FilterType filtertype=UT_FILTER_POINT, float filterwidthscale=1.0f) |
| THREADED_METHOD3_CONST (UT_VoxelArray< T >, numTiles() > 16, flatten, T *, flatarray, int, ystride, int, zstride) void flattenPartial(T *flatarray | |
| THREADED_METHOD3 (UT_VoxelArray< T >, numTiles() > 16, extractFromFlattened, const T *, flatarray, int, ystride, int, zstride) void extractFromFlattenedPartial(const T *flatarray | |
| bool | posToIndex (UT_Vector3 pos, int &x, int &y, int &z) const |
| bool | posToIndex (UT_Vector3 pos, UT_Vector3 &ipos) const |
| bool | indexToPos (int x, int y, int z, UT_Vector3F &pos) const |
| bool | indexToPos (int x, int y, int z, UT_Vector3D &pos) const |
| void | clampIndex (int &x, int &y, int &z) const |
| bool | isValidIndex (int x, int y, int z) const |
| Returns true if the given x, y, z values lie inside the valid index. | |
| T | operator() (int x, int y, int z) const |
| void | setValue (int x, int y, int z, T t) |
| T | getValue (int x, int y, int z) const |
| void | setBorder (UT_VoxelBorderType type, T t) |
| void | setBorderScale (T scalex, T scaley, T scalez) |
| UT_VoxelBorderType | getBorder () const |
| T | getBorderValue () const |
| T | getBorderScale (int axis) const |
| void | collapseAllTiles () |
| void | expandAllTiles () |
| void | expandAllNonConstTiles () |
| UT_VoxelTile< T > * | getTile (int tx, int ty, int tz) const |
| UT_VoxelTile< T > * | getLinearTile (int idx) const |
| void | linearTileToXYZ (int idx, int &x, int &y, int &z) const |
| int | xyzTileToLinear (int x, int y, int z) const |
| int | indexToLinearTile (int x, int y, int z) const |
| int | getTileRes (int dim) const |
| int | numTiles () const |
| int64 | numVoxels () const |
| void | setCompressionOptions (const UT_VoxelCompressOptions &options) |
| const UT_VoxelCompressOptions & | getCompressionOptions () const |
| void | setCompressionTolerance (fpreal tol) |
| fpreal | getCompressionTolerance () const |
| void | saveData (ostream &os) |
| void | loadData (UT_IStream &is) |
| Load an array, requires you have already size()d this array. | |
Public Attributes | |
| int | ystride |
| int int | zstride |
| int int const UT_JobInfo &info | const |
| int int const UT_JobInfo & | info |
This provides data structure to hold a three dimmensional array of data. The data should be some simple arithmatic type, such as uint8, fpreal16, or UT_Vector3.
Some operations, such as gradiants, may make less sense with uint8.
Definition at line 510 of file UT_VoxelArray.h.
| UT_VoxelArray< T >::UT_VoxelArray | ( | ) | [inline] |
Definition at line 1537 of file UT_VoxelArray.C.
| UT_VoxelArray< T >::~UT_VoxelArray | ( | ) | [inline, virtual] |
Definition at line 1556 of file UT_VoxelArray.C.
| UT_VoxelArray< T >::UT_VoxelArray | ( | const UT_VoxelArray< T > & | src | ) | [inline] |
| void UT_VoxelArray< T >::clampIndex | ( | int & | x, | |
| int & | y, | |||
| int & | z | |||
| ) | const [inline] |
Clamps the given x, y, and z values to lie inside the valid index range.
Definition at line 621 of file UT_VoxelArray.h.
| void UT_VoxelArray< T >::collapseAllTiles | ( | ) | [inline] |
This tries to compress or collapse each tile. This can be expensive (ie, converting a tile to constant), so should be saved until modifications are complete.
Definition at line 2486 of file UT_VoxelArray.C.
| void UT_VoxelArray< T >::constant | ( | T | t | ) | [inline] |
Sets this voxel array to the given constant value. All tiles are turned into constant tiles.
Definition at line 1724 of file UT_VoxelArray.C.
| T UT_VoxelArray< T >::evaluate | ( | const UT_Vector3 & | pos, | |
| const UT_Filter & | filter, | |||
| fpreal | radius | |||
| ) | const [inline] |
Filtered evaluation of the voxel array. This operation should exhibit the same behavior as IMG3D_Channel::evaluate. Borders evaluate to 0 and the border type is ignored. radius is measured in voxels.
Definition at line 2172 of file UT_VoxelArray.C.
| void UT_VoxelArray< T >::expandAllNonConstTiles | ( | ) | [inline] |
Uncompresses all tiles, but leaves constant tiles alone. Useful for cleaning out any non-standard compression algorithm that some external program can't handle.
Definition at line 2512 of file UT_VoxelArray.C.
| void UT_VoxelArray< T >::expandAllTiles | ( | ) | [inline] |
Uncompresses all tiles into non-constant tiles. Useful if you have a multithreaded algorithm that may need to both read and write, if you write to a collapsed tile while someone else reads from it, bad stuff happens. Instead, you can expandAllTiles. This may have serious consequences in memory use, however.
Definition at line 2499 of file UT_VoxelArray.C.
| UT_VoxelBorderType UT_VoxelArray< T >::getBorder | ( | ) | const [inline] |
Definition at line 718 of file UT_VoxelArray.h.
| T UT_VoxelArray< T >::getBorderScale | ( | int | axis | ) | const [inline] |
Definition at line 720 of file UT_VoxelArray.h.
| T UT_VoxelArray< T >::getBorderValue | ( | ) | const [inline] |
Definition at line 719 of file UT_VoxelArray.h.
| const UT_VoxelCompressOptions& UT_VoxelArray< T >::getCompressionOptions | ( | ) | const [inline] |
Definition at line 772 of file UT_VoxelArray.h.
| fpreal UT_VoxelArray< T >::getCompressionTolerance | ( | ) | const [inline] |
Definition at line 777 of file UT_VoxelArray.h.
| UT_VoxelTile<T>* UT_VoxelArray< T >::getLinearTile | ( | int | idx | ) | const [inline] |
Definition at line 744 of file UT_VoxelArray.h.
| int64 UT_VoxelArray< T >::getMemoryUsage | ( | void | ) | const [inline] |
| int UT_VoxelArray< T >::getRes | ( | int | axis | ) | const [inline] |
Definition at line 541 of file UT_VoxelArray.h.
| UT_VoxelTile<T>* UT_VoxelArray< T >::getTile | ( | int | tx, | |
| int | ty, | |||
| int | tz | |||
| ) | const [inline] |
The direct tile access methods are to make TBF writing a bit more efficient.
Definition at line 742 of file UT_VoxelArray.h.
| int UT_VoxelArray< T >::getTileRes | ( | int | dim | ) | const [inline] |
Number of tiles along that axis. Not to be confused with the resolution of the individual tiles.
Definition at line 764 of file UT_VoxelArray.h.
| T UT_VoxelArray< T >::getValue | ( | int | x, | |
| int | y, | |||
| int | z | |||
| ) | const [inline] |
This will clamp the bounds to fit within the voxel array, using the border type to resolve out of range values.
Definition at line 657 of file UT_VoxelArray.h.
| int UT_VoxelArray< T >::getXRes | ( | ) | const [inline] |
Definition at line 538 of file UT_VoxelArray.h.
| int UT_VoxelArray< T >::getYRes | ( | ) | const [inline] |
Definition at line 539 of file UT_VoxelArray.h.
| int UT_VoxelArray< T >::getZRes | ( | ) | const [inline] |
Definition at line 540 of file UT_VoxelArray.h.
| bool UT_VoxelArray< T >::hasNan | ( | ) | const [inline] |
Returns true if any element of the voxel array is NAN.
Definition at line 1776 of file UT_VoxelArray.C.
| int UT_VoxelArray< T >::indexToLinearTile | ( | int | x, | |
| int | y, | |||
| int | z | |||
| ) | const [inline] |
Definition at line 759 of file UT_VoxelArray.h.
| bool UT_VoxelArray< T >::indexToPos | ( | int | x, | |
| int | y, | |||
| int | z, | |||
| UT_Vector3D & | pos | |||
| ) | const [inline] |
Definition at line 2444 of file UT_VoxelArray.C.
| bool UT_VoxelArray< T >::indexToPos | ( | int | x, | |
| int | y, | |||
| int | z, | |||
| UT_Vector3F & | pos | |||
| ) | const [inline] |
Converts an index into a position. Returns false if the source index was out of range, in which case pos will be outside [0..1]^3
Definition at line 2419 of file UT_VoxelArray.C.
| bool UT_VoxelArray< T >::isConstant | ( | T * | cval = 0 |
) | const [inline] |
If this voxel array is all constant tiles, returns true. The optional pointer is initialized to the constant value iff the array is constant. (Note by constant we mean made of constant tiles of the same value - if some tiles are uncompressed but constant, it will still return false)
Definition at line 1737 of file UT_VoxelArray.C.
| bool UT_VoxelArray< T >::isMatching | ( | const UT_VoxelArray< T > & | src | ) | const [inline] |
Definition at line 531 of file UT_VoxelArray.h.
| bool UT_VoxelArray< T >::isValidIndex | ( | int | x, | |
| int | y, | |||
| int | z | |||
| ) | const [inline] |
Returns true if the given x, y, z values lie inside the valid index.
Definition at line 629 of file UT_VoxelArray.h.
| void UT_VoxelArray< T >::linearTileToXYZ | ( | int | idx, | |
| int & | x, | |||
| int & | y, | |||
| int & | z | |||
| ) | const [inline] |
Definition at line 746 of file UT_VoxelArray.h.
| void UT_VoxelArray< T >::loadData | ( | UT_IStream & | is | ) | [inline] |
Load an array, requires you have already size()d this array.
Definition at line 2560 of file UT_VoxelArray.C.
| void UT_VoxelArray< T >::match | ( | const UT_VoxelArray< T > & | src | ) | [inline] |
This will ensure this voxel array matches the given voxel array in terms of dimensions & border conditions. It may invoke a size() and hence reset the field to 0.
Definition at line 1687 of file UT_VoxelArray.C.
| int UT_VoxelArray< T >::numTiles | ( | ) | const [inline] |
| int64 UT_VoxelArray< T >::numVoxels | ( | ) | const [inline] |
Definition at line 767 of file UT_VoxelArray.h.
| T UT_VoxelArray< T >::operator() | ( | int | x, | |
| int | y, | |||
| int | z | |||
| ) | const [inline] |
This allows you to read & write the raw data. Out of bound reads are illegal.
Definition at line 638 of file UT_VoxelArray.h.
| T UT_VoxelArray< T >::operator() | ( | UT_Vector3F | pos | ) | const [inline] |
Definition at line 1794 of file UT_VoxelArray.C.
| T UT_VoxelArray< T >::operator() | ( | UT_Vector3D | pos | ) | const [inline] |
This convience function lets you sample the voxel array. pos is in the range [0..1]^3. T value trilinearly interpolated. Edges are determined by the border mode. The cells are sampled at the center of the voxels.
Definition at line 1927 of file UT_VoxelArray.C.
| const UT_VoxelArray< T > & UT_VoxelArray< T >::operator= | ( | const UT_VoxelArray< T > & | src | ) | [inline] |
| bool UT_VoxelArray< T >::posToIndex | ( | UT_Vector3 | pos, | |
| UT_Vector3 & | ipos | |||
| ) | const [inline] |
Convertes a 3d position in [0..1]^3 into the equivalent in the integer cell space. Does not clamp to the closest value.
Definition at line 2392 of file UT_VoxelArray.C.
| bool UT_VoxelArray< T >::posToIndex | ( | UT_Vector3 | pos, | |
| int & | x, | |||
| int & | y, | |||
| int & | z | |||
| ) | const [inline] |
Converts a 3d position in range [0..1]^3 into the closest index value. Returns false if the resulting index was out of range. The index will still be set.
Definition at line 2371 of file UT_VoxelArray.C.
| void UT_VoxelArray< T >::resample | ( | const UT_VoxelArray< T > & | src, | |
| UT_FilterType | filtertype = UT_FILTER_POINT, |
|||
| float | filterwidthscale = 1.0f | |||
| ) | [inline] |
Fills this by resampling the given voxel array. Uses evaluate internally, so the same caveats apply regarding border behaviour.
Definition at line 2280 of file UT_VoxelArray.C.
| void UT_VoxelArray< T >::saveData | ( | ostream & | os | ) | [inline] |
Saves only the data of this array to the given stream. To reload it you will have to have a matching array in tiles dimensions and size. Not consta as unsupported compression engines will be uncompressed.
Definition at line 2526 of file UT_VoxelArray.C.
| void UT_VoxelArray< T >::setBorder | ( | UT_VoxelBorderType | type, | |
| T | t | |||
| ) | [inline] |
Definition at line 2469 of file UT_VoxelArray.C.
| void UT_VoxelArray< T >::setBorderScale | ( | T | scalex, | |
| T | scaley, | |||
| T | scalez | |||
| ) | [inline] |
Definition at line 2477 of file UT_VoxelArray.C.
| void UT_VoxelArray< T >::setCompressionOptions | ( | const UT_VoxelCompressOptions & | options | ) | [inline] |
Definition at line 770 of file UT_VoxelArray.h.
| void UT_VoxelArray< T >::setCompressionTolerance | ( | fpreal | tol | ) | [inline] |
Definition at line 775 of file UT_VoxelArray.h.
| void UT_VoxelArray< T >::setValue | ( | int | x, | |
| int | y, | |||
| int | z, | |||
| T | t | |||
| ) | [inline] |
Definition at line 646 of file UT_VoxelArray.h.
| void UT_VoxelArray< T >::size | ( | int | xres, | |
| int | yres, | |||
| int | zres | |||
| ) | [inline] |
This sets the voxelarray to have the given resolution, resetting all elements to 0.
Definition at line 1629 of file UT_VoxelArray.C.
| UT_VoxelArray< T >::THREADED_METHOD3 | ( | UT_VoxelArray< T > | , | |
| numTiles() | , | |||
| 16 | , | |||
| extractFromFlattened | , | |||
| const T * | , | |||
| flatarray | , | |||
| int | , | |||
| ystride | , | |||
| int | , | |||
| zstride | ||||
| ) | const |
Fills this from a flattened array. Z major, then Y, then X. setValue(x,y,z, flatarray[x + y * ystride + z * zstride];
| UT_VoxelArray< T >::THREADED_METHOD3_CONST | ( | UT_VoxelArray< T > | , | |
| numTiles() | , | |||
| 16 | , | |||
| flatten | , | |||
| T * | , | |||
| flatarray | , | |||
| int | , | |||
| ystride | , | |||
| int | , | |||
| zstride | ||||
| ) |
Flattens this into an array. Z major, then Y, then X. flatarray[x + y * ystride + z * zstride] = getValue(x, y, z);
| int UT_VoxelArray< T >::xyzTileToLinear | ( | int | x, | |
| int | y, | |||
| int | z | |||
| ) | const [inline] |
Definition at line 756 of file UT_VoxelArray.h.
| int int const UT_JobInfo& info UT_VoxelArray< T >::const |
Definition at line 591 of file UT_VoxelArray.h.
| int int const UT_JobInfo& UT_VoxelArray< T >::info |
Definition at line 602 of file UT_VoxelArray.h.
| int UT_VoxelArray< T >::ystride |
Definition at line 591 of file UT_VoxelArray.h.
| int int UT_VoxelArray< T >::zstride |
Definition at line 591 of file UT_VoxelArray.h.
1.5.9