Trait nifti::volume::NiftiVolume
[−]
[src]
pub trait NiftiVolume { fn dim(&self) -> &[u16]; fn get_f64(&self, coords: &[u16]) -> Result<f64>; fn data_type(&self) -> NiftiType; fn dimensionality(&self) -> usize { ... } fn get_f32(&self, coords: &[u16]) -> Result<f32> { ... } }
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
fn dim(&self) -> &[u16]
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.
fn get_f64(&self, coords: &[u16]) -> Result<f64>
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.
fn data_type(&self) -> NiftiType
Get this volume's data type.
Provided Methods
fn dimensionality(&self) -> usize
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).
fn get_f32(&self, coords: &[u16]) -> Result<f32>
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.
Implementors
impl<'a> NiftiVolume for &'a InMemNiftiVolume
impl NiftiVolume for InMemNiftiVolume
impl<V> NiftiVolume for SliceView<V> where
V: NiftiVolume,