[−][src]Crate nifti
Rust implementation of the NIfTI-1 file format.
Example
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
Cargo feature enabled, you can also convert a
volume to an ndarray::Array
and work from
there:
use nifti::IntoNdArray; let volume = obj.into_volume().into_ndarray::<f32>()?;
An additional volume API is also available for reading large volumes slice by slice.
let obj = ReaderStreamedOptions::new().read_file("minimal.nii.gz")?; let volume = obj.into_volume(); for slice in volume { let slice = slice?; // manipulate slice here }
Re-exports
pub use error::NiftiError; |
pub use error::Result; |
pub use extension::Extender; |
pub use extension::Extension; |
pub use extension::ExtensionSequence; |
pub use header::NiftiHeader; |
pub use object::InMemNiftiObject; |
pub use object::NiftiObject; |
pub use object::ReaderOptions; |
pub use object::ReaderStreamedOptions; |
pub use object::StreamedNiftiObject; |
pub use typedef::Intent; |
pub use typedef::NiftiType; |
pub use typedef::SliceOrder; |
pub use typedef::Unit; |
pub use typedef::XForm; |
pub use volume::element::DataElement; |
pub use volume::ndarray::IntoNdArray; |
pub use volume::InMemNiftiVolume; |
pub use volume::NiftiVolume; |
pub use volume::RandomAccessNiftiVolume; |
pub use volume::Sliceable; |
pub use volume::StreamedNiftiVolume; |
Modules
affine | This module defines some affine-related utilities. |
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 |
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 ( |
volume | This module defines the voxel volume API, as well as data
types for reading volumes from files.
An integration with |
writer | Utility functions to write nifti images. |
Enums
Endianness | Enumerate for materializing the two kinds of machine byte order supported by Rust. |