Counting Irregular Cells

Sample image and/or code


  • Here I have some cancer cells which I’m trying to count but because of the image quality and the irregular nature of the cells I’m finding it very hard to count cells short of just doing it manually.

Analysis goals

  • I’m simply trying to count the number of cells in the image itself, but because I’m new to ImageJ I’m struggling a bit.


I’ve tried many other methods such as segmentation, binary water-shedding, and threshold optimization but those seem to work really well in round and well-bound cells with clear membranes. In my case its so irregular and clustered that I’m very frustrated by either having too much background being counted or sometimes misidentifying the cells as background. Is there a simple workaround that I may have overlooked, or is manually counting really the best approach for an image like mine. I’ve also tried a few macros from others that have worked but when applying them to my image I get thousands of cells when I shouldn’t be. If I could get any guidance that would be highly appreciated. Maybe I’m just overwhelmed by all the different approaches and I should focus on optimizing just one of them. I think my preferred way though is nuclei counting which I’ve tried to do with Weka segmentation, but I’m not satisfied by the results.

Thank You!

The closest I have seen for images of this type is CellPose, but even that will struggle with extremely elongated or poor quality images. You may need to retrain the model a bit for your specific use case - which could require a headache or two’s worth of coding.

If you end up manually counting, QuPath has really nice tools for that in a project structure that lets you go back and look at all of your results and what you did.