Counting cell chain length

I have an image like this:

I need to count number of cells in each cell chain as automatically as possible. For example the image above has one chain of about length 49, but I have also images with more chains.

My current approach is the following:

  1. Threshold to separate the cell chain from the background. (How do you automatically find a threshold for a specific image?)
  2. Use Dilate a couple of times and then erode to connect the cells of a chain which are not connected already. (How often?)
  3. Then I would use something like flood fill to identify chains. (This would be a plugin.)
  4. Watershed to split a chain into cells resulting in this image:
  5. Flood fill again to indentify cells and look up the center of each cell in the chain data of step 3.

I also considered Hough Transform, but cells of this size and shape are hardly to identify as a circle.

Any suggestions how to solve this problem in a more elegant and robust way mostly with tools already provided by ImageJ?

1 Like

You can try using the tools available in MorphoLibJ. For example:

  • Grayscale morphological filtering (Plugins > MorphoLibJ > Morphological Filters), in this case an opening with a disk of radius 2:

  • Remove the background with a White Top Hat (with a disk of radius 9):

  • Fill holes in the grayscale image (Plugins > MorphoLibJ > Fill Holes (Binary/Gray))

I just did that, then binarized the image and applied binary watershed (from ImageJ) to split the objects:


Thanks for your help!
The MorphLib helped a lot to automate the Threshold.

With the preprocessing you described above i wrote a python plugin and got the following results:


I am glad to hear that! It would be great if you could share here your script so other users can reuse it when facing similar problems.