Octree topology queries More...
#include <LDM/SoLDMTopoOctree.h>
Inherited by SoVRLdmFileBorderReader::SoLDMBorderTopoOctree.
Public Member Functions | |
SoLDMTopoOctree () | |
void | init (const SbVec3i32 &dimension, const int tileDim, const int border=0) |
SbBox3i32 | getTilePos (const SoLDMTileID &tileID) const |
SoLDMTileID | getTileID (const SbVec3i32 &cellPos, const int resolutionLevel) const |
int | getNumFileIDs () const |
size_t | getNumTileIDs () const |
int | getFileID (const SoLDMTileID &tileID) const |
SoLDMTileID | getTileID (const int fileID) const |
bool | isEmpty () const |
int | getLevelMax () const |
int | level (const SoLDMTileID &id) const |
int | level (const LDM_TILE_ID_TYPE index) const |
SbVec3i32 | getTileSize () const |
The SoLDMTopoOctree class provides information about the hierarchy of LDM tiles used for a given dataset, which depends only on the dataset dimensions and the tile dimensions.
For example, an application can query the total number of LDM tiles in a data set, the number of resolution levels in the LDM tile hierarchy, the id of the tile that contains a specified voxel position, the position and extent of a specified tile id, and more. An application can conveniently query the SoLDMTopoOctree for an actual data set using the SoDataSet::getLDMTopoOctree() method or create an LDMTopoOctree object with any specified dimensions. In the latter case, the LDMTopoOctree must be initialized using the init() method.
In VolumeViz LDM every tile has both a tileID and a fileID. The tileID is the unique identifier of a tile in the (conceptual) complete, symmetrical hierarchy. The fileID is the index of a tile in a sequential numbering of all the tiles that actually contain data. The tileID is normally used to identify tiles in an application, but the fileID is used, for example, when calling the readTile method in an SoVolumeReader class. In a cubical volume (all three dimensions the same), there are equal numbers of tileIDs and fileIDs, but in most volumes there are many fewer fileIDs than tileIDs.
The terms 'resolution' and 'level' are both used in this class to identify a specific level in the LDM tile hierarchy.
SoLDMTopoOctree::SoLDMTopoOctree | ( | ) |
Constructor.
int SoLDMTopoOctree::getFileID | ( | const SoLDMTileID & | tileID | ) | const [inline] |
Given a tileID, returns the corresponding fileID.
int SoLDMTopoOctree::getLevelMax | ( | ) | const |
Returns the maximum level of the octree tile hierarchy.
Example: If there are 3 levels in the octree, returns 2. Note: Octree must be initialized.
int SoLDMTopoOctree::getNumFileIDs | ( | ) | const |
Returns the number of fileIDs in the volume.
Effectively this is the total number of actual tiles, including both full resolution and low resolution, required to store the data set. This value is <= getNumTileIDs().
size_t SoLDMTopoOctree::getNumTileIDs | ( | ) | const [inline] |
Returns the number of tileIDs in the complete (conceptual) octree.
The complete octree is based on the power-of-2 greater than or equal to the actual volume dimensions. This value is >= getNumFileIDs().
SoLDMTileID SoLDMTopoOctree::getTileID | ( | const int | fileID | ) | const |
Given a fileID, returns the corresponding tileID.
SoLDMTileID SoLDMTopoOctree::getTileID | ( | const SbVec3i32 & | cellPos, | |
const int | resolutionLevel | |||
) | const |
Given the position of a voxel in full resolution voxel coordinates (i,j,k) and a resolution level, returns the tile ID of the corresponding tile.
Resolution level is counted up from the bottom of the tile hierarchy, so resolution level 0 is the full resolution tiles.
Regardless of the tile's resolution level in the LDM tile hierarchy, the returned bounding box is always in full-resolution voxel coordinates. In other words, the box is the region of the full-resolution volume that the tile "spans" and the extent of this box is not the same as the tile size unless the specified tile is at resolution level 0 (full resolution).
Example: If the volume is 256 x 256 x 256 with tile size 64
SbBox3i32 SoLDMTopoOctree::getTilePos | ( | const SoLDMTileID & | tileID | ) | const |
Returns the bounding box, in voxel/cell coordinates, of the specified tile.
Regardless the tile's resolution level in the LDM tile hierarchy, the returned bounding box is always in full-resolution voxel coordinates.
SbVec3i32 SoLDMTopoOctree::getTileSize | ( | ) | const [inline] |
Return the tilesize used to setup this octree.
void SoLDMTopoOctree::init | ( | const SbVec3i32 & | dimension, | |
const int | tileDim, | |||
const int | border = 0 | |||
) |
Initialize with the properties of the data set.
Note: Since OIV 9.0, the border parameter is no longer used.
bool SoLDMTopoOctree::isEmpty | ( | ) | const [inline] |
Returns false if the octree is empty.
Note: Octree must be initialized.
int SoLDMTopoOctree::level | ( | const LDM_TILE_ID_TYPE | index | ) | const |
Returns the tile level of the given tile Id.
Conversion: resolutionLevel = getLevelMax() - tileLevel. Note: Octree must be initialized.
int SoLDMTopoOctree::level | ( | const SoLDMTileID & | id | ) | const [inline] |
Returns the tile level of the given tile Id.
Conversion: resolutionLevel = getLevelMax() - tileLevel. Note: Octree must be initialized.