sparrow.sh.create_voronoi_boundaries#
- sparrow.sh.create_voronoi_boundaries(sdata, shapes_layer='segmentation_mask_boundaries', output_layer=None, radius=0, overwrite=False)#
Create Voronoi boundaries from the shapes layer of the provided SpatialData object.
Given a SpatialData object and a radius, this function calculates Voronoi boundaries and expands these boundaries based on the radius.
- Parameters:
sdata (
SpatialData
) – The spatial data object on which Voronoi boundaries will be created.shapes_layer (
str
(default:'segmentation_mask_boundaries'
)) – The name of the layer insdata
representing shapes used to derive Voronoi boundaries. Default is “segmentation_mask_boundaries”.output_layer (
Optional
[str
] (default:None
)) – Name of the resulting shapes layer that will be added tosdata
.radius (
int
(default:0
)) – The expansion radius for the Voronoi boundaries, by default 0. If provided, Voronoi boundaries will be expanded by this radius. Must be non-negative.overwrite (
bool
(default:False
)) – If True, overwrites theoutput_layer
if it already exists insdata
.
- Return type:
SpatialData
- Returns:
: Modified
sdata
object with the Voronoi boundaries created and possibly expanded.- Raises:
ValueError – If the provided radius is negative.