gustaveroussy / sopa

Technology-invariant pipeline for spatial omics analysis (Xenium / Visium HD / MERSCOPE / CosMx / PhenoCycler / MACSima / ...) that scales to millions of cells
https://gustaveroussy.github.io/sopa/
BSD 3-Clause "New" or "Revised" License
129 stars 15 forks source link

[Bug] Polygon resolution after cellpose leads to overlapping and misshapen cells #136

Open pakiessling opened 2 weeks ago

pakiessling commented 2 weeks ago

Hi Quentin, we talked a little bit about this in Munich. I think this might be more noticeble in our samples as we are working with big cells: grafik

You can see the lines where I assume the shapes from different runs were stitched. Even more apparent with my trained cellpose model: output_sopa

I find the overlaps especially concerning as the transcripts / intensities will be counted twice.

I am also experimenting with porting the polygon resolution from VPT: grafik

In this case it leads to the removal of many cells, but there are no more overlaps.

I have uploaded the sdata and my code here: https://github.com/pakiessling/sopa_poly_experiment

Let me know what you think. I would be happy to try and help in improving this

quentinblampey commented 1 week ago

Hi @pakiessling,

Thanks for sending these detailed images. It seems the segmentation here is pretty difficult (is it DAPI staining?), so I think the results are less consistent than expected between the different patches, leading to these artifacts.

What would be a good solution for you? I wanted to work on a new resolve method to avoid these overlaps (split the overlapping region between the two cells). Would that be something interesting here?

I'm planning to add a new resolve_method argument, which would be a string to decide on the resolve method to use (with, by default, the one that is currently used).