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, 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:
- wsi
WSIData 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
The maximum number of bytes for the image.
- tissue_keystr, default: “tissue”
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.5
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.
- backendstr, {‘matplotlib’, ‘datashader’}
The backend to use for plotting. Will automatically use datashader when there are too many polygons.
- wsi
- Returns:
- None or matplotlib.figure.Figure
The figure if multiple axes are created and return_figure is True, otherwise None.
Examples
>>> import lazyslide as zs >>> wsi = zs.datasets.sample() >>> zs.pl.annotations(wsi, key="annotations", tissue_id="all")