[][src]Module nifti::volume::ndarray

Interfaces and implementations specific to integration with ndarray.

This module introduces the trait IntoNdArray, which is implemented for all NIfTI volume types and enable their mapping into an Array with a dynamic number of dimensions and an abitrary element type. The affine scaling of the values (from the scl_slope and scl_inter attributes) are also considered in this transformation.

A target element type needs to be provided at compile time, which is usually the data type that the user wishes to work the array with. If the source and target types do not match, each voxel is cast in a way as to avoid loss of precision.

Note on memory order

NIfTI volumes are usually stored in disk in column major order (also called Fortran order). As such, the array resulting from this operation will also be in this memory order, rather than the usual row major order (AKA C ordering). When accessing the array, one should consider any potential bottlenecks emerging from this ordering in their data processing pipelines. Namely, it might be faster to produce output arrays in column major order as well.

Traits

IntoNdArray

Trait for volumes which can be converted to an ndarray.