qupath_to_domain#

qupath_to_domain(qupath_json_file, domain_name='a_qupath_domain', add_cells_as_points=True, pixel_size=[1, 1], properties_to_ignore=['isLocked', 'objectType', 'color'], specific_properties_as_labels=[], simplify_shapes=True, simplify_shapes_kwargs={'algorithm': 'Visvalingam-Whyatt', 'epsilon': 10}, print_summary=True)#

Import a QuPath GeoJSON file to a muspan domain. All metadata from the GeoJSON file is added as labels to the domain object. Only scalar and categorical metadata is supported.

Parameters:
qupath_json_filestr

Path to the QuPath GeoJSON file.

domain_namestr, optional

Name of the domain, by default ‘a_qupath_domain’.

add_cells_as_pointsbool, optional

Whether to add cells as points, by default True.

pixel_sizelist, optional

Pixel size for scaling coordinates with x and y respectively, by default [1, 1].

properties_to_ignorelist, optional

List of properties to ignore, by default [‘isLocked’, ‘objectType’, ‘color’].

specific_properties_as_labelslist, optional

List of properties to be added as labels, by default [].

simplify_shapesbool, optional

Whether to simplify shapes, by default True.

simplify_shapes_kwargsdict, optional

Additional arguments for shape simplification, by default dict(algorithm=’Visvalingam-Whyatt’, epsilon=30).

print_summarybool, optional

If True, print a summary of the resulting domain, by default True.

Returns:
domainmuspan domain

The muspan domain created from the QuPath GeoJSON file.

Raises:
ValueError

If qupath_json_file is not a string or if the GeoJSON file does not contain the expected structure output by QuPath.

Notes

  • Shape boundaries are simplfied by default using the Visvalingam-Whyatt algorithm with an epsilon of 10. This can be disabled by setting ``simplify_shapes’’ to False. See domain.simplify_shape_boundaries for more information.

  • Currently line colllections are not supported via import and will be ignore if present in the GeoJSON file.

  • If objects have multiple labels under the same property, only the first label will be added.