squidpy icon indicating copy to clipboard operation
squidpy copied to clipboard

Import external cell segmentation of H&E images to image container

Open YuanningEric opened this issue 2 years ago • 1 comments

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!

...

YuanningEric avatar Feb 22 '23 21:02 YuanningEric

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,

giovp avatar Mar 21 '23 16:03 giovp

@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.

LLehner avatar Jun 12 '24 08:06 LLehner