sparrow.pl.segment#
- sparrow.pl.segment(sdata, img_layer='raw_image', shapes_layer='segmentation_mask_boundaries', channel=None, crd=None, output=None, **kwargs)#
Visualize obtained shapes layer (i.e. segmentation mask boundaries) from a SpatialData object.
This function utilizes the
plot_shapes
method to display the segmentation results from the provided SpatialData object. Final plot will contain tow subplots, left the image without provided shapes layer overlay, and the right subplot with shapes layer overlay.- Parameters:
sdata (
SpatialData
) – Data containing spatial information for plotting.img_layer (
str
(default:'raw_image'
)) – Name of the image layer to be visualized, by default “raw_image”.shapes_layer (
str
(default:'segmentation_mask_boundaries'
)) – Name of the layer containing segmentation mask boundaries, by default “segmentation_mask_boundaries”.channel (
Union
[int
,list
[int
],None
] (default:None
)) – The channel(s) of the image to be visualized. If None, all channels are considered, by default None.crd (
Optional
[tuple
[int
,int
,int
,int
]] (default:None
)) – The coordinates for the region of interest in the format (xmin, xmax, ymin, ymax). If None, the entire image is considered, by default None.output (
Union
[str
,Path
,None
] (default:None
)) – Path to save the output image. If None, the image will not be saved and will be displayed instead, by default None.**kwargs (
dict
[str
,Any
]) – Additional keyword arguments to be passed to theplot_shapes
function.
- Return type:
None
- Returns:
: None
Examples
>>> sdata = SpatialData(...) >>> segment(sdata, img_layer="raw_img", crd=(2000,4000,2000,4000))
See also