proseg icon indicating copy to clipboard operation
proseg copied to clipboard

Visualizing CosMx SpatialData

Open jai-mathur opened this issue 2 months ago • 4 comments

Hi!

Thank you for working so hard on this, and continuing to make it better with every version!

I have started to look at some CosMx 6k data, and I was wondering how can I visualize the new segmentations. https://nanostring-biostats.github.io/CosMx-Analysis-Scratch-Space/posts/squidpy-essentials/squidpy-essentials.html#sec-imageanalysis

I would like to visualize the cell boundaries, overlaid on the CosMx images, the way they have shown it in tutorial above. You had shared a snippet for Visium HD, and I'm wondering what modifications are needed to visualize all the FOVs.

Warm regards

Jairaj Mathur

jai-mathur avatar Oct 09 '25 18:10 jai-mathur

@jai-mathur I am not part of the proseg team, but while I was searching for some information on visualizing I found this note about CosMx data and visiualizing the polygons in #27 that might answer your question? Might be worth a look.

rachelgriffard avatar Oct 14 '25 14:10 rachelgriffard

Thank you Rachel. While it seems like the issue was solved for the person in the issue you linked, I am using Proseg 3, and need to somehow figure out spatial data and these images. The spatial data object already has these polygons in it, so the issue is for the images

Still, I appreciate you trying to help out :)

jai-mathur avatar Oct 15 '25 00:10 jai-mathur

Thank you Rachel. While it seems like the issue was solved for the person in the issue you linked, I am using Proseg 3, and need to somehow figure out spatial data and these images. The spatial data object already has these polygons in it, so the issue is for the images

Still, I appreciate you trying to help out :)

I look forward to hearing the solution to this! I am heading towards the same problem.

rachelgriffard avatar Oct 15 '25 13:10 rachelgriffard

I'll try to write up some kind of tutorial, but probably your best bet is to use the spatialdata-plot library. For example, here's a simple plot of cell boundaries.

import spatialdata
import matplotlib.pyplot as plt

sdata = spatialdata.read_zarr("proseg-output.zarr")

fig, ax = plt.subplots()
sdata.pl.render_shapes("cell_boundaries").pl.show(ax=ax)
fig.savefig("cell_boundaries.png")

There's a cosmx tutorial here: https://spatialdata.scverse.org/en/stable/tutorials/notebooks/notebooks/examples/technology_cosmx.html

That may not be entirely applicable though, mainly because proseg output won't include images, so those would have to be manually added to the spatialdata object to plot.

dcjones avatar Oct 15 '25 18:10 dcjones