18 releases (breaking)

0.14.0 Jun 10, 2021
0.12.1 Jan 16, 2021
0.11.0 Nov 20, 2020
0.10.0 Jul 4, 2020
0.1.0 May 25, 2017

#167 in Parser implementations

Download history 54/week @ 2021-02-25 51/week @ 2021-03-04 45/week @ 2021-03-11 37/week @ 2021-03-18 105/week @ 2021-03-25 27/week @ 2021-04-01 113/week @ 2021-04-08 75/week @ 2021-04-15 18/week @ 2021-04-22 49/week @ 2021-04-29 14/week @ 2021-05-06 49/week @ 2021-05-13 30/week @ 2021-05-20 29/week @ 2021-05-27 8/week @ 2021-06-03 56/week @ 2021-06-10

194 downloads per month
Used in trk-io

MIT/Apache

185KB
3.5K SLoC

NIFTI-rs   Latest Version Continuous integration status dependency status

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

Example

Please see the documentation for more.

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

let obj = ReaderOptions::new().read_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, ReaderOptions};

let obj = ReaderOptions::new().read_file("myvolume.hdr.gz")?;

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

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

In addition, the nalgebra_affine feature unlocks the affine module, for useful affine transformations.

Roadmap

This library should hopefully fulfil a good number of use cases. However, not all features of the format are fully available. There are no deadlines for these features, so your help is much appreciated. Please visit the issue tracker and tracker for version 1.0. In case something is missing for your use case to work, please find an equivalent issue of file a new one. Pull requests are also welcome.

License

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.

Dependencies

~1–2.4MB
~49K SLoC