Miscellaneous

Multi resolution patches (MRP)

Multi resolution patches are represented by a collection of patches calculated/retrieved at different resolutions based on the center of the original patch. For the following original/base patch (level_or_mpp=0.5):

Base patch

the following set is considered its multi resolution counterpart (levels_or_mpps=[0.3, 0.4, 0.6, 0.7]):

MRP patch1 MRP patch2 MRP patch3 MRP patch4

In dplabtools, multi resolution patches are created by providing a group of level_or_mpp values into a list based variable called levels_or_mpps.

level_or_mpp

level_or_mpp is a dual purpose variable with the following interpretation:

  • if an int value is assigned, then level_or_mpp will be considered the WSI level.

  • if a float value is assigned, then level_or_mpp will be considered the MPP (microns per pixel) value.

level_or_mpp is mainly used in patch location calculations and patch extraction, to expand the range of possible WSI resolution values.

level_or_minsize

level_or_minsize is a dual purpose variable with the following interpretation:

  • if an int value below or equal to the fixed threshold is assigned, then level_or_minsize will be considered the WSI level.

  • if an int value above the fixed threshold is assigned, level_or_minsize will be considered the size in pixels. Following this, the closest WSI level matching the desired size will be found and assigned.

level_or_minsize is mainly used in WSI batch processing (e.g. mask generation), where the existence of the specific WSI levels is not always guaranteed. To alleviate this problem, using level_or_minsize allows to calculate WSI level values dynamically for each processed WSI. The current threshold value is set to 99.

AnnotationPolygon class

AnnotationPolygon is an utility class that allows to create straightforward polygon objects corresponding to available WSI annotations:

from dplabtools.slides.utils import AnnotationPolygon

polygon = AnnotationPolygon(
    points=[(10000, 22000), (10000, 25000), (13000, 25000), (13000, 22000)],
    label="group1",
    holes=[],
)

AnnotationPolygon allows the user to feed WSI annotation based data into various dplabtools classes in a friendly and standardized way.