cellpose
cellpose copied to clipboard
single pixel outlier
Hi there,
When I segment polyonal cells using Cellpose, I found some single pixel outlier. Like in this labeled image, that pixel has the same label ID that the brown big cell to the right. When I processed this labeled image in LabelsToROIs plugin (https://github.com/ariel-waisman/LabelsToROIs), this single pixel would be recognized as one cell, which will affect cell size calculation.
We suspect this is a glitch of Cellpose. Generally, it's not a big problem, but I think you should know.
Does anyone faced this situation?
Justine Jiao
On the jupyter notebook version I have a line in my code setting a minarea=100 and then masks, flows, styles = model.eval(imgs, diameter=diam, channels=channels, do_3D=False, min_size=minarea, resample=True, progress=True)
It takes care of impossibly small cells for me. Hope this helps!
@mayishazn I tried this method but it didn't work. The single pixel belongs to the big label to the right, which means that they are one large label, so the single pixel can not filter by its size. Thanks anyway.
This is exactly the issue I'm having: single pixels belonging to a neighboring big cell. Has anyone found a solution?
When segmenting nuclei, I often end up with similar issues, where one or two pixels end up outside of the shape. However, when performing segmentation on whole cells, I often get more pixels not being connected (more often=10% of the segmentation masks aren't connected).
When performing segmentation and then looking at the segmentation mask of one cell (in this case cell 3), I end up with this shape:
Is there any explanation on how this is possible? And how to solve it?
This greatly influences the downstream analysis.
I can give way more context, examples and example code if wanted.
In general though I am extremely happy with the results of cellpose.
Thanks a lot,
Lotte
thanks @lopollar , can you give more context for your problem? is that in 3D or in 2D segmentation? your case seems a bit different
we can add an option to run a connected components check after the segmentation to remove single pixel outliers (cc @mrariden )
It is 2D segmentation using the cyto option.
The problem arises for me when creating shapes (with shapely) out of the masks after the segmentation.
However, when plotting the masks, it is clearly related to those.
A connected component analysis wouldn't be a bad thing to run I think!
As suggested by @mrariden I thought to contribute my experience with the similar issue :)
I'm experiencing an issue with a model to recognise DAPI-stained nuclei in 2D images. If a certain mask is affected, it is correctly generated to mark a nucleus - but then, there is one more pixel, completely detached from the original mask, that Cellpose considers as a part of this mask as well. The issue already happens at the standard settings of flow_threshold = 0.4
and cell_prob_threshold = 0.0
, but is pronounced at settings of flow_threshold = 0.6
and cell_prob_threshold = -1.0
that generally improve detection of cells in the model.
This causes issues in my downstream analysis, as I am importing ROIs into ImageJ from label images and this situation would then generate two separate ROIs from one gray value in the label image, throwing off the ROI counting.
This issue seems to be restricted to several versions (including the most current ones) of the model - earlier versions do not have this problem.
I'm attaching some screenshots below for you, as well as attaching the model and a sample image (ZIP because the file types were not allowed).
Here's another example of a mask from a model with flow_threshold = 0.9
and cell_prob_threshold = -3.0
that is basically a line, and is also split in two different parts:
Hey, I just wanted to bring up this issue again and ask if there are any plans to implement this post-processing for connected components in the future?
we can add it as an optional post-processing step, a PR is welcome