pub struct GenericTiffReader { /* private fields */ }Expand description
Reader for generic pyramidal TIFF files.
This reader handles standard tiled TIFF files with JPEG compression. It validates the file structure on open and rejects unsupported configurations.
Implementations§
Source§impl GenericTiffReader
impl GenericTiffReader
Sourcepub async fn open<R: RangeReader>(reader: &R) -> Result<Self, TiffError>
pub async fn open<R: RangeReader>(reader: &R) -> Result<Self, TiffError>
Open a generic pyramidal TIFF file.
This reads the TIFF structure, validates it meets requirements, and loads tile offset arrays.
§Errors
Returns an error if:
- The file is not a valid TIFF
- The file uses strip organization (not tiles)
- The file uses unsupported compression (not JPEG)
- No pyramid levels are found
Sourcepub async fn open_with_validation<R: RangeReader>(
reader: &R,
) -> Result<(Self, ValidationResult), TiffError>
pub async fn open_with_validation<R: RangeReader>( reader: &R, ) -> Result<(Self, ValidationResult), TiffError>
Open a generic pyramidal TIFF with detailed validation result.
This is like open() but returns the validation result separately,
allowing access to warnings even on success.
Sourcepub fn header(&self) -> &TiffHeader
pub fn header(&self) -> &TiffHeader
Get the TIFF header.
Sourcepub fn warnings(&self) -> &[String]
pub fn warnings(&self) -> &[String]
Get validation warnings from file open.
Warnings indicate non-fatal issues like unusual tile dimensions.
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<&GenericTiffLevelData>
pub fn get_level(&self, level: usize) -> Option<&GenericTiffLevelData>
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.
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 (rare for generic TIFF but handled).
§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 Debug for GenericTiffReader
impl Debug for GenericTiffReader
Source§impl SlideReader for GenericTiffReader
impl SlideReader for GenericTiffReader
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 GenericTiffReader
impl RefUnwindSafe for GenericTiffReader
impl Send for GenericTiffReader
impl Sync for GenericTiffReader
impl Unpin for GenericTiffReader
impl UnwindSafe for GenericTiffReader
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