[−][src]Struct nifti::volume::inmem::InMemNiftiVolume
A data type for a NIFTI-1 volume contained in memory. Objects of this type
contain raw image data, which is converted automatically when using reading
methods or converting it to an ndarray
(only with the ndarray_volumes
feature).
Since NIfTI volumes are stored in disk in column major order (also called Fortran order), this data type will also retain this memory order.
Methods
impl InMemNiftiVolume
[src]
pub fn from_raw_data(header: &NiftiHeader, raw_data: Vec<u8>) -> Result<Self>
[src]
Build an InMemNiftiVolume from a header and a buffer. The buffer length and the dimensions declared in the header are expected to fit.
pub fn from_raw_fields(
raw_dim: [u16; 8],
datatype: NiftiType,
scl_slope: f32,
scl_inter: f32,
raw_data: Vec<u8>,
endianness: Endianness
) -> Result<Self>
[src]
raw_dim: [u16; 8],
datatype: NiftiType,
scl_slope: f32,
scl_inter: f32,
raw_data: Vec<u8>,
endianness: Endianness
) -> Result<Self>
Build an InMemNiftiVolume from its raw set of attributes. The raw data
is assumed to contain exactly enough bytes to contain the data elements
of the volume in F-major order, with the byte order specified in
endianness
, as specified by the volume shape in raw_dim
and data
type in datatype
.
pub fn from_stream<R: Read>(source: R, header: &NiftiHeader) -> Result<Self>
[src]
use from_reader
instead
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).
pub fn from_reader<R: Read>(source: R, header: &NiftiHeader) -> 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).
pub fn from_file<P: AsRef<Path>>(path: P, header: &NiftiHeader) -> Result<Self>
[src]
Read a NIFTI volume from an image file. NIFTI-1 volume files usually have the extension ".img" or ".img.gz". In the latter case, the file is automatically decoded as a Gzip stream.
pub fn into_raw_data(self) -> Vec<u8>
[src]
Retrieve the raw data, consuming the volume.
pub fn raw_data(&self) -> &[u8]
[src]
Retrieve a reference to the raw data.
pub fn raw_data_mut(&mut self) -> &mut [u8]
[src]
Retrieve a mutable reference to the raw data.
Trait Implementations
impl IntoNdArray for InMemNiftiVolume
[src]
fn into_ndarray<T>(self) -> Result<Array<T, IxDyn>> where
T: DataElement,
u8: AsPrimitive<T>,
i8: AsPrimitive<T>,
u16: AsPrimitive<T>,
i16: AsPrimitive<T>,
u32: AsPrimitive<T>,
i32: AsPrimitive<T>,
u64: AsPrimitive<T>,
i64: AsPrimitive<T>,
f32: AsPrimitive<T>,
f64: AsPrimitive<T>,
[src]
T: DataElement,
u8: AsPrimitive<T>,
i8: AsPrimitive<T>,
u16: AsPrimitive<T>,
i16: AsPrimitive<T>,
u32: AsPrimitive<T>,
i32: AsPrimitive<T>,
u64: AsPrimitive<T>,
i64: AsPrimitive<T>,
f32: AsPrimitive<T>,
f64: AsPrimitive<T>,
Consume the volume into an ndarray.
impl<'a> IntoNdArray for &'a InMemNiftiVolume
[src]
fn into_ndarray<T>(self) -> Result<Array<T, IxDyn>> where
T: Mul<Output = T>,
T: Add<Output = T>,
T: DataElement,
u8: AsPrimitive<T>,
i8: AsPrimitive<T>,
u16: AsPrimitive<T>,
i16: AsPrimitive<T>,
u32: AsPrimitive<T>,
i32: AsPrimitive<T>,
u64: AsPrimitive<T>,
i64: AsPrimitive<T>,
f32: AsPrimitive<T>,
f64: AsPrimitive<T>,
[src]
T: Mul<Output = T>,
T: Add<Output = T>,
T: DataElement,
u8: AsPrimitive<T>,
i8: AsPrimitive<T>,
u16: AsPrimitive<T>,
i16: AsPrimitive<T>,
u32: AsPrimitive<T>,
i32: AsPrimitive<T>,
u64: AsPrimitive<T>,
i64: AsPrimitive<T>,
f32: AsPrimitive<T>,
f64: AsPrimitive<T>,
Create an ndarray from the given volume.
impl<'a> NiftiVolume for &'a InMemNiftiVolume
[src]
fn dim(&self) -> &[u16]
[src]
fn dimensionality(&self) -> usize
[src]
fn data_type(&self) -> NiftiType
[src]
impl NiftiVolume for InMemNiftiVolume
[src]
fn dim(&self) -> &[u16]
[src]
fn dimensionality(&self) -> usize
[src]
fn data_type(&self) -> NiftiType
[src]
impl RandomAccessNiftiVolume for InMemNiftiVolume
[src]
fn get_f32(&self, coords: &[u16]) -> Result<f32>
[src]
fn get_f64(&self, coords: &[u16]) -> Result<f64>
[src]
fn get_u8(&self, coords: &[u16]) -> Result<u8>
[src]
fn get_i8(&self, coords: &[u16]) -> Result<i8>
[src]
fn get_u16(&self, coords: &[u16]) -> Result<u16>
[src]
fn get_i16(&self, coords: &[u16]) -> Result<i16>
[src]
fn get_u32(&self, coords: &[u16]) -> Result<u32>
[src]
fn get_i32(&self, coords: &[u16]) -> Result<i32>
[src]
fn get_u64(&self, coords: &[u16]) -> Result<u64>
[src]
fn get_i64(&self, coords: &[u16]) -> Result<i64>
[src]
impl<'a> RandomAccessNiftiVolume for &'a InMemNiftiVolume
[src]
fn get_f32(&self, coords: &[u16]) -> Result<f32>
[src]
fn get_f64(&self, coords: &[u16]) -> Result<f64>
[src]
fn get_u8(&self, coords: &[u16]) -> Result<u8>
[src]
fn get_i8(&self, coords: &[u16]) -> Result<i8>
[src]
fn get_u16(&self, coords: &[u16]) -> Result<u16>
[src]
fn get_i16(&self, coords: &[u16]) -> Result<i16>
[src]
fn get_u32(&self, coords: &[u16]) -> Result<u32>
[src]
fn get_i32(&self, coords: &[u16]) -> Result<i32>
[src]
fn get_u64(&self, coords: &[u16]) -> Result<u64>
[src]
fn get_i64(&self, coords: &[u16]) -> Result<i64>
[src]
impl FromSourceOptions for InMemNiftiVolume
[src]
impl<R> FromSource<R> for InMemNiftiVolume where
R: Read,
[src]
R: Read,
fn from_reader(
reader: R,
header: &NiftiHeader,
(): Self::Options
) -> Result<Self>
[src]
reader: R,
header: &NiftiHeader,
(): Self::Options
) -> Result<Self>
impl PartialEq<InMemNiftiVolume> for InMemNiftiVolume
[src]
fn eq(&self, other: &InMemNiftiVolume) -> bool
[src]
fn ne(&self, other: &InMemNiftiVolume) -> bool
[src]
impl Clone for InMemNiftiVolume
[src]
fn clone(&self) -> InMemNiftiVolume
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for InMemNiftiVolume
[src]
Auto Trait Implementations
impl Unpin for InMemNiftiVolume
impl Sync for InMemNiftiVolume
impl Send for InMemNiftiVolume
impl RefUnwindSafe for InMemNiftiVolume
impl UnwindSafe for InMemNiftiVolume
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,