Find dark holes - Granulometry filter


I am trying to find the cells in attached image.

  • First of all: any ideas are welcome!
  • I tired the Enhance Dark Holes algorithm and it works quite well for cells where the cytoplasm completely encloses the nucleus. However cells where the cytoplasmic ring is not complete are not found. I think this could be because in your algorithm you do subsequent erosion and reconstruction; my feeling is that the algorithm might become robust to incomplete rings if you replace the reconstruction by a simple dilation, such that you basically perform subsequent steps of classical opening operations. Could you try this? Or, even better, give the user the choice whether they want to use erosion>reconstruction or erosion>dilation?
  • More general comment: Find Dark Holes is a granulometry filter (with reconstruction) on the inverted image. I think it would be great to add a simple Granulometry filter (with min and max particle radius) to Image Morph!!

Best, Christian

find_dark_holes.cpproj (394.0 KB)
example 1 (1.8 MB)

So weirdly the first thing I tried worked but nothing else did; your idea re: adding this to Morph (which I think is a good one btw) gave me the idea to put a Morph upstream of Enhance; an “open”/“disk”/“5” almost completely cleans it up and gets you almost all the nuclei. Feel free to tinker but I didn’t want to over-fit to a single image.

I also tried masking the empty regions out based on finding large “objects” in the Enhance (without morphing), using those “objects” as a mask, then repeating the Enhance- if you’re looking for a nice mask it succeeds at removing the empty space but it didn’t really improve the downstream Enhance module much.

1 Like

Hi! Thanks!

Yes, in fact I also tried cleaning up before with opening or closing operations and this helps :slight_smile:

However, my question was also a bit more conceptual: My feeling is that the erosion&reconstruction-based granulometry filter would require completely enclosed nuclei, whereas the erosion&dilation(=opening)-based granulometry filter might be more robust to “holes” in the rings around the nuclei.

In fact, I just tried it and attached pipeline and image seems to prove my point :slight_smile:
Based on this evidence, I think it would be really great to add a opening-based granulometry filter to the Morph module (the reason also being that these kind of stainings occur relatively frequently in biological research). (8.9 KB)

raw image and dark holes enhancement

inverted opening-based “granulometry”

Yes, I totally agree that would be a good addition; but that’s less my area than @agoodman 's (and our new engineer landing next month). Just wanted to suppy ideas as was requested :sunglasses: .

Wouldn’t be a bad idea to put your suggestion here and tag it as a feature request!


I added it to github:

Even with the code already :slight_smile:

:trophy: :clap: :confetti_ball:

1 Like

I wanted to do a granulometry analysis but could not get it going in CP. I am currently writing my own code for it. Sometimes its very difficult to get very good segmentation results in CP for proper size measurement. I want to able to also compare the segmentation results I get from CP to what I get from granulometry. I found these materials helpful and

Hi Raphael,

I posted code to be added to CellProfiler (see below). As far as I know this is the most classical granulometry implementation. Do you think that’s OK or do you know of other implementations?

Looks good…I love python (import numpy as np:slight_smile:) I started developing my code along the lines of the demo MathLab version I thought this functionality was implemented in the Nightly cutting edge build.