Crate nifti [] [src]

Rust implementation of the NIfTI-1 file format.

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")?;

You can also convert a volume to an ndarray::Array and work from there:

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

Reexports

pub use error::NiftiError;
pub use error::Result;
pub use object::NiftiObject;
pub use object::InMemNiftiObject;
pub use extension::Extender;
pub use extension::Extension;
pub use extension::ExtensionSequence;
pub use header::NiftiHeader;
pub use header::NiftiHeaderBuilder;
pub use volume::NiftiVolume;
pub use volume::InMemNiftiVolume;
pub use typedef::NiftiType;
pub use typedef::Unit;
pub use typedef::Intent;
pub use typedef::XForm;
pub use typedef::SliceOrder;

Modules

error

Types for error handling go here.

extension

This module contains definitions for the extension and related types. Extensions are optional data frames sitting before the voxel data. When present, an extender frame of 4 bytes is also present at the end of the NIFTI-1 header, with the first byte set to something other than 0.

header

This module defines the NiftiHeader struct, which is used to provide important information about NIFTI-1 volumes.

object

Module for handling and retrieving complete NIFTI-1 objects.

typedef

This module contains multiple types defined by the standard. At the moment, not all of them are used internally (NiftiType makes the exception, which also provides a safe means of reading voxel values). However, primitive integer values can be converted to these types and vice-versa.

volume

This module defines the voxel volume API, as well as data types for reading volumes from files. An integration with ndarray allows for more elegant and efficient approaches, and should be preferred when possible. In order to do so, you must add the ndarray_volumes feature to this crate.

Enums

Endianness

Enumerate for the two kinds of endianness possible by the standard.