gustaveroussy / sopa

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

[advice]Cellpose troubleshooting #67

Closed cstrlln closed 1 month ago

cstrlln commented 1 month ago

I trained a cellpose model and used it with a morphology2D file outside of sopa and got pretty good results, however when running it with the same image on sopa I don't get as many cells. I think it might have to do with the image settings ( e.g. contrast, etc), and maybe the patching??

What do you suggest for troubleshooting this? I guess I can use the CLI and try different parameters there? and then move to snakemake?

Thanks

quentinblampey commented 1 month ago

Hello @cstrlln,

Do you use the same cellpose parameters in both cases? Did you only check the total number of cells, or did you visually saw that Sopa was missing cells? Because Sopa does some filtering to remove artefacts (i.e., segmented cells that are too small to be a cell), so it may lead to a smaller number of cells, but since only artefacts are removed it should look good. You can check this comment in the FAQ that may help you concerning this.

In brief, you can check the following:

It's really unlikely to be due to the patching process, though.

Yes, you can use the CLI to debug this, as you'll directly see the number of cells logged in your terminal after sopa resolve cellpose. I suggest performing the tests on one FOV to make it quick. I also recommend using a large patch size so that you have only one patch, it will be easier for testing purposes.

I hope this will help you!

cstrlln commented 1 month ago

Is it possible to use the Image Restoration capacities of Cellpose 3 when running in sopa?

quentinblampey commented 1 month ago

Not yet, but I'm thinking about adding it So, if I add it, I'll let you know!