sparrow.sh.vectorize#
- sparrow.sh.vectorize(sdata, labels_layer, output_layer, overwrite=False)#
Vectorize a labels layer.
Convert a labels layer to a shapes layer with name
output_layer. If therasteriolibrary is installed will use implementation based onrasterio, else will use implementation based onskimage. We recommend installingrasteriofor increased perforamnce 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 layer will be added.
labels_layer (
str) – The labels layer to vectorize.output_layer (
str) – The name of the output layer where the shapes data will be stored.overwrite (
bool(default:False)) – If True, overwrites the output layer if it already exists insdata.
- Return type:
SpatialData- Returns:
: The
sdataobject with the shapes layer added.