Distancetransform Distance Map using ImageJ-ops

I am trying to understand how to use ops and somehow I found it very confusing. For some ops it works for some ops not. For example a distance transform gives me always a blank image.
Here is a small groovy script you can try with blobs (with or without binarization)

#@ OpService ops
#@ ImagePlus img

import net.imglib2.img.display.imagej.ImageJFunctions as IJF
imgF = IJF.convertFloat(img)
dt = ops.run("image.distancetransform", imgF)
filter = ops.run("filter.gauss", imgF, 2)
1 Like

I relink to examples I just found in the forum.

Using the suggestions of the previous link and specifying the calibration I get a distance transform. However the distance transform is wrong if one uses the correct calibration [0.15, 0.15, 2.5], and there are spurious lines in the image (see attached image). Using a calibration of [1,1,1] or [1, 1, 16.666] (normalized XY) does not show this problem. The binary image is at https://owncloud.gwdg.de/index.php/s/7a7xFCvmhCKzcYN .
Are some of the developer @ctrueden or Simon Schmid aware of this problem? It seems to be connected to a calibration below 1.



#@ OpService ops
#@ Dataset input
#@output result1
#@output result2
cal = []
input.numDimensions().times {
	cal << input.averageScale(it)
bitImg = ops.run("convert.bit", input);
result1 = ops.run("image.distancetransform", bitImg, [1.0, 1.0, 1.0]  as double[])
result2 = ops.run("image.distancetransform", bitImg, cal  as double[])

1 Like

Thanks @apoliti for digging into this. I remember having seen these issues as well (in addition to the offset/min-related issues discussed in the post you linked), but never got around to create a minimal reproducible example, and wasn’t aware that this seems to occur only with calibrations < 1.

I know that @MarcelWiedenmann and @gselzer are currently working on migrating imagej-ops to be based on the new scijava-ops, so they might be able to comment more here as well. Also, it might be a good idea to track this as a GitHub issue in imagej-ops so that it doesn’t get forgotten.

1 Like

I created an issue for imagej-ops.

1 Like