-
Originally posted by @asmlgkj at #10028 (comment). I am working with Seurat v5 and cell segmentation data (polygon boundaries) in your tutorial data. I would like to clarify how Seurat defines and stores the “location” of each segmented cell. Where exactly in the Seurat object can I find the coordinates that represent each cell’s position? For polygon-based cells, does Seurat use the geometric centroid of the polygon, or some other representative point? If it is using the centroid, how does Seurat handle cases where the centroid falls outside of the polygon — for example, in crescent-shaped or very elongated/narrow cells? Is there any correction (such as using an interior point), or does Seurat simply return the centroid as is? I would be very grateful if you could clarify this, since it has important implications for downstream analyses and visualization. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
@asmlgkj -- hope this helps! Let me know if you have further questions.
For centroids, you can retrieve the coordinates with ![]() For segmentations, you can retrieve the segmentation coordinates with More info: coordinates are stored inside each ![]()
We use
For now, we return the centroid as-is for every cell segmentation, which is the fastest method of deriving point representations of the segmentations. However, please note that this is the initial version of support for cell segmentation data, so we may revise this at a later date if users raise issues with the current method. |
Beta Was this translation helpful? Give feedback.
-
thanks a lot , Regarding centroid coordinates for downstream analysis: Could you confirm that obtaining centroid coordinates for downstream analysis is indeed feasible? Also, am I correct in understanding that we should use nucleus_segmentations.geojson rather than cell_segmentations.geojson to obtain centroid coordinates? I assume this is because the nucleus is definitively located within the cell, making it more accurate? |
Beta Was this translation helpful? Give feedback.
@asmlgkj -- hope this helps! Let me know if you have further questions.
For centroids, you can retrieve the coordinates with
GetTissueCoordinates(v3d)
. Within the Seurat object you will find coordinates at: "images" slot -> Visium object ("slice1.polygons") -> boundaries -> Centroids object ("centroids") -> "coords" slot. See the screenshot below.For segmentations, you can retrieve the segmentation coordinates with
GetTissueCoordinates(v3d[["slice1.polygons"]]@boundaries[["segmentation"]])
. Here, each pair of coordinates corresponding to a single cell ID represents one vertex of a cell s…