unified_image_reader.adapters package

Submodules

unified_image_reader.adapters.adapter module

Adapter

An implementation of image reading behavior that may map specific libraries to working with specific image formats

class unified_image_reader.adapters.adapter.Adapter

Bases: abc.ABC

abstract get_height() int

Get the height property of the image using the adapter library’s implementation

abstract get_region(region_coordinates: Iterable, region_dims: Iterable) numpy.ndarray

get_region Get a pixel region of the image using the adapter library’s implementation

Parameters
  • region_coordinates (Iterable) – A set of (width, height) coordinates representing the top-left pixel of the region

  • region_dims (Iterable) – A set of (width, height) coordinates representing the region dimensions

Returns

A numpy array representative of the pixel region from the image

Return type

np.ndarray

abstract get_width() int

Get the width property of the image using the adapter library’s implementation

unified_image_reader.adapters.slideio module

SlideIO Adapter

An adapter that uses the SlideIO library to implement image reading behavior Adapter currently mapped to reading .svs files

class unified_image_reader.adapters.slideio.SlideIO(filepath)

Bases: unified_image_reader.adapters.adapter.Adapter

get_height()

get_height Get the height property of the image using SlideIO’s implementation

Returns

Width in pixels

Return type

int

get_region(region_coordinates, region_dims) numpy.ndarray

get_region Get a pixel region of the image using SlideIO’s implementation

Parameters
  • region_coordinates (Iterable) – A set of (width, height) coordinates representing the top-left pixel of the region

  • region_dims (Iterable) – A set of (width, height) coordinates representing the region dimensions

Returns

A numpy array representative of the pixel region from the image

Return type

np.ndarray

get_width()

get_width Get the width property of the image using SlideIO’s implementation

Returns

Height in pixels

Return type

int

unified_image_reader.adapters.vips module

VIPS Adapter

An adapter that uses pyvips, the Python extension of the libvips library, to implement image reading behavior Adapter currently mapped to reading .tif, tiff files

class unified_image_reader.adapters.vips.VIPS(filepath: str)

Bases: unified_image_reader.adapters.adapter.Adapter

get_height() int

get_height Get the height property of the image using VIPS’ implementation

Returns

Height in pixels

Return type

int

get_region(region_coordinates, region_dims) numpy.ndarray

get_region Get a pixel region of the image using VIPS’ implementation

Parameters
  • region_coordinates (Iterable) – A set of (width, height) coordinates representing the top-left pixel of the region

  • region_dims (Iterable) – A set of (width, height) coordinates representing the region dimensions

Returns

A numpy array representative of the pixel region from the image

Return type

np.ndarray

get_width() int

get_height Get the height property of the image using VIPS’ implementation

Returns

Height in pixels

Return type

int

Module contents