Ij.jar 1.51 update and marker-controlled watershed (MorphoLibJ) difference

We have been using the marker-controlled watershed plugin from MorphoLibJ for some time and since the last ij.jar update (1.50 to 1.51), we get different results.

Our usual pipeline:

  • Open a 16-bit image
  • Apply a median filter
  • Threshold the image (Huang)
  • Calculate the distance transform via the Exact Euclidean Distance Transform from the Process plugin
  • Use the distance transform image, the threshold and a manually created marker image in the marker-controlled watershed.

The latter plugin now gives a different resulting watershed image. We use the exact same marker image and we checked that the threshold image and the distance transform image are identical after the update. We have confirmed that switching back to the 1.50 ij.jar restores the result we are used to.

Does anyone have an idea what may have changed or if we can adapt our pipeline to avoid the changes?

Thanks,
Merijn

Hello Merijn,

Do you know which version of MorphoLibJ was used in each case?

The marker-controlled plugin code has not been changed for 8 months now, so Iā€™m inclined to think the difference comes from somewhere else.

Hello Ignacio,

We use the latest version (1.2.1) in both cases, so it will indeed not be a change in MorphoLibJ. It is probably a change in the IJ.jar that affects the MorphoLibJ marker-controlled watershed.

The difference is that some of the markers now result in tiny segments inside other segments, where before the now-tiny segment and enclosing segment were of similar size and separate.

Trying to recreate a mistake we made some time ago which gave similar results, we ran into something interesting. When we use the standard Distance Map (Process > Binary) instead of the plugin one (Plugins > Process > Exact Euclidean Distance Transform) as input for the watershed, we get almost the exact same errors. One difference between the two distance maps is that the standard Distance Map produces whole number values, while the plugin version uses floating points.
Perhaps there is a rounding error introduced somewhere?

That looks like the most probable reason then. The marker-controlled watershed plugin works with 8, 16 and 32-bit images. If you pass from an input 16-bit image to a 32-bit one with the same values, the result remains the same. However, if there are rounding differences, then you might end up with different results, of course.

1 Like

We did use 32-bits for all images involved. The only difference between the two cases is the IJ.jar file. The exact same pictures and MorphoLibJ plugin give a different result if we use the last IJ version.

It might be a modification in the median filter then, because the rest of steps in your pipeline seem to be unchanged.

Can you check if there is a change in your median-filtered results between the ij.jar versions?

In any case, you can always try the Chamfer distance plugins available in MorphoLibJ to see if they provide results closer to what you had before or to the new ones.