Trait nifti::volume::NiftiVolume [] [src]

pub trait NiftiVolume {
    fn dim(&self) -> &[u16];
    fn get_f32(&self, coords: &[u16]) -> Result<f32>;
    fn get_f64(&self, coords: &[u16]) -> Result<f64>;
    fn data_type(&self) -> NiftiType;

    fn dimensionality(&self) -> usize { ... }
}

Public API for NIFTI volume data, exposed as a multi-dimensional voxel array.

This API is currently experimental and will likely be subjected to various changes and additions in future versions.

Required Methods

Get the dimensions of the volume. Unlike how NIFTI-1 stores dimensions, the returned slice does not include dim[0] and is clipped to the effective number of dimensions.

Fetch a single voxel's value in the given voxel index coordinates as a single precision floating point value. All necessary conversions and transformations are made when reading the voxel, including scaling. Note that using this function continuously to traverse the volume is inefficient. Prefer using iterators or the ndarray API for volume traversal.

Errors

  • NiftiError::OutOfBounds if the given coordinates surpass this volume's boundaries.

Fetch a single voxel's value in the given voxel index coordinates as a double precision floating point value. All necessary conversions and transformations are made when reading the voxel, including scaling. Note that using this function continuously to traverse the volume is inefficient. Prefer using iterators or the ndarray API for volume traversal.

Errors

  • NiftiError::OutOfBounds if the given coordinates surpass this volume's boundaries.

Get this volume's data type.

Provided Methods

Get the volume's number of dimensions. In a fully compliant file, this is equivalent to the corresponding header's dim[0] field (with byte swapping already applied).

Implementors