lazyslide.io.export_annotations

lazyslide.io.export_annotations#

export_annotations(wsi, key, *, in_bounds=False, classes=None, colors=None, format='qupath', file=None)#

Export the annotations

Parameters:
wsiWSIData

The WSIData object to work on.

keystr

The key to export. Must exist in wsi.shapes.

in_boundsbool, default: False

Whether to move the annotations to the slide bounds.

classesstr, default: None

The column to use for the classification. If None, the classification will be ignored. If provided, must exist in the GeoDataFrame.

colorsstr | Mapping | Sequence, default: None

The column to use for the color, or a mapping from class values to colors, or a sequence of colors to be assigned to unique class values. If None, default colors will be used.

formatstr, default: ‘qupath’

The format to export. Currently only ‘qupath’ is supported.

filestr | Path, default: None

The file to save the annotations. If None, the annotations will not be saved. If provided, the parent directory will be created if it doesn’t exist.

Returns:
GeoDataFrame

The exported annotations.

Raises:
ValueError

If key doesn’t exist in wsi.shapes. If classes is provided but doesn’t exist in the GeoDataFrame. If colors is provided but is not a string, mapping, or sequence.