Masked watershedding using imglib2

Masked watershedding using imglib2

Hi,

I need to do waterschedding using imglib2. I have found this method net.imglib2.algorithm.labeling.Watershed<T,L>, which seems to be what I need.

However, the image I am trying to segment has basins (which I want to segment) that have ridges between them, but otherwise have monotonically increasing intensity up to the image border (see image below). I therefore need a way to do masked watershedding, to not fill up the whole image (I get the mask by thresholding). In Python I have previously tried the method skimage.morphology.watershed for this, which has a mask parameter exactly for this.

Since net.imglib2.algorithm.labeling.Watershed does not seem to provide a masking ability, I have had the following idea and wanted to confirm, it makes sense:

To achieve something similar to masked watershedding as in Python, I could set all image-pixels in the masked image-area to 0 and mark them with an additional label. In effect the masked area would become an additional marked basin. When I now do watershedding, I would expect the “masked” area to be filled up with one contiguous labelled area that confines the growth of the differently labelled/marked basins.

Is this how one would do this with net.imglib2.algorithm.labeling.Watershed or am I missing something? It seems that my use-case is very common.

Thanks,

Michael

This is the intensity map of the image. I invert this intensity map for the watershedding. You can see that the intensity falls off monotonically towards the edges (hence increases monotonically in the inverted image):

image

1 Like