Image

pado image abstraction to hide image loading implementation

class pado.images.image.ImageMetadata(**data)[source]

the common image metadata

class pado.images.image.FileInfo(**data)[source]

information related to the file on disk

class pado.images.image.PadoInfo(**data)[source]

information regarding the file loading

class pado.images.image.Image(urlpath, *, load_metadata=False, load_file_info=False, checksum=False)[source]

pado.img.Image is a wrapper around whole slide image data

classmethod from_obj(obj)[source]

instantiate an image from an object, i.e. a pd.Series

Return type:

Image

to_record(image_id=None, *, urlpath_ignore_options=(), **kwargs)[source]

return a record for serializing

Return type:

dict[str, Any]

open(*, via=None, storage_options=None)[source]

open an image instance

This will instantiate the filesystem. Dependent on the filesystem this will establish connections to servers, etc. If open has been called, following calls will be no-ops.

Parameters:
  • via (AbstractFileSystem | None) – allows to provide a filesystem that will be used instead of the Image.urlpath’s filesystem to access the path.

  • storage_options (dict[str, Any] | None) – allows providing storage options for the filesystem used to access the image.

Returns:

returns the opened image instance

Return type:

self

via(ds, *, storage_options=None)[source]

open an image instance via a pado dataset

Similar behavior to .open() with the difference that only if the dataset is accessed remotely and the images are referenced locally (so on the same remote) will the image be accessed via the dataset filesystem.

A common example is a pado dataset stored on a server with the images stored next to it on the server filesystem. If this dataset is now accessed via ssh, the images will be accessible via ssh too.

Parameters:
  • ds – this pado dataset’s filesystem will be used for access

  • storage_options – allows providing storage options for the filesystem used to access the image.

Returns:

returns the opened image instance

Return type:

self

close()[source]

close and image instance

property metadata: ImageMetadata

the image metadata

property file_info: FileInfo

stats regarding the image file

get_array(location, region, level, *, runtime_type_checks=True)[source]

return array from a defined level

Return type:

ndarray

get_array_at_mpp(location, region, target_mpp)[source]

return array from a defined mpp and a position (in the target mpp)

Return type:

ndarray

get_zarr_store(level, *, chunkmode=0, zattrs=None)[source]

return the entire level as a zarr store

get_chunk_sizes(level=0)[source]

return a chunk bytesize array

Return type:

ndarray[Any, dtype[int64]]

is_local(must_exist=True)[source]

Return True if the image is stored locally

Return type:

bool