Struct OpenVDS::IJKCoordinateTransformer

struct IJKCoordinateTransformer

IJKCoordinateTransformer may be used to transform between the following three-dimensional index and coordinate systems of a volume:

IJK Index - a 3D index into the volume based on IJK dimensions. Dimensions I and J are usually horizontal directions, whereas K is usually the vertical direction. Transforms are provided to/from integer IJK indexes and also floating-point IJK positions.

World Coordinate - a world position, related to IJK through the IJK grid definition provided on construction.

Annotation Coordinate - a coordinate position based on the annotation axes of the volume (inline, crossline, depth, time, etc.). The order of annotation coordinate values correspond to the volume axes for each IJK dimension. That is, the annotation coordinate X value specifies the coordinate for the annotation axis corresponding to the I direction, and so on. When used with a VDS, annotation coordinates are based on the VDS axis descriptors.

Voxel Index - a 3D index into the volume based on volume data dimesions, where dimension 0 is the data dimension that changes the fastest, dimension 1 is the data dimension that changes second fastest, etc. Transforms are provided to/from integer voxel indexes and also floating-point voxel positions. When used with a VDS, voxel index 0 refers to dimension 0, ranging from 0 to Dimension0Size - 1, and so on. The relationship between IJK dimensions and voxel dimensions is controlled by the IJK dimension map provided at construction. If the dimension map is (0, 1, 2), the IJK dimensions are the same as voxel dimensions. However, it is often the case that the dimension map is not (0, 1, 2), and so IJK dimensions are not the same as voxel dimensions, especially when used with a VDS. When used with a VDS, the dimension map is often set to (2, 1, 0), meaning that IJK corresponds to voxel dimensions (2, 1, 0). However, this is not a strict rule, and the dimension map will generally be defined based on the VDS axis descriptors. If a particular VDS axis is given the name “I”, “J”, or “K”, that axis index will be considered as dimension I, J, or K. This is not very common. If a particular VDS axis is given the name “Inline”, it will be considered as dimension I. If a particular VDS axis is given the name “Crossline”, it will be considered as dimension J. If a particular VDS axis is given the name “Time”, “Depth”, or “Sample”, it will be considered as dimension K.

Public Functions

inline IJKCoordinateTransformer()
inline IJKCoordinateTransformer(const IJKGridDefinition &ijkGridDefinition, const IntVector3 &ijkSize)
inline IJKCoordinateTransformer(const IJKGridDefinition &ijkGridDefinition, const IntVector3 &ijkSize, const IntVector3 &ijkToVoxelDimensionMap)
inline IJKCoordinateTransformer(const VDSIJKGridDefinition &vdsIJKGridDefinition, const IntVector3 &ijkSize)
inline IJKCoordinateTransformer(const IJKGridDefinition &ijkGridDefinition, const IntVector3 &ijkSize, const DoubleVector3 &ijkAnnotationStart, const DoubleVector3 &ijkAnnotationEnd)
inline IJKCoordinateTransformer(const IJKGridDefinition &ijkGridDefinition, const IntVector3 &ijkSize, const IntVector3 &ijkToVoxelDimensionMap, const DoubleVector3 &ijkAnnotationStart, const DoubleVector3 &ijkAnnotationEnd)
inline IJKCoordinateTransformer(const VDSIJKGridDefinition &vdsIJKGridDefinition, const IntVector3 &ijkSize, const DoubleVector3 &ijkAnnotationStart, const DoubleVector3 &ijkAnnotationEnd)
inline IJKCoordinateTransformer(const VolumeDataLayout *layout)
inline const IJKGridDefinition &IJKGrid() const

The IJK grid definition relating IJK coordinates to world XYZ coordinates.

inline const IntVector3 &IJKSize() const

The number of voxels in each IJK dimension.

inline const IntVector3 &IJKToVoxelDimensionMap() const

Mapping from IJK to voxel volume dimensions.

inline const DoubleMatrix4x4 &IJKToWorldTransform() const

The matrix used to transform from IJK coordinates to world coordinates.

inline const DoubleMatrix4x4 &WorldToIJKTransform() const

The matrix used to transform from world coordinates to IJK coordinates.

inline const DoubleVector3 &IJKAnnotationStart() const

The annotation start coordinates, corresponding to min IJK index (i.e. 0, 0, 0)

inline const DoubleVector3 &IJKAnnotationEnd() const

The annotation end coordinates, corresponding to max IJK index (i.e. IJKSize - (1, 1, 1))

inline bool AnnotationsDefined() const

Whether or not the annotation start/end coordinates are set, which defines the annotation coordinate system.

inline DoubleVector3 IJKPositionToWorld(const DoubleVector3 &ijkPosition) const

Transform the given IJK position to a world position.

inline DoubleVector3 IJKIndexToWorld(const IntVector3 &ijkIndex) const

Transform the given IJK index to a world position.

inline DoubleVector3 IJKPositionToAnnotation(const DoubleVector3 &ijkPosition) const

Transform the given IJK position to an annotation position.

inline DoubleVector3 IJKIndexToAnnotation(const IntVector3 &ijkIndex) const

Transform the given IJK index to an annotation position.

inline DoubleVector3 IJKPositionToVoxelPosition(const DoubleVector3 &ijkPosition) const

Transform the given IJK position to a voxel position.

inline IntVector3 IJKIndexToVoxelIndex(const IntVector3 &ijkIndex) const

Transform the given IJK index to a voxel index.

inline DoubleVector3 WorldToIJKPosition(const DoubleVector3 &worldPosition) const

Transform the given world position to a IJK position.

inline IntVector3 WorldToIJKIndex(const DoubleVector3 &worldPosition) const

Transform the given world position to a IJK index.

inline DoubleVector3 WorldToAnnotation(DoubleVector3 worldPosition) const

Transform the given world position to an annotation position.

inline DoubleVector3 WorldToVoxelPosition(const DoubleVector3 &worldPosition) const

Transform the given world position to a voxel position.

inline IntVector3 WorldToVoxelIndex(const DoubleVector3 &worldPosition) const

Transform the given world position to a voxel index.

inline DoubleVector3 AnnotationToIJKPosition(const DoubleVector3 &annotationPosition) const

Transform the given annotation position to a IJK position.

inline IntVector3 AnnotationToIJKIndex(const DoubleVector3 &annotationPosition) const

Transform the given annotation position to a IJK index.

inline DoubleVector3 AnnotationToWorld(DoubleVector3 annotationPosition) const

Transform the given annotation position to a world position.

inline DoubleVector3 AnnotationToVoxelPosition(const DoubleVector3 &annotationPosition) const

Transform the given annotation position to a voxel position.

inline IntVector3 AnnotationToVoxelIndex(const DoubleVector3 &annotationPosition) const

Transform the given annotation position to a voxel index.

inline DoubleVector3 VoxelPositionToIJKPosition(const DoubleVector3 &voxelPosition) const

Transform the given voxel position to an IJK position.

inline IntVector3 VoxelIndexToIJKIndex(const IntVector3 &voxelIndex) const

Transform the given voxel index to an IJK index.

inline DoubleVector3 VoxelPositionToWorld(const DoubleVector3 &voxelPosition) const

Transform the given voxel position to a world position.

inline DoubleVector3 VoxelIndexToWorld(const IntVector3 &voxelIndex) const

Transform the given voxel index to a world position.

inline DoubleVector3 VoxelPositionToAnnotation(const DoubleVector3 &voxelPosition) const

Transform the given voxel position to an annotation position.

inline DoubleVector3 VoxelIndexToAnnotation(const IntVector3 &voxelIndex) const

Transform the given voxel index to an annotation position.

inline bool IsIJKPositionOutOfRange(const DoubleVector3 &ijkPosition) const

Determine whether the given IJK position is out of range.

inline bool IsIJKIndexOutOfRange(const IntVector3 &ijkIndex) const

Determine whether the given IJK index is out of range.

inline bool IsVoxelPositionOutOfRange(const DoubleVector3 &voxelPosition) const

Determine whether the given voxel position is out of range.

inline bool IsVoxelIndexOutOfRange(const IntVector3 &voxelIndex) const

Determine whether the given voxel index is out of range.

inline IntVector3 ConvertIJKPositionToIndex(const DoubleVector3 &ijkPosition) const

Convert the given IJK position to IJK index. Return (-1, -1, -1) if any component is outside valid range.

inline IntVector3 ConvertVoxelPositionToIndex(const DoubleVector3 &voxelPosition) const

Convert the given voxel position to voxel index. Return (-1, -1, -1) if any component is outside valid range.

inline bool operator==(const IJKCoordinateTransformer &rhs) const

Equality operator.

inline int ErrorCodeIfIJKPositionOutOfRange(const DoubleVector3 &ijkPosition) const
inline int ErrorCodeIfVoxelPositionOutOfRange(const DoubleVector3 &voxelPosition) const