Mask image to ROIs



I am looking for the equivalent function of the “Image to Labeling” Knime node in Fiji.
More precisly I would like to recover individual ROI from a mask image for which each region has a specific value (like in a connected component analysis).

The function Edit>Selection>Create selection does not work there as it accepts only a binary image as argument, resulting in all touching regions to result in one ROI, while my mask can have touching regions with different pixel values.

Here is the image mask with the Glasbey LUT (ie it is still a grayscale image).

The reason why I have such need is that I am using the MSER function from opencv to detect stable regions (it is basically like keeping area common to several threshold values).

The result of this MSER is a set of ROI, the problem is that there are often concentric ROI as illustrated below (which can make sense as one regions can be stable for different part of the threshold range, if I understood well).


I did not find a clever and fast way to test for inclusion of ROI without testing every pair of ROI in the image, so my dirty solution was to burn each ROI in a blank image of same size than the original image, with a (almost) unique gray level for each ROI hence the resultign image above with the Galsbey LUT.

It is not perfect of course because if a smaller ROI is burned within a larger ROI that was drawn before then the larger ROI will be hollow (could be fixed with fill holes though…).

I had the feeling that with a standalone python installation I had much less of those inclusions (if not at all)…
Maybe some non-maxima supression that is chipped with it.