DonQuiKong
DonQuiKong

Reputation: 411

Erosion without losing regions

I have an image containing cells. I can't provide it, but it is similar to the image used as an example here: http://blogs.mathworks.com/steve/2006/06/02/cell-segmentation/ but without the characteristic nuclei.

I have done some processing and am now left with a pretty good segmentation, but some cells are close to each other and I need to split them. Most of them consist of more or less overlapping ellipses.

I am certain that a few iterations of simple erosion will split almost all of those regions. But some of the other cells are so small, they will disappear before the others split. Therefore I need an algorithm that erodes the image, allowing region splitting, but does not delete the last pixel of a region.

I want to use watershed afterwards to segment the cells.

I guess I could implement this on my own by searching for cennected regions and then tracking that I don't lose any or something like that, but the implementation seems messy even in my head and I think there must be an easier way. So my question is basically, what's the name of this so I can google an implementation? Or if there is no off-the-shelf solution, what's an elegant way of implementing this without dozens of iterations and for loops etc.

(Language is python)

Upvotes: 1

Views: 1410

Answers (1)

FiReTiTi
FiReTiTi

Reputation: 5898

It's a classical problem, and if the overlap between cells is too important, let's say 40% or more, then there is not a good solution.

However, if the overlap is not important, here is the solution:

  • You start from the segmentation you have, let's call it S
  • You computer the ultimate eroded UE(S). It will give you the center of each cell. It will give you something like the red points on this image. In this image, they use a distance map, an ultimate eroded will be more stable. If there are still many red points per cell, then a dilation of the UE(S) will fix your problem like this example.
  • You invert Inv(S) or compute the voronoi diagram Voi(S) in order to have a marker in the background.
  • Watershed on the gradient image of S, using the UE(S) as inner marker (perfect because you have one point by cell) and Inv(S) or Voi(S) as background/outer marker.

You will get something like this example.

Upvotes: 1

Related Questions