squidpy
squidpy copied to clipboard
Import external cell segmentation of H&E images to image container
Hi, I want to import cell segmentation results generated from an external software to the image container, then using the sq.im.calculate_image_features
function to assign the centroids of cells to each Visium spot.
What I obtained from the external software is a dataframe indicating the (x, y) coordinate of each cell centroid in the image. For calculating image features, I just need to assign the centroid to each Visium spot. No other features are needed besides the cell centroids (such as cell shape).
Is there a way to do this? Thanks!
...
hi @YuanningEric ,
if it's only the centroids, then you can assign such info to adata.obsm["spatial"] temporarily and use that as centroids for calculating the features. Howver, these will treat the centroids as circles and not proper segmentation masks, and so you will only compute features in the circle area around the centroid (based on the scale_spot
parameter).
Hope that helps,
@YuanningEric ImageContainer usage in squidpy will be deprecated eventually. I would recommend to use napari-spatialdata Interactive(sdata)
, where sdata
is a spatialdata object, instead.