pub struct SvsReader { /* private fields */ }Expand description
Reader for Aperio SVS files.
This provides access to the image pyramid and handles the JPEGTables merging required for decoding tiles.
Implementations§
Source§impl SvsReader
impl SvsReader
Sourcepub async fn open<R: RangeReader>(reader: &R) -> Result<Self, TiffError>
pub async fn open<R: RangeReader>(reader: &R) -> Result<Self, TiffError>
Open an SVS file and parse its structure.
This reads the TIFF structure, identifies pyramid levels, loads tile offset arrays, and caches JPEGTables for each level.
Sourcepub fn header(&self) -> &TiffHeader
pub fn header(&self) -> &TiffHeader
Get the TIFF header.
Sourcepub fn metadata(&self) -> &SvsMetadata
pub fn metadata(&self) -> &SvsMetadata
Get the parsed SVS metadata.
Sourcepub fn level_count(&self) -> usize
pub fn level_count(&self) -> usize
Get the number of pyramid levels.
Sourcepub fn get_level(&self, level: usize) -> Option<&SvsLevelData>
pub fn get_level(&self, level: usize) -> Option<&SvsLevelData>
Get data for a specific pyramid level.
Sourcepub fn dimensions(&self) -> Option<(u32, u32)>
pub fn dimensions(&self) -> Option<(u32, u32)>
Get dimensions of the full-resolution (level 0) image.
Sourcepub fn level_dimensions(&self, level: usize) -> Option<(u32, u32)>
pub fn level_dimensions(&self, level: usize) -> Option<(u32, u32)>
Get dimensions of a specific level.
Sourcepub fn level_downsample(&self, level: usize) -> Option<f64>
pub fn level_downsample(&self, level: usize) -> Option<f64>
Get the downsample factor for a level.
Sourcepub fn tile_count(&self, level: usize) -> Option<(u32, u32)>
pub fn tile_count(&self, level: usize) -> Option<(u32, u32)>
Get the number of tiles in X and Y directions for a level.
Sourcepub async fn read_raw_tile<R: RangeReader>(
&self,
reader: &R,
level: usize,
tile_x: u32,
tile_y: u32,
) -> Result<Bytes, TiffError>
pub async fn read_raw_tile<R: RangeReader>( &self, reader: &R, level: usize, tile_x: u32, tile_y: u32, ) -> Result<Bytes, TiffError>
Read raw tile data from the file.
This reads the raw bytes from the file without any processing. For SVS files, this is typically an abbreviated JPEG stream.
Sourcepub async fn read_tile<R: RangeReader>(
&self,
reader: &R,
level: usize,
tile_x: u32,
tile_y: u32,
) -> Result<Bytes, TiffError>
pub async fn read_tile<R: RangeReader>( &self, reader: &R, level: usize, tile_x: u32, tile_y: u32, ) -> Result<Bytes, TiffError>
Read a tile and prepare it for JPEG decoding.
This reads the tile data and merges it with JPEGTables if the tile contains an abbreviated JPEG stream (common in SVS files).
§Arguments
reader- Range reader for the filelevel- Pyramid level indextile_x- Tile X coordinatetile_y- Tile Y coordinate
§Returns
Complete JPEG data ready for decoding.
Sourcepub fn best_level_for_downsample(&self, downsample: f64) -> Option<usize>
pub fn best_level_for_downsample(&self, downsample: f64) -> Option<usize>
Find the best level for a given downsample factor.
Returns the level with the smallest downsample that is >= the requested factor.
Trait Implementations§
Source§impl SlideReader for SvsReader
impl SlideReader for SvsReader
Source§fn level_count(&self) -> usize
fn level_count(&self) -> usize
Source§fn dimensions(&self) -> Option<(u32, u32)>
fn dimensions(&self) -> Option<(u32, u32)>
Source§fn level_dimensions(&self, level: usize) -> Option<(u32, u32)>
fn level_dimensions(&self, level: usize) -> Option<(u32, u32)>
Source§fn level_downsample(&self, level: usize) -> Option<f64>
fn level_downsample(&self, level: usize) -> Option<f64>
Source§fn tile_count(&self, level: usize) -> Option<(u32, u32)>
fn tile_count(&self, level: usize) -> Option<(u32, u32)>
Source§fn best_level_for_downsample(&self, downsample: f64) -> Option<usize>
fn best_level_for_downsample(&self, downsample: f64) -> Option<usize>
Source§fn read_tile<'life0, 'life1, 'async_trait, R>(
&'life0 self,
reader: &'life1 R,
level: usize,
tile_x: u32,
tile_y: u32,
) -> Pin<Box<dyn Future<Output = Result<Bytes, TiffError>> + Send + 'async_trait>>where
R: 'async_trait + RangeReader,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read_tile<'life0, 'life1, 'async_trait, R>(
&'life0 self,
reader: &'life1 R,
level: usize,
tile_x: u32,
tile_y: u32,
) -> Pin<Box<dyn Future<Output = Result<Bytes, TiffError>> + Send + 'async_trait>>where
R: 'async_trait + RangeReader,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Auto Trait Implementations§
impl Freeze for SvsReader
impl RefUnwindSafe for SvsReader
impl Send for SvsReader
impl Sync for SvsReader
impl Unpin for SvsReader
impl UnwindSafe for SvsReader
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<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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