pub struct Reader { /* private fields */ }Implementations§
Source§impl Reader
impl Reader
pub fn open(path: &str) -> Result<Self, Error>
pub fn shape(&self) -> VolumeShape
pub fn mode(&self) -> Mode
pub fn header(&self) -> &Header
pub fn slices<T>(&self) -> SliceIter<'_, T>
pub fn slabs<T>(&self, k: usize) -> SlabIter<'_, T>
pub fn blocks<T>(&self, chunk_shape: [usize; 3]) -> BlockIter<'_, T>
Sourcepub fn can_zero_copy<T: Voxel>(&self) -> bool
pub fn can_zero_copy<T: Voxel>(&self) -> bool
Check if zero-copy decode is possible for the given type. Zero-copy requires: file mode matches T’s mode AND file endian is native.
Sourcepub fn read_converted<S, D>(
&self,
offset: [usize; 3],
shape: [usize; 3],
) -> Result<VoxelBlock<D>, Error>where
S: EndianCodec + Send + Copy + Default + Voxel,
D: Convert<S> + EndianCodec + Copy + Default + Voxel,
pub fn read_converted<S, D>(
&self,
offset: [usize; 3],
shape: [usize; 3],
) -> Result<VoxelBlock<D>, Error>where
S: EndianCodec + Send + Copy + Default + Voxel,
D: Convert<S> + EndianCodec + Copy + Default + Voxel,
Read and convert voxels from file mode to target type D.
This method decodes the raw bytes using the file’s voxel mode, then converts each voxel to the destination type D using the Convert trait.
§Example
ⓘ
// Read Int16 file as Float32
let reader = Reader::open("data.mrc")?;
let block: VoxelBlock<f32> = reader.read_converted::<i16, f32>([0,0,0], [64,64,64])?;Sourcepub fn conversion_path(&self, dst_mode: Mode) -> ConversionPath
pub fn conversion_path(&self, dst_mode: Mode) -> ConversionPath
Get the optimal conversion path for the given source and destination modes.
Sourcepub fn slices_converted<S, D>(&self) -> SliceIterConverted<'_, S, D> ⓘ
pub fn slices_converted<S, D>(&self) -> SliceIterConverted<'_, S, D> ⓘ
Sourcepub fn slabs_converted<S, D>(&self, k: usize) -> SlabIterConverted<'_, S, D> ⓘ
pub fn slabs_converted<S, D>(&self, k: usize) -> SlabIterConverted<'_, S, D> ⓘ
Auto Trait Implementations§
impl Freeze for Reader
impl RefUnwindSafe for Reader
impl Send for Reader
impl Sync for Reader
impl Unpin for Reader
impl UnsafeUnpin for Reader
impl UnwindSafe for Reader
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
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more