vanvalenlab / deepcell-tf

Deep Learning Library for Single Cell Analysis
https://deepcell.readthedocs.io
Other
413 stars 95 forks source link

Round cell shapes #716

Closed auroramaurizio closed 4 months ago

auroramaurizio commented 4 months ago

Hello! thank you for the great tool! I'm analyzing a CosMX Nanostring dataset. The cells were segmented with Mesmer and cluster assignment etc. were performed with Seurat. I was wondering if it's ok that when I color the cells by cluster or niche e.g. with the command ImageDimPlot(nano.obj.merge, fov = "zoom2", dark.background = FALSE, axes = TRUE) the cells appear to be round. The same dataset was segmented with CellPose and the shape of the cells was different with cells looking more like polygons. Please, see the 2 example figures (different FOVs).

Am I doing something wrong or it's supposed to be like this? Thank you very much! Best, Aurora

Mesmer_ImageDimPlot CellPose_ImageDimPlot
rossbar commented 4 months ago

The top image appears to me that it is plotting glyphs (e.g. circles representing cell locations) rather than the cell mask. I suspect this is an issue with the visualization not quite performing the operation you are expecting. The fact that each of the instances in figure 1 is the same size & shape is a strong indicator that these are not cell masks.

FWIW Mesmer produces cell masks (nuclear or whole-cell depending on configuration) so you would indeed expect masks that capture the shape of cell instances.

auroramaurizio commented 4 months ago

My bad, sorry. Here is a Seurat code chunk returning the correct output :).

nano.obj.merge contains 3 slides combined, in each slide there are several FOVS.

DefaultBoundary(nano.obj.merge[["R5630_Slide3"]]) <- "segmentation" crop <- Crop(nano.obj.merge[["R5630_Slide3"]], y = c(345000, 350000), x = c(1000,3000 )) nano.obj.merge[["crop1"]] <- crop p2 <- ImageDimPlot(nano.obj.merge, fov = "crop1", axes = TRUE, group.by = "niches", dark.background = T, coord.fixed = FALSE) + ggtitle("Niches") + scale_fill_manual(values = c("#442288", "#6CA2EA", "#B5D33D", "#FED23F", "#EB7D5B", "pink"))

Thank you for the quick reply!

rossbar commented 4 months ago

Thanks - I'll close this as "resolved" then unless I've misunderstood. If you believe there's still something actionable on the deepcell side, please feel free to reopen!