spatialdata_io.xenium_explorer_selection

spatialdata_io.xenium_explorer_selection#

spatialdata_io.xenium_explorer_selection(path, pixel_size=0.2125, return_list=False)#

Read the coordinates of a selection .csv file exported from the Xenium Explorer.

This file can be generated by the “Freehand Selection” or the “Rectangular Selection”. The output Polygon can be used for a polygon query on the pixel coordinate system (by default, this is the "global" coordinate system for Xenium data). If spatialdata_xenium_explorer was used, the pixel_size argument must be set to the one used during conversion with spatialdata_xenium_explorer.

In case multiple polygons were selected on the Explorer and exported into a single file, it will return a list of polygons.

Parameters:
  • path (str | Path) – Path to the .csv file containing the selection coordinates

  • pixel_size (float (default: 0.2125)) – Size of a pixel in microns. By default, the Xenium pixel size is used.

  • return_list (bool (default: False)) – If True, returns a list of Polygon even if only one polygon was selected

Return type:

Polygon | list[Polygon]

Returns:

: shapely.geometry.polygon.Polygon