I am trying to create a program that can count the number of nuclei in such an image:

enter image description here

What I've already done is the following, step by step:

  1. Apply an Alternating Sequential Filter (closing and opening the image with gradually bigger structuring elements)
  2. Apply a distance transform
  3. Apply watershed segmentation using the distance transformed image to detect minima

Which yields the following result (where each color represents a new nucleus counted):

enter image description here

As we can see, there are lots of imperfections, specifically, overcounted nuclei. I'd say that the reason for that problem is the way I imposed minima for the Watershed Transform (using the distance transform), but I really have no other ideas for imposing minima in that case.

As the Distance Transform generates minima based on the roundness of objects, I would like to know a better alternative to round up the nuclei than the Alternating Sequential Filter (looking at the image above, we can infer that most of the "overcounts" came from the less rounded nuclei). I would also like to know better ways to impose minima for the Watershed Transform.

  • 3
    $\begingroup$ I sometimes get these kind of questions at work and ... don't go into it. I generally ask the user to go back to the microscope and acquire decent images. I am not sure I could count them accurately by hand. Is this an option in your case (redoing the imaging part I mean)? $\endgroup$
    – Jean-Yves
    Aug 20, 2013 at 18:55
  • $\begingroup$ Crazy idea, which might work depending on how many images you need to analyze and how often, but knowing that humans are better at this sort of thing: try using Amazon's Mechanical Turk. $\endgroup$
    – DarenW
    Aug 22, 2013 at 20:16
  • $\begingroup$ Can you provide a ground truth for your image? (manually delineated by you) I looked at the image and frankly I can't tell you which are nuclei or which are artifacts. There are some nuclei that are composed only of several pixels? The nuclei suppose to be round/ellipse? And ultimately, as @Jean-Yves pointed out, can you get a better picture? We all can adjust contrast and luminosity but we can't re-tint the sample. $\endgroup$
    – visoft
    Oct 29, 2013 at 8:01

2 Answers 2


There are numerous articles on how to handle the oversegmentation problem of watershed, but I think you should read Robust Cell Image Segmentation Methods (scientific article from 2004 by Bengtsson et al).

It covers various methods for segmenting cell images and includes real-world examples that show how to handle oversegmentation from watershed on fluorescence microscopy images similar to yours (it also has examples for bright-field images and confocal microscopy images). It uses seeds from the distance transform, similar to your approach, and merges regions with weak borders. The article reads well and the concepts are pretty straight-forward to implement in Matlab.

For an even more current approach, you can read A Decomposition Scheme for 3D Fuzzy Objects Based on Fuzzy Distance Information by Svensson. It uses a similar method as in Bengtsson et al, but works on the fuzzy distance transform which gives a better density representation for the objects used in the article.


You can try "extended maxima transform" which is a morphological reconstruction method. It detects maxima points given a contrast criterion which you can invert and impose. It is implemented in Matlab.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.