[][src]Struct nifti::volume::streamed::StreamedNiftiVolume

pub struct StreamedNiftiVolume<R> { /* fields omitted */ }

A NIfTI-1 volume instance that is read slice by slice from a byte stream.

See the module-level documentation for more details.

Implementations

impl StreamedNiftiVolume<BufReader<File>>[src]

pub fn from_file<P>(path: P, header: &NiftiHeader) -> Result<Self> where
    P: AsRef<Path>, 
[src]

Read a NIFTI volume from an uncompressed file. The header and expected byte order of the volume's data must be known in advance. It is also expected that the file starts with the first voxels of the volume, not with the extensions.

impl<R> StreamedNiftiVolume<R> where
    R: Read
[src]

pub fn from_reader(source: R, header: &NiftiHeader) -> Result<Self>[src]

Read a NIFTI volume from a stream of raw voxel data. The header and expected byte order of the volume's data must be known in advance. It is also expected that the following bytes represent the first voxels of the volume (and not part of the extensions).

By default, the slice's rank is the original volume's rank minus 1.

pub fn from_reader_rank(
    source: R,
    header: &NiftiHeader,
    slice_rank: u16
) -> Result<Self>
[src]

Read a NIFTI volume from a stream of data. The header and expected byte order of the volume's data must be known in advance. It it also expected that the following bytes represent the first voxels of the volume (and not part of the extensions).

The slice rank defines how many dimensions each slice should have.

pub fn dim(&self) -> &[u16][src]

Retrieve the full volume shape.

pub fn slice_dim(&self) -> &[u16][src]

Retrieve the shape of the slices.

pub fn slices_read(&self) -> usize[src]

Retrieve the number of slices already read

pub fn slices_left(&self) -> usize[src]

Retrieve the number of slices left

pub fn read_slice(&mut self) -> Result<InMemNiftiVolume>[src]

Read a volume slice from the data source, producing an in-memory sub-volume.

pub fn read_slice_inline(&mut self, buffer: Vec<u8>) -> Result<InMemNiftiVolume>[src]

Read a volume slice from the data source, producing an in-memory sub-volume. This method reuses the given buffer to avoid reallocations. Any data that the buffer previously had is discarded.

pub fn next_inline(
    &mut self,
    buffer: Vec<u8>
) -> Option<Result<InMemNiftiVolume>>
[src]

Fetch the next slice while reusing a raw data buffer. This is the streaming iterator equivalent of Iterator::next. Once the output volume has been used, the method into_raw_data can be used to recover the vector for the subsequent iteration.

pub fn indexed<'a>(
    &'a mut self
) -> impl Iterator<Item = Result<(Idx, InMemNiftiVolume)>> + 'a
[src]

Adapt the streamed volume to produce slice indices alongside the produced slices.

Example

let mut volume = get_volume();
for slice_pair in volume.indexed() {
    let (idx, slice): (Idx, InMemNiftiVolume) = slice_pair?;
    // use idx and slice
}

Trait Implementations

impl<R: Debug> Debug for StreamedNiftiVolume<R>[src]

impl<R> FromSource<R> for StreamedNiftiVolume<R> where
    R: Read
[src]

impl<R> FromSourceOptions for StreamedNiftiVolume<R>[src]

type Options = Option<u16>

Set of additional options required (or useful) for constructing a volume.

impl<R> Iterator for StreamedNiftiVolume<R> where
    R: Read
[src]

The iterator pattern in a streamed NIfTI volume calls the method read_slice on next unless all slices have already been read from the volume.

type Item = Result<InMemNiftiVolume>

The type of the elements being iterated over.

impl<'a, R> NiftiVolume for &'a StreamedNiftiVolume<R>[src]

impl<R> NiftiVolume for StreamedNiftiVolume<R>[src]

Auto Trait Implementations

impl<R> RefUnwindSafe for StreamedNiftiVolume<R> where
    R: RefUnwindSafe
[src]

impl<R> Send for StreamedNiftiVolume<R> where
    R: Send
[src]

impl<R> Sync for StreamedNiftiVolume<R> where
    R: Sync
[src]

impl<R> Unpin for StreamedNiftiVolume<R> where
    R: Unpin
[src]

impl<R> UnwindSafe for StreamedNiftiVolume<R> where
    R: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<I> IteratorRandom for I where
    I: Iterator
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,