I am trying to create a program that can count the number of nuclei in such an image:
What I've already done is the following, step by step:
- Apply an Alternating Sequential Filter (closing and opening the image with gradually bigger structuring elements)
- Apply a distance transform
- Apply watershed segmentation using the distance transformed image to detect minima
Which yields the following result (where each color represents a new nucleus counted):
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.