File VolumeIndexer.h
-
namespace OpenVDS
Typedefs
-
using VolumeIndexer2D = VolumeIndexerBase<2>
-
using VolumeIndexer3D = VolumeIndexerBase<3>
-
using VolumeIndexer4D = VolumeIndexerBase<4>
-
using VolumeIndexer5D = VolumeIndexerBase<5>
-
using VolumeIndexer6D = VolumeIndexerBase<6>
-
template<int N>
struct VolumeIndexerBase : public OpenVDS::VolumeIndexerData Public Functions
-
inline int GetDataBlockNumSamples(int iDimension) const
Gets the number of samples for a dimension in the DataBlock
- Parameters:
iDimension – the DataBlock dimension
- Returns:
the number of samples in the dimension
-
inline int GetLocalChunkNumSamples(int iDimension) const
Get the number of samples for a dimension in the volume
- Parameters:
iDimension – the volume dimension
- Returns:
the number of samples in the dimension
-
inline IntVector<N> LocalIndexToVoxelIndex(const IntVector<N> &iLocalIndex) const
Converts a local index to a voxel index
- Parameters:
iLocalIndex – the local index to convert
- Returns:
the voxel index
-
inline FloatVector<N> LocalIndexToVoxelIndexFloat(const FloatVector<N> &iLocalIndex) const
Converts a float local index to a float voxel index
- Parameters:
iLocalIndex – the float local index to convert
- Returns:
the float voxel index
-
inline IntVector<N> LocalIndexToLocalChunkIndex(const IntVector<N> &iLocalIndex) const
Converts a local index to a local chunk index
- Parameters:
iLocalIndex – the local index to convert
- Returns:
the local chunk index
-
inline IntVector<N> VoxelIndexToLocalIndex(const IntVector<N> &iVoxelIndex) const
Converts a voxel index to a local index
- Parameters:
iVoxelIndex – the voxel index to convert
- Returns:
the local index
-
inline FloatVector<N> VoxelIndexToLocalIndexFloat(const FloatVector<N> &iVoxelIndex) const
Converts a float voxel index to a float local index
- Parameters:
iVoxelIndex – the float voxel index to convert
- Returns:
the float local index
-
inline FloatVector<N> VoxelIndexToVolumeSamplerLocalIndex(const FloatVector<N> &iVoxelIndex) const
Converts a float voxel index to a volume sampler local index. The volume sampler works like OpenGL textures so the first sample starts at 0.5.
- Parameters:
iVoxelIndex – the float voxel index to convert
- Returns:
the float volume sampler local index
-
inline IntVector<N> VoxelIndexToLocalChunkIndex(const IntVector<N> &iVoxelIndex) const
Converts a voxel index to a local chunk index
- Parameters:
iVoxelIndex – the voxel index to convert
- Returns:
the local chunk index
-
inline IntVector<N> LocalChunkIndexToLocalIndex(const IntVector<N> &iLocalChunkIndex) const
Converts a local chunk index to a local index
- Parameters:
iLocalChunkIndex – the local chunk index to convert
- Returns:
the local index
-
inline IntVector<N> LocalChunkIndexToVoxelIndex(const IntVector<N> &iLocalChunkIndex) const
Converts a local chunk index to a voxel index
- Parameters:
iLocalChunkIndex – the local chunk index to convert
- Returns:
the local voxel index
-
inline int VoxelIndexToDataIndex(const IntVector<N> &iVoxelIndex) const
Converts a voxel index to a data index
- Parameters:
iVoxelIndex – the voxel index to convert
- Returns:
the buffer offset for the voxel index
-
inline int LocalIndexToDataIndex(const IntVector<N> &iLocalIndex) const
Converts a local index to a data index
- Parameters:
iLocalIndex – the local index to convert
- Returns:
the buffer offset for the local index
-
inline int LocalChunkIndexToDataIndex(const IntVector<N> &iLocalChunkIndex) const
Converts a local chunk index to a data index
- Parameters:
iLocalChunkIndex – the local chunk index to convert
- Returns:
the buffer offset for the local chunk index
-
inline int VoxelIndexToBitDataIndex(const IntVector<N> &iVoxelIndex) const
Converts a voxel index to a bit data index
Used with the BitMask functions to read and write 1Bit data
See also
- Parameters:
iVoxelIndex – the voxel index to convert
- Returns:
the buffer offset (in number of bits) for the voxel index
-
inline int LocalIndexToBitDataIndex(const IntVector<N> &iLocalIndex) const
Converts a local index to a bit data index
Used with the BitMask functions to read and write 1Bit data
See also
- Parameters:
iLocalIndex – the local index to convert
- Returns:
the buffer offset (in number of bits) for the local index
-
inline int LocalChunkIndexToBitDataIndex(const IntVector<N> &iLocalChunkIndex) const
Converts a local chunk index to a bit data index
Used with the BitMask functions to read and write 1Bit data
See also
- Parameters:
iLocalChunkIndex – the local chunk index to convert
- Returns:
the buffer offset (in number of bits) for the local chunk index
-
inline unsigned char BitMaskFromLocalIndex(const IntVector<N> &iLocalIndex) const
Gets the bit mask for a local index
Used with the BitDataIndex functions to read and write 1Bit data
Common usage:
bool bit = buffer[LocalIndexToBitDataIndex(iLocalIndex) / 8] & BitMaskFromLocalIndex(iLocalIndex) != 0;
See also
- Parameters:
iLocalIndex – the local index to compute the mask from
- Returns:
the bit mask for the local index
-
inline unsigned char BitMaskFromVoxelIndex(const IntVector<N> &iVoxelIndex) const
Gets the bit mask for a voxel index
Used with the BitDataIndex functions to read and write 1Bit data
Common usage:
bool bit = buffer[VoxelIndexToBitDataIndex(iVoxelIndex) / 8] & BitMaskFromVoxelIndex(iVoxelIndex) != 0;
See also
- Parameters:
iVoxelIndex – the voxel index to compute the mask from
- Returns:
the bit mask for the voxel index
-
inline unsigned char BitMaskFromLocalChunkIndex(const IntVector<N> &iLocalChunkIndex) const
Gets the bit mask for a local chunk index
Used with the BitDataIndex functions to read and write 1Bit data
Common usage:
bool bit = buffer[LocalChunkIndexToBitDataIndex(iLocalChunkIndex) / 8] & BitMaskFromLocalChunkIndex(iLocalChunkIndex) != 0;
See also
- Parameters:
iLocalChunkIndex – the local index to compute the mask from
- Returns:
the bit mask for the local chunk index
-
inline bool BitValueFromLocalIndex(const unsigned char *data, const IntVector<N> &iLocalIndex) const
Convenience function for reading the bit value from a 1Bit DataBlock buffer at a local index
See also
See also
- Parameters:
data – the 1Bit buffer to read
iLocalIndex – the local index to read
- Returns:
the binary value read
-
inline bool BitValueFromVoxelIndex(const unsigned char *data, const IntVector<N> &iVoxelIndex) const
Convenience function for reading the bit value from a 1Bit DataBlock buffer at a voxel index
See also
See also
- Parameters:
data – the 1Bit buffer to read
iVoxelIndex – the voxel index to read
- Returns:
the binary value read
-
inline bool BitValueFromLocalChunkIndex(const unsigned char *data, const IntVector<N> &iLocalChunkIndex) const
Convenience function for reading the bit value from a 1Bit DataBlock buffer at a local chunk index
See also
See also
- Parameters:
data – the 1Bit buffer to read
iLocalChunkIndex – the local chunk index to read
- Returns:
the binary value read
-
inline bool VoxelIndexInProcessArea(const IntVector<N> &iVoxelIndex) const
Checks if a voxel index is within the chunk this indexer was created with
- Parameters:
iVoxelIndex – the voxel index to check
- Returns:
true if the index is within this chunk, false otherwise
-
inline bool LocalIndexInProcessArea(const IntVector<N> &iLocalIndex) const
Checks if a local index is within the DataBlock this indexer was created with
- Parameters:
iLocalIndex – the local index to check
- Returns:
true if the index is within this chunk, false otherwise
-
inline bool LocalChunkIndexInProcessArea(const IntVector<N> &iLocalChunkIndex) const
Checks if a local chunk index is within the chunk this indexer was created with
- Parameters:
iLocalChunkIndex – the local chunk index to check
- Returns:
true if the index is within this chunk, false otherwise
-
inline float GetCoordinateStep(int iDimension) const
Gets the coordinate step for the given volume dimension at LOD 0
- Parameters:
iDimension – the volume dimension
- Returns:
the coordinate step at LOD 0
-
inline FloatVector<N> LocalIndexToCoordinate(const IntVector<N> &iLocalIndex) const
Converts a local index to coordinates
- Parameters:
iLocalIndex – the local index to convert
- Returns:
the coordinates
-
inline float VoxelIndexToCoordinate(int iVoxelIndex, int iDimension) const
Converts a voxel index for a specific volume dimension to a coordinate value
- Parameters:
iVoxelIndex – the voxel index to convert
iDimension – the volume dimension
- Returns:
the coordinate
-
inline float VoxelIndexFloatToCoordinate(float rVoxelIndex, int iDimension) const
Converts a float voxel index for a specific volume dimension to a coordinate value
- Parameters:
rVoxelIndex – the voxel index to convert
iDimension – the volume dimension
- Returns:
the coordinate
-
inline IntVector<N> CoordinateToLocalIndex(const FloatVector<N> &rCoordinate) const
Converts coordinates to a local index, rounding to the nearest integer
- Parameters:
rCoordinate – the coordinates to convert
- Returns:
the local index
-
inline FloatVector<N> CoordinateToLocalIndexFloat(const FloatVector<N> &rCoordinate) const
Converts coordinates to a float local index without rounding
- Parameters:
rCoordinate – the coordinates to convert
- Returns:
the float local index
-
inline FloatVector<N> CoordinateToVolumeSamplerLocalIndex(const FloatVector<N> &rCoordinate) const
Converts coordinates to a volume sampler local index. The volume sampler works like OpenGL textures so the first sample starts at 0.5.
- Parameters:
rCoordinate – the coordinates to convert
- Returns:
the float volume sampler local index
-
inline int CoordinateToVoxelIndex(float rCoordinate, int iDimension) const
Converts a coordinate for a specific volume dimension to a voxel index, rounding to the nearest integer
- Parameters:
rCoordinate – the coordinate to convert
iDimension – the volume dimension
- Returns:
the voxel index
-
inline float CoordinateToVoxelIndexFloat(float rCoordinate, int iDimension) const
Converts a coordinate for a specific volume dimension to a float voxel index without rounding
- Parameters:
rCoordinate – the coordinate to convert
iDimension – the volume dimension
- Returns:
the float voxel index
-
inline FloatVector<N> LocalIndexToRelativeAxisPosition(const IntVector<N> &iLocalIndex) const
Converts a local index to a relative position (between 0 and 1) along the volume axes
- Parameters:
iLocalIndex – the local index to convert
- Returns:
the relative position along volume axes
-
inline IntVector<N> RelativeAxisPositionToLocalIndex(const FloatVector<N> &rPosition) const
Converts a relative position along the volume axes to a local index
- Parameters:
rPosition – the relative postion to convert
- Returns:
the local index
-
inline float VoxelIndexToRelativeAxisPosition(int iVoxelIndex, int iDimension) const
Converts a voxel index for a specific dimension to a relative position (between 0 and 1) along a volume axis
- Parameters:
iVoxelIndex – the voxel index to convert
iDimension – the volume dimension
- Returns:
the relative position along the iDimension axis
-
inline int RelativeAxisPositionToVoxelIndex(float rPosition, int iDimension) const
Converts a relative volume axis position to a voxel index, rounding to the nears integer
- Parameters:
rPosition – the axis position
iDimension – the volume dimension
- Returns:
the voxel index
-
inline FloatVector<3> VoxelIndexToWorldCoordinates(const IntVector<N> &iVoxelIndex, const VDSCoordinateTransformerBase<N> &cVDSCoordinateTransformer) const
Converts a voxel index to world coordinates using the coordinate transformer’s IJK grid definition and IJK dimension map
- Parameters:
iVoxelIndex – the voxel index to convert
cVDSCoordinateTransformer – the coordinate transformer to use
- Returns:
the world coordinates
-
inline FloatVector<3> VoxelIndexToWorldCoordinates(const FloatVector<N> &rVoxelIndex, const VDSCoordinateTransformerBase<N> &cVDSCoordinateTransformer) const
Converts a float voxel index to world coordinates using the coordinate transformer’s IJK grid definition and IJK dimension map
- Parameters:
rVoxelIndex – the float voxel index to convert
cVDSCoordinateTransformer – the coordinate transformer to use
- Returns:
the world coordinates
-
inline IntVector<N> WorldCoordinatesToVoxelIndex(const FloatVector<3> &rWorldCoords, const VDSCoordinateTransformerBase<N> &cVDSCoordinateTransformer) const
Converts world coordinates to a voxel index, rounding to the nearest integer
- Parameters:
rWorldCoords – the world coordinates to convert
cVDSCoordinateTransformer – the coordinate transformer to use
- Returns:
the voxel index
-
inline FloatVector<N> WorldCoordinatesToVoxelIndexFloat(const FloatVector<3> &rWorldCoords, const VDSCoordinateTransformerBase<N> &cVDSCoordinateTransformer) const
Converts world coordinates to a float voxel index without rounding
- Parameters:
rWorldCoords – the world coordinates to convert
cVDSCoordinateTransformer – the coordinate transformer to use
- Returns:
the float voxel index
-
inline FloatVector<3> LocalIndexToWorldCoordinates(const IntVector<N> &iLocalIndex, const VDSCoordinateTransformerBase<N> &cVDSCoordinateTransformer) const
Converts a local index to world coordinates using the coordinate transformer’s IJK grid definition and IJK dimension map
- Parameters:
iLocalIndex – the local index to convert
cVDSCoordinateTransformer – the coordinate transformer to use
- Returns:
the world coordinates
-
inline IntVector<N> WorldCoordinatesToLocalIndex(const FloatVector<3> &rWorldCoords, const VDSCoordinateTransformerBase<N> &cVDSCoordinateTransformer) const
Converts world coordinates to a local index, rounding to the nearest integer
- Parameters:
rWorldCoords – the world coordinates to convert
cVDSCoordinateTransformer – the coordinate transformer to use
- Returns:
the local index
-
inline VolumeIndexerBase()
-
inline VolumeIndexerBase(const VolumeDataPage *page, int32_t channelIndex, int32_t lod, DimensionsND dimensions, const VolumeDataLayout *layout)
Public Static Functions
-
static inline unsigned char BitMaskFromBitDataIndex(int iBitDataIndex)
Gets the bit mask for a bit data index
Used with the BitDataIndex functions to read and write 1Bit data
Common usage:
bool bit = buffer[iBitDataIndex >> 3] &
BitMaskFromBitDataIndex(iBitDataIndex) != 0;- Parameters:
iBitDataIndex – the local index to compute the mask from
- Returns:
the bit mask for the local index
-
static inline bool BitValueFromBitDataIndex(const unsigned char *data, int iBitDataIndex)
Convenience function for reading the bit value from a 1Bit DataBlock buffer at a local index
See also
- Parameters:
data – the 1Bit buffer to read
iBitDataIndex – the bit index to read
- Returns:
the binary value read
-
static inline VolumeIndexerBase<N> CreateTempBufferIndexer(int (&anVoxelMin)[6], int (&anVoxelMax)[6], int iLOD = 0)
Creates an indexer for a temp buffer from voxel minimum and maximums.
- Parameters:
anVoxelMin – voxel minimum for this indexer
anVoxelMax – voxel maximum for this indexer
iLOD – the LOD for this indexer
- Returns:
the created indexer
-
static inline VolumeIndexerBase<N> CreateTempBufferIndexer(const VolumeIndexerBase<N> &indexer)
Create a temp buffer indexer with the same area and configuration as another indexer.
- Parameters:
indexer – the indexer to copy configuration and area from
- Returns:
the created indexer
-
static inline VolumeIndexerBase<N> CreateTempBufferIndexer(const VolumeIndexerBase<N> &indexer, int anNewVoxelMin[6], int anNewVoxelMax[6])
Create a temp buffer indexer with the same configuration as another indexer, but a new voxel min and max
- Parameters:
indexer – the indexer to copy configuration from
anNewVoxelMin – the voxel minimum for the created indexer
anNewVoxleMax – the voxel maximum for the created indexer
- Returns:
the created indexer
-
inline int GetDataBlockNumSamples(int iDimension) const
-
struct VolumeIndexerData
Subclassed by OpenVDS::VolumeIndexerBase< N >
Public Functions
-
inline VolumeIndexerData()
-
VolumeIndexerData(const VolumeDataPage *page, int32_t channelIndex, int32_t lod, DimensionsND dimensions, const VolumeDataLayout *layout)
Public Members
-
int32_t voxelMin[Dimensionality_Max]
Minimum voxel range in volume dimensions.
-
int32_t voxelMax[Dimensionality_Max]
Maximum voxel range in volume dimensions.
-
int32_t localChunkSamples[Dimensionality_Max]
Number of samples in volume dimensions.
-
int32_t localChunkAllocatedSize[Dimensionality_Max]
Allocated size of buffer in volume dimensions.
-
int32_t pitch[Dimensionality_Max]
Pitch for buffer in volume dimensions.
-
int32_t bitPitch[Dimensionality_Max]
Pitch for bits in volume dimensions.
-
int32_t dataBlockSamples[DataBlockDimensionality_Max]
Number of sample in DataBlock dimensions.
-
int32_t dataBlockAllocatedSize[DataBlockDimensionality_Max]
Allocated size of buffer in DataBlock dimensions.
-
int32_t dataBlockPitch[DataBlockDimensionality_Max]
Pitch for buffer in DataBlock dimensions.
-
int32_t dataBlockBitPitch[DataBlockDimensionality_Max]
Pitch for bits in DataBlock dimensions.
-
int32_t dimensionMap[DataBlockDimensionality_Max]
Map from DataBlock dimensions to volume dimensions.
-
int32_t lod
Level of Detail for data being indexed.
-
bool isDimensionLODDecimated[Dimensionality_Max]
Indicates if a volume dimension is decimated with the LOD or not.
-
float coordinateMin[Dimensionality_Max]
Minimum coordinates in volume dimensions.
-
float coordinateMax[Dimensionality_Max]
Maximum coordinates in volume dimensions.
-
int axisNumSamples[Dimensionality_Max]
Total number of samples in volume dimensions for whole volume (not just this chunk)
-
float valueRangeMin
The value range minimum for the volume.
-
float valueRangeMax
The value range maximum for the volume.
Public Static Attributes
-
static constexpr int DataBlockDimensionality_Max = 4
-
inline VolumeIndexerData()
-
using VolumeIndexer2D = VolumeIndexerBase<2>