1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
//! Rust implementation of the NIfTI-1 file format. //! //! # Example //! //! ```no_run //! use nifti::{NiftiObject, InMemNiftiObject, NiftiVolume}; //! # use nifti::error::Result; //! //! # fn run() -> Result<()> { //! let obj = InMemNiftiObject::from_file("myvolume.nii.gz")?; //! // use obj //! let header = obj.header(); //! let volume = obj.volume(); //! let dims = volume.dim(); //! # Ok(()) //! # } //! ``` //! //! The library will automatically look for the respective volume when //! specifying just the header file: //! //! ```no_run //! use nifti::{NiftiObject, InMemNiftiObject}; //! # use nifti::error::Result; //! # fn run() -> Result<()> { //! let obj = InMemNiftiObject::from_file("myvolume.hdr.gz")?; //! # Ok(()) //! # } //! ``` //! //! With the `ndarray_volumes` Cargo feature enabled, you can also convert a //! volume to an [`ndarray::Array`](https://docs.rs/ndarray) and work from //! there: //! //! ```no_run //! # #[cfg(feature = "ndarray_volumes")] //! # use nifti::error::Result; //! # #[cfg(feature = "ndarray_volumes")] //! # fn run() -> Result<()> { //! # use nifti::{NiftiObject, InMemNiftiObject}; //! use nifti::IntoNdArray; //! # let obj = InMemNiftiObject::from_file("myvolume.hdr.gz").unwrap(); //! let volume = obj.into_volume().into_ndarray::<f32>()?; //! # Ok(()) //! # } //! ``` //! #![deny(missing_debug_implementations)] #![warn(missing_docs, unused_extern_crates, trivial_casts, unused_results)] #[macro_use] extern crate quick_error; #[macro_use] extern crate num_derive; #[macro_use] extern crate derive_builder; #[cfg(feature = "ndarray_volumes")] extern crate ndarray; extern crate byteorder; extern crate flate2; extern crate num_traits; extern crate safe_transmute; pub mod extension; pub mod header; pub mod object; pub mod volume; pub mod error; pub mod typedef; mod util; pub use error::{NiftiError, Result}; pub use object::{NiftiObject, InMemNiftiObject}; pub use extension::{Extender, Extension, ExtensionSequence}; pub use header::{NiftiHeader, NiftiHeaderBuilder}; pub use volume::{NiftiVolume, InMemNiftiVolume, Sliceable}; pub use volume::element::DataElement; #[cfg(feature = "ndarray_volumes")] pub use volume::ndarray::IntoNdArray; pub use typedef::{NiftiType, Unit, Intent, XForm, SliceOrder}; pub use util::Endianness;