harpy.sh.vectorize#
- harpy.sh.vectorize(sdata, labels_name, output_shapes_name, instance_key='cell_ID', overwrite=False)#
Vectorize a labels element.
Convert a labels element to a shapes element with name
output_shapes_name. If therasteriolibrary is installed will use implementation based onrasterio, else will use implementation based onskimage. We recommend installingrasteriofor increased performance and more precise vectorization.For optimal performance it is recommended to configure
Daskso it uses “processes” instead of “threads”, e.g. via:>>> import dask >>> dask.config.set(scheduler='processes')
- Parameters:
sdata – The SpatialData object to which the new shapes element will be added.
labels_name (
str) – The labels element to vectorize.output_shapes_name (
str) – The name of the output shapes element where the shapes data will be stored.instance_key (
str(default:'cell_ID')) – Name of the resulting index of the GeoDataFrame. The user can set this to any value, it will only be used to name the index.overwrite (
bool(default:False)) – If True, overwritesoutput_shapes_nameif it already exists insdata.
- Return type:
- Returns:
: The
sdataobject with the shapes element added.