GenericTiffReader

Struct GenericTiffReader 

Source
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

Source

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
Source

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.

Source

pub fn header(&self) -> &TiffHeader

Get the TIFF header.

Source

pub fn warnings(&self) -> &[String]

Get validation warnings from file open.

Warnings indicate non-fatal issues like unusual tile dimensions.

Source

pub fn level_count(&self) -> usize

Get the number of pyramid levels.

Source

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

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.

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 (rare for generic TIFF but handled).

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

Source§

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

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

impl SlideReader for GenericTiffReader

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