#standard #parser #nifti #neuroimaging

nifti

Rust implementation of the NIfTI file format

8 releases (4 breaking)

0.5.1 Sep 4, 2018
0.5.0 Feb 18, 2018
0.4.1 Jan 11, 2018
0.4.0 Dec 15, 2017
0.1.0 May 25, 2017

#31 in Parser implementations

Download history 43/week @ 2018-06-12 31/week @ 2018-06-19 86/week @ 2018-06-26 50/week @ 2018-07-03 44/week @ 2018-07-10 74/week @ 2018-07-17 109/week @ 2018-07-24 96/week @ 2018-07-31 62/week @ 2018-08-07 164/week @ 2018-08-14 95/week @ 2018-08-21 9/week @ 2018-08-28 24/week @ 2018-09-04

295 downloads per month
Used in 1 crate

MIT/Apache

642KB
2K 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).

Example

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().to_ndarray::<f32>();

Roadmap

This library should hopefully fulfil a good number of use cases. However, it still is a bit far from a complete solution. 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);
  • Maybe add support for NIFTI-2?

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.

License

Apache-2/MIT

Dependencies

~2.5MB
~51K SLoC