Struct OpenVDS::VolumeIndexerBase

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

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

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

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;

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;

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;

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

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

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

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

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