Adding pre-processing to the H-watershed code

fiji
imagej
#1

Dear @Benoit and others,
I am working with the ImageJ’s H-watershed plugin [1] these days. I was wondering if I could add a step between the binarization and segmentation steps, such as filling binary regions.
Is this possible using the plugin? More than that, is this allowed by the H-watershed algorithm? Maybe I didn’t understand the algorithm at all :sweat_smile:
Thank you very much for your help. Kind regards,

Alex

[1] https://imagej.net/Interactive_Watershed

#2

Hi @alexandrejaguar ,

Welcome to the forum and apology or the late answer.

At the moment the plugin does not offer the option to fill holes in the labeled image. The way the algorithm works it might be possible to modify the labelling process to create a mask with filled holes. This being said I am not too inclined to complexify the plugin, and also I don’t really have time to work on it :-\

If that could still be of use to you, a workaround could be:

  1. Create a mask at the threshold, T, you have chosen. use fill holes on the mask
  2. Multiply the filled mask image by (T+1)/255
  3. Set the value of the holes to T+1: use the Max of 2 images, your original image and multiplied mask.
  4. Apply the H-watershed to result from point 3. Your holes should get filled now as they are above the threshold.

Good luck,
Benoit