pub struct Slide { /* private fields */ }Expand description
Represents a single WSI, along with its metadata.
Implementations§
Source§impl Slide
impl Slide
Sourcepub fn metadata(&self) -> &Metadata
pub fn metadata(&self) -> &Metadata
Returns a reference to the metadata associated with the WSI.
Sourcepub fn level_count(&self) -> usize
pub fn level_count(&self) -> usize
Returns the number of pyramid levels in the WSI.
Sourcepub fn read_tile_raw(
&self,
level_idx: usize,
tile_x: u32,
tile_y: u32,
) -> Result<Vec<u8>, WsiError>
pub fn read_tile_raw( &self, level_idx: usize, tile_x: u32, tile_y: u32, ) -> Result<Vec<u8>, WsiError>
Reads and returns the raw tile bytes at the specified level and coordinates.
Given a level index and tile coordinates (tile_x, tile_y), this function retrieves the corresponding tile bytes from the WSI.
§Arguments
level_idx- The index of the pyramid level.tile_x- The x-coordinate of the tile.tile_y- The y-coordinate of the tile.
§Returns
A Result containing a vector of bytes representing the tile on success, or a WsiError on failure.
§Errors
Returns WsiError::LevelIndexOutOfBounds if the specified level index is invalid.
Sourcepub fn decode_tile(
&self,
level_idx: usize,
tile_x: u32,
tile_y: u32,
) -> Result<Tile, WsiError>
pub fn decode_tile( &self, level_idx: usize, tile_x: u32, tile_y: u32, ) -> Result<Tile, WsiError>
Reads the raw tile bytes at the specified level and coordinates and decodes them into a Tile.
Given a level index and tile coordinates (tile_x, tile_y), this function
retrieves the corresponding tile bytes from the WSI, decodes them and returns them in the form of
a loaded Tile. This function should preferably be used over read_tile
§Arguments
level_idx- The index of the pyramid level.tile_x- The x-coordinate of the tile.tile_y- The y-coordinate of the tile.
§Returns
A Result containing a Tile representing the tile on success, or a WsiError on failure.
§Errors
Returns WsiError::LevelIndexOutOfBounds if the specified level index is invalid.
Sourcepub fn tile_coords(
&self,
level_idx: usize,
) -> Result<impl Iterator<Item = (u32, u32)> + '_, WsiError>
pub fn tile_coords( &self, level_idx: usize, ) -> Result<impl Iterator<Item = (u32, u32)> + '_, WsiError>
Returns an iterator over the tile coordinates (tile_x, tile_y) for the specified level. The iterator yields tuples of (tile_x, tile_y) for each tile in the specified level, in row-major order.
§Arguments
level_idx- The index of the pyramid level.
§Returns
A Result containing an iterator over tile coordinates on success, or a WsiError on failure.
Sourcepub fn tiles(
&self,
level_idx: usize,
) -> Result<impl Iterator<Item = Result<Tile, WsiError>> + '_, WsiError>
pub fn tiles( &self, level_idx: usize, ) -> Result<impl Iterator<Item = Result<Tile, WsiError>> + '_, WsiError>
Decodes every tile at level_idx and passes each to f, according to
options.
Sourcepub fn extract<F>(
&self,
options: &ExtractionOptions,
outputs: &SlideOutputs,
f: F,
) -> Result<(), WsiError>
pub fn extract<F>( &self, options: &ExtractionOptions, outputs: &SlideOutputs, f: F, ) -> Result<(), WsiError>
Decodes every tile at level_idx and passes each to f, according to
options.
f must be safe to call concurrently: Parallelism::Parallel
invokes it from multiple worker threads at once.
§Errors
Returns WsiError::LevelIndexOutOfBounds if the specified level
index is invalid, or WsiError::ThreadPool if a dedicated thread
pool could not be built for Parallelism::Parallel with an
explicit thread count.
Sourcepub fn build_overview_image(&self) -> Result<DynamicImage, WsiError>
pub fn build_overview_image(&self) -> Result<DynamicImage, WsiError>
Stitches lowest-resolution pyramid level into a single image for use as a thumbnail.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Slide
impl RefUnwindSafe for Slide
impl Send for Slide
impl Sync for Slide
impl Unpin for Slide
impl UnsafeUnpin for Slide
impl UnwindSafe for Slide
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
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> ⓘ
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