Cannot remove the opening when manually merge the over watershed using MorphoLibJ

Tags: #<Tag:0x00007fd69c8b9d20> #<Tag:0x00007fd69c8b9be0> #<Tag:0x00007fd69c8b9aa0> #<Tag:0x00007fd69c8b9938> #<Tag:0x00007fd69c8b97f8>


Some particle was over-segment and split into two parts when using MorphoLibJ.
I used lab edition to merge these two parts by hand, but the opening still exists after merging.
I tried to use close but other normal segments will also close.
Is any idea to solve this problem?



Hi wenbin,

maybe the simplest solution is to perform a watershed segmentation “without dams”. This will partition the input image into several regions but without any gap between the regions.
To remove the dams, you need to check “advanced options” in the watershed segmentation GUI, then to uncheck the “Calculate dams” option.


Hi dlegland,

Thanks for your reply.

I think I need the dams between particles. But delete the dams inside the particle which are results from over watershed.

I checked the options in MorphoLibJ but unfortunately did not find the relevant option.

Best regards




otherwise you may try more complicated process:

  • isolate a binary image with the two labels you want to merge (using for example the “select labels” plugin followed by a threshold)
  • apply a morphological closing on the image -> this will remove the gap , but only between the two particles
  • apply connected components labeling -> the result is label imaeg with only one label
  • replace the value “1” by the maximum value of the two labels
  • combine with the initial label image by using a image calculator with the MAX operator.

hope this helps…