sddb.table_centroids#

sddb.table_centroids(sdata: SpatialData, table: str, image: str) → ndarray#

Centroid of each table row in an image's scale-0 pixel space.

The table must annotate exactly one region element. The region's centroids are taken in a coordinate system shared with the image and mapped through the inverse of the image's transformation to that system, so no particular transform (e.g. identity) is assumed.

Parameters:
sdata

The SpatialData object holding the table, its region element and the image.

table

Name of the table in sdata.tables.

image

Name of the image in sdata.images; multiscale images use their scale-0 pixel grid.

Returns:

(n_obs, 2) float64 array of (x, y) pixel coordinates, rows aligned to sdata.tables[table].obs.

Raises:

ValueError -- If the table annotates more than one region, or the region and image share no coordinate system.