Struct nifti::object::ReaderStreamedOptions
source · pub struct ReaderStreamedOptions { /* private fields */ }
Expand description
Options and flags which can be used to configure how a NIfTI image is read and iterated.
Implementations§
source§impl ReaderStreamedOptions
impl ReaderStreamedOptions
sourcepub fn new() -> Self
pub fn new() -> Self
Creates a blank new set of options ready for configuration.
All options are initially set to false
.
sourcepub fn fix_header(&mut self, fix_header: bool) -> &mut Self
pub fn fix_header(&mut self, fix_header: bool) -> &mut Self
Sets the options to fix some known header problems.
sourcepub fn read_file<P>(
&self,
path: P
) -> Result<StreamedNiftiObject<MaybeGzDecodedFile>>where
P: AsRef<Path>,
pub fn read_file<P>( &self, path: P ) -> Result<StreamedNiftiObject<MaybeGzDecodedFile>>where P: AsRef<Path>,
Retrieve the NIfTI object and prepare the volume for streamed reading.
The given file system path is used as reference. If the file only contains the header, this method will look for the corresponding file with the extension “.img”, or “.img.gz” if the former wasn’t found.
Example
use nifti::{NiftiObject, ReaderStreamedOptions};
let obj = ReaderStreamedOptions::new().read_file("minimal.nii.gz")?;
let volume = obj.into_volume();
for slice in volume {
let slice = slice?;
// manipulate slice here
}
sourcepub fn read_file_rank<P>(
&self,
path: P,
slice_rank: u16
) -> Result<StreamedNiftiObject<MaybeGzDecodedFile>>where
P: AsRef<Path>,
pub fn read_file_rank<P>( &self, path: P, slice_rank: u16 ) -> Result<StreamedNiftiObject<MaybeGzDecodedFile>>where P: AsRef<Path>,
Retrieve the NIfTI object and prepare the volume for streamed reading,
using slice_rank
as the dimensionality of each slice.
The given file system path is used as reference. If the file only contains the header, this method will look for the corresponding file with the extension “.img”, or “.img.gz” if the former wasn’t found.
sourcepub fn read_file_pair<P, Q>(
&self,
hdr_path: P,
vol_path: Q
) -> Result<StreamedNiftiObject<MaybeGzDecodedFile>>where
P: AsRef<Path>,
Q: AsRef<Path>,
pub fn read_file_pair<P, Q>( &self, hdr_path: P, vol_path: Q ) -> Result<StreamedNiftiObject<MaybeGzDecodedFile>>where P: AsRef<Path>, Q: AsRef<Path>,
Retrieve a NIfTI object as separate header and volume files, for streamed volume reading.
This method is useful when file names are not conventional for a NIfTI file pair.
Example
use nifti::{NiftiObject, ReaderStreamedOptions};
let obj = ReaderStreamedOptions::new().read_file_pair("abc.hdr", "abc.img.gz")?;
let volume = obj.into_volume();
for slice in volume {
let slice = slice?;
// manipulate slice here
}
sourcepub fn read_file_pair_rank<P, Q>(
&self,
hdr_path: P,
vol_path: Q,
slice_rank: u16
) -> Result<StreamedNiftiObject<MaybeGzDecodedFile>>where
P: AsRef<Path>,
Q: AsRef<Path>,
pub fn read_file_pair_rank<P, Q>( &self, hdr_path: P, vol_path: Q, slice_rank: u16 ) -> Result<StreamedNiftiObject<MaybeGzDecodedFile>>where P: AsRef<Path>, Q: AsRef<Path>,
Retrieve a NIfTI object as separate header and volume files, for streamed volume reading,
using slice_rank
as the dimensionality of each slice.
This method is useful when file names are not conventional for a NIfTI file pair.
Trait Implementations§
source§impl Clone for ReaderStreamedOptions
impl Clone for ReaderStreamedOptions
source§fn clone(&self) -> ReaderStreamedOptions
fn clone(&self) -> ReaderStreamedOptions
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ReaderStreamedOptions
impl Debug for ReaderStreamedOptions
source§impl Default for ReaderStreamedOptions
impl Default for ReaderStreamedOptions
source§fn default() -> ReaderStreamedOptions
fn default() -> ReaderStreamedOptions
source§impl PartialEq<ReaderStreamedOptions> for ReaderStreamedOptions
impl PartialEq<ReaderStreamedOptions> for ReaderStreamedOptions
source§fn eq(&self, other: &ReaderStreamedOptions) -> bool
fn eq(&self, other: &ReaderStreamedOptions) -> bool
self
and other
values to be equal, and is used
by ==
.impl StructuralPartialEq for ReaderStreamedOptions
Auto Trait Implementations§
impl RefUnwindSafe for ReaderStreamedOptions
impl Send for ReaderStreamedOptions
impl Sync for ReaderStreamedOptions
impl Unpin for ReaderStreamedOptions
impl UnwindSafe for ReaderStreamedOptions
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read moresource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.