lazyslide.io.load_annotations

lazyslide.io.load_annotations#

load_annotations(wsi, annotations, *, explode=True, in_bounds=False, join_with='tissues', join_to=None, json_flatten='classification', min_area=100.0, key_added='annotations')#

Load the annotation file and add it to the WSIData

Parameters:
wsiWSIData

The WSIData object to work on.

annotationsstr, Path, GeoDataFrame

The path to the annotation file or the GeoDataFrame. Currently, we support geospatial files readable by GeoPandas (e.g., GeoJSON) and Hamamatsu .ndpa files.

explodebool, default: True

Whether to explode the annotations.

in_boundsbool, default: False

Whether to move the annotations to the slide bounds.

join_withstr or list of str, default: ‘tissues’

The key to join the annotations with.

join_tostr, default: None

The key of the shapes (e.g. tiles) that receive the annotation columns. A shape that intersects several annotations takes the first one in row order; the shapes’ geometry and order are never changed.

json_flattenstr, default: “classification”

The column(s) to flatten the json data, if not exist, it will be ignored. “classification” is the default column for the QuPath annotations.

min_areafloat, default: 1e2

The minimum area of the annotation.

key_addedstr, default: ‘annotations’

The key to store the annotations.