WSIMeta

class WSIMeta(slide_dimensions, axes, level_dimensions=None, objective_power=None, level_count=None, level_downsamples=(1,), vendor=None, mpp=None, file_path=None, raw=None)[source]

Whole slide image metadata class.

Parameters
  • slide_dimensions (int, int) – Tuple containing the width and height of the WSI. These are for the baseline (full resolution) image if the WSI is a pyramid or multi-resoltion.

  • level_dimensions (list) – A list of dimensions for each level of the pyramid or for each resolution in the WSI.

  • objective_power (float, optional) – The power of the objective lens used to create the image.

  • level_count (Optional[int]) – (int, optional): The number of levels or resolutions in the WSI. If not given this is assigned len(level_dimensions). Defaults to None.

  • level_downsamples (list of float) – List of scale values which describe how many times smaller the current level is compared with the baseline.

  • vendor (str, optional) – Scanner vendor/manufacturer description.

  • mpp (float, float, optional) – Microns per pixel.

  • file_path (Path, optional) – Path to the corresponding WSI file.

  • raw (dict, optional) – Dictionary of unprocessed metadata extracted from the WSI format. For JPEG-2000 images this contains an xml object under the key “xml”.

  • axes (str) –

slide_dimensions

Tuple containing the width and height of the WSI. These are for the baseline (full resolution) image if the WSI is a pyramid or multi-resoltion. Required.

Type

tuple(int)

axes

Axes ordering of the image. This is most relevant for OME-TIFF images where the axes ordering can vary. For most images this with be “YXS” i.e. the image is store in the axis order of Y coordinates first, then X coordinates, and colour channels last.

Type

str

level_dimensions

A list of dimensions for each level of the pyramid or for each resolution in the WSI. Defaults to [slide_dimension].

Type

list

objective_power

The magnification power of the objective lens used to scan the image. Not always present or accurate. Defaults to None.

Type

float

level_count

(int): The number of levels or resolutions in the WSI. If not given this is assigned len(level_dimensions). Defaults to len(level_dimensions).

level_downsamples

List of scale values which describe how many times smaller the current level is compared with the baseline. Defaults to (1,).

Type

list of float

vendor

Scanner vendor/manufacturer description.

Type

str

mpp

Microns per pixel. Derived from objective power and sensor size. Not always present or accurate. Defaults to None.

Type

float, float, optional

file_path

Path to the corresponding WSI file. Defaults to None.

Type

Path

raw

Dictionary of unprocessed metadata extracted from the WSI format. For JP2 images this contains an xml object under the key “xml”. Defaults to empty dictionary.

Type

dict

Methods

as_dict

Convert WSIMeta to dictionary of Python types.

validate

Validate passed values and cast to Python types.

as_dict()[source]

Convert WSIMeta to dictionary of Python types.

Returns

whole slide image meta data as dictionary

Return type

dict

validate()[source]

Validate passed values and cast to Python types. Metadata values are often given as strings and must be parsed/cast to the appropriate python type e.g. “3.14” to 3.14 etc.

Returns

True is validation passed, False otherwise.

Return type

bool