#[non_exhaustive]pub enum DynVolume {
U8(Volume<u8>),
I8(Volume<i8>),
U16(Volume<u16>),
I16(Volume<i16>),
U32(Volume<u32>),
I32(Volume<i32>),
F32(Volume<f32>),
F64(Volume<f64>),
}Expand description
A volume whose scalar type is determined at runtime.
This enum lets a consumer store any supported scalar flavour behind one
handle without carrying T as a generic parameter.
§VTK Equivalent
vtkImageData::GetScalarType() — a runtime tag rather than a compile-time type.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
U8(Volume<u8>)
Unsigned 8-bit integer voxels.
I8(Volume<i8>)
Signed 8-bit integer voxels.
U16(Volume<u16>)
Unsigned 16-bit integer voxels.
I16(Volume<i16>)
Signed 16-bit integer voxels (most common for CT Hounsfield units).
U32(Volume<u32>)
Unsigned 32-bit integer voxels.
I32(Volume<i32>)
Signed 32-bit integer voxels.
F32(Volume<f32>)
32-bit floating-point voxels.
F64(Volume<f64>)
64-bit floating-point voxels.
Implementations§
Source§impl DynVolume
impl DynVolume
Sourcepub fn as_bytes(&self) -> &[u8] ⓘ
pub fn as_bytes(&self) -> &[u8] ⓘ
Raw byte slice of the underlying voxel data, suitable for GPU upload.
Sourcepub fn scalar_range(&self) -> (f64, f64)
pub fn scalar_range(&self) -> (f64, f64)
The (min, max) scalar range, normalised to f64.
Sourcepub fn sample_linear(&self, ijk: DVec3) -> Option<f64>
pub fn sample_linear(&self, ijk: DVec3) -> Option<f64>
Sample with trilinear interpolation at a continuous voxel index.
Sourcepub fn bytes_per_component(&self) -> usize
pub fn bytes_per_component(&self) -> usize
Number of bytes per scalar component.
Trait Implementations§
Source§impl VolumeInfo for DynVolume
impl VolumeInfo for DynVolume
Source§fn dimensions(&self) -> UVec3
fn dimensions(&self) -> UVec3
Number of voxels along each axis:
[nx, ny, nz].Source§fn spacing(&self) -> DVec3
fn spacing(&self) -> DVec3
Physical size of each voxel in world units (typically millimetres).
Source§fn direction(&self) -> DMat3
fn direction(&self) -> DMat3
3×3 orientation matrix whose columns are the axis directions.
For axis-aligned volumes this is the identity matrix.
Source§fn components(&self) -> u32
fn components(&self) -> u32
Number of scalar values stored per voxel (1 for grayscale).
Source§fn index_to_world(&self, ijk: DVec3) -> DVec3
fn index_to_world(&self, ijk: DVec3) -> DVec3
Convert a continuous voxel index
(i, j, k) to world coordinates. Read moreSource§fn world_to_index(&self, xyz: DVec3) -> DVec3
fn world_to_index(&self, xyz: DVec3) -> DVec3
Convert world coordinates to a continuous voxel index. Read more
Source§fn world_bounds(&self) -> Aabb
fn world_bounds(&self) -> Aabb
Axis-aligned bounding box enclosing all voxel centres in world space.
Auto Trait Implementations§
impl !Freeze for DynVolume
impl !RefUnwindSafe for DynVolume
impl Send for DynVolume
impl !Sync for DynVolume
impl Unpin for DynVolume
impl UnsafeUnpin for DynVolume
impl UnwindSafe for DynVolume
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more