lazyslide.pl.annotations

Contents

lazyslide.pl.annotations#

annotations(wsi, key, color=None, label=None, show_image=True, mark_origin=True, scalebar=True, in_bounds=True, img_bytes_limit=2000000000.0, display_aware=True, oversample=1.5, target_dpi=None, tissue_key='tissues', tissue_id=None, zoom=None, fill=True, linewidth=0.5, palette=None, alpha=0.9, legend_kws=None, legend=True, title=None, ncols=4, wspace=0.5, hspace=0.5, ax=None, backend=None)#

Display the annotation .

Parameters:
wsiWSIData

The whole-slide image object.

keystr

The annotation key.

colorstr, optional

The column or feature name to use for coloring the annotations.

labelstr, optional

The column or feature name to use for labeling the annotations.

show_imagebool, default: True

Whether to display the underlying tissue image.

mark_originbool, default: True

Whether to mark the origin on the plot.

scalebarbool, default: True

Whether to show a scalebar.

in_boundsbool, default: True

Whether to restrict annotations to the image bounds.

img_bytes_limitint, default: 2e9

A safety ceiling on the bytes of the image to read. The level is primarily chosen from the displayed size (see display_aware).

display_awarebool, default: True

Choose the image pyramid level from the displayed figure size at render time, avoiding reading a high-resolution image into a small figure.

oversamplefloat, default: 1.5

Read this many times more pixels than the axes occupies, for crispness.

target_dpifloat, optional

Override the figure DPI when sizing the image. Set to the export DPI (e.g. target_dpi=300 for savefig(dpi=300)) for high-DPI output.

tissue_keystr, default: “tissues”

The key for tissue segmentation.

tissue_idint or ‘all’, optional

The tissue id(s) to display annotations for.

zoomtuple, optional

(xmin, xmax, ymin, ymax) for zooming into a region.

fillbool, default: True

Whether to fill the annotation polygons.

linewidthfloat, default: 0.5

The line width of the annotation polygons.

palettestr, optional

The color palette to use.

alphafloat, default: 0.9

The transparency of the annotation polygons.

legend_kwsdict, optional

Additional keyword arguments for the legend.

legendbool, default: True

Whether to display a legend.

titlestr or list of str, optional

The title(s) for the plot(s).

ncolsint, default: 4

Number of columns for subplot arrangement.

wspacefloat, default: 0.5

Width space between subplots.

hspacefloat, default: 0.5

Height space between subplots.

axmatplotlib.axes.Axes, optional

The axes to plot on.

backend{‘matplotlib’, ‘datashader’}, optional

The backend to use for plotting. If None, datashader is used when there are more than 10,000 polygons.

Returns:
None

Examples

>>> import lazyslide as zs
>>> wsi = zs.datasets.sample()
>>> zs.pl.annotations(wsi, key="annotations", tissue_id="all")
../../_images/lazyslide-pl-annotations-1.png