This library is designed as an extension of the [NIFTI-rs] library, adding 3D resampling support. This library is closely modeled after the [NiBabel] [processing module][NiBabel-processing], hence the name.
The resample_to_output
and resample_from_to
functions with nearest neighbor and trilinear resampling are implemented.
The nalgebra_affine
and ndarray_volumes
features of NIFTI-rs are required.
Load a Nifti image file with [NIFTI-rs] and resample the volume to a grid spacing of 1 mm:
```rust use nifti::{NiftiObject, ReaderOptions, NiftiVolume}; use use niftiprocessing::{resampleto_output, sampler};
let obj = ReaderOptions::new().readfile("myvolume.nii.gz")?;
let header = obj.header();
let affine = header.getaffine();
let volume = obj.volume();
let im = volume.into_ndarray::
let nn = sampler::NearestNeighbor::default(); let (resampledim, resampledaffine) = resampletooutput(&im, &affine, &[1.0,1.0,1.0], nn) ```
See also the examples directory.
Licensed under either of
at your option.
Unless you explicitly state otherwise, any Contribution intentionally submitted for inclusion in work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.