14 releases (breaking)

new 0.11.0 Nov 20, 2020
0.10.0 Jul 4, 2020
0.9.1 Mar 16, 2020
0.9.0 Oct 30, 2019
0.1.0 May 25, 2017

#89 in Parser implementations

Download history 7/week @ 2020-08-04 54/week @ 2020-08-11 105/week @ 2020-08-18 43/week @ 2020-08-25 49/week @ 2020-09-01 37/week @ 2020-09-08 10/week @ 2020-09-15 8/week @ 2020-09-22 52/week @ 2020-09-29 23/week @ 2020-10-06 17/week @ 2020-10-13 56/week @ 2020-10-20 7/week @ 2020-10-27 33/week @ 2020-11-03 23/week @ 2020-11-10 59/week @ 2020-11-17

130 downloads per month
Used in trk-io


3.5K SLoC

NIFTI-rs   Latest Version Build Status dependency status

This library is a pure Rust implementation for reading files in the NIfTI format (more specifically NIfTI-1.1).


Please see the documentation for more.

use nifti::{NiftiObject, InMemNiftiObject, NiftiVolume};

let obj = InMemNiftiObject::from_file("myvolume.nii.gz")?;
// use obj
let header = obj.header();
let volume = obj.volume();
let dims = volume.dim();

The library will automatically look for the respective volume when specifying just the header file:

use nifti::{NiftiObject, InMemNiftiObject};

let obj = InMemNiftiObject::from_file("myvolume.hdr.gz")?;

With the ndarray_volumes feature enabled, you can also convert a volume to an ndarray::Array and work from there:

let volume = obj.into_volume().into_ndarray::<f32>();


This library should hopefully fulfil a good number of use cases. However, some gaps are yet to be filled fill. In particular, future versions should be able to:

  • Write NIFTI files;
  • Provide a more elegant volume API;
  • Handle more kinds of volumes;
  • Provide a real spatial-temporal interpretation of the volume (rather than just voxel-indexed);

There are no deadlines for these features, so your help is much appreciated. Consider filing an issue in case something is missing for your use case to work. Pull requests are also welcome.


Licensed under either of

at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


~49K SLoC