SvsReader

Struct SvsReader 

Source
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

Source

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.

Source

pub fn header(&self) -> &TiffHeader

Get the TIFF header.

Source

pub fn metadata(&self) -> &SvsMetadata

Get the parsed SVS metadata.

Source

pub fn level_count(&self) -> usize

Get the number of pyramid levels.

Source

pub fn get_level(&self, level: usize) -> Option<&SvsLevelData>

Get data for a specific pyramid level.

Source

pub fn dimensions(&self) -> Option<(u32, u32)>

Get dimensions of the full-resolution (level 0) image.

Source

pub fn level_dimensions(&self, level: usize) -> Option<(u32, u32)>

Get dimensions of a specific level.

Source

pub fn level_downsample(&self, level: usize) -> Option<f64>

Get the downsample factor for a level.

Source

pub fn tile_size(&self, level: usize) -> Option<(u32, u32)>

Get tile size for a level.

Source

pub fn tile_count(&self, level: usize) -> Option<(u32, u32)>

Get the number of tiles in X and Y directions for a level.

Source

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.

Source

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 file
  • level - Pyramid level index
  • tile_x - Tile X coordinate
  • tile_y - Tile Y coordinate
§Returns

Complete JPEG data ready for decoding.

Source

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 Debug for SvsReader

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl SlideReader for SvsReader

Source§

fn level_count(&self) -> usize

Get the number of pyramid levels. Read more
Source§

fn dimensions(&self) -> Option<(u32, u32)>

Get dimensions of the full-resolution (level 0) image. Read more
Source§

fn level_dimensions(&self, level: usize) -> Option<(u32, u32)>

Get dimensions of a specific level. Read more
Source§

fn level_downsample(&self, level: usize) -> Option<f64>

Get the downsample factor for a level. Read more
Source§

fn tile_size(&self, level: usize) -> Option<(u32, u32)>

Get tile size for a level. Read more
Source§

fn tile_count(&self, level: usize) -> Option<(u32, u32)>

Get the number of tiles in X and Y directions for a level. Read more
Source§

fn best_level_for_downsample(&self, downsample: f64) -> Option<usize>

Find the best level for a given downsample factor. Read more
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,

Read a tile and prepare it for JPEG decoding. Read more
Source§

fn level_info(&self, level: usize) -> Option<LevelInfo>

Get complete information about a level. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more