Open gselzer opened 4 years ago
This issue has been mentioned on Image.sc Forum. There might be relevant details there:
I think Gauss and derivative Gauss also have the same behaviour btw.
@ctr26 can you be more specific in which Ops have the issue?
I am only seeing this issue in PartialDerivativesRAI
. I am not seeing this issue in any of the Gauss ops
This fails for me:
#@ Dataset data
#@OUTPUT Dataset output
#@ OpService ops
#@ DatasetService ds
from net.imagej.axis import Axes
converted = ops.convert().float32(data.getImgPlus())
dog = ops.create().img(converted)
converted_in = ops.transform().flatIterableView(converted)
converted_out = ops.transform().flatIterableView(dog)
#dog_op = ops.op("filter.dog", converted_in,1,1)
#dog_op = ops.op("filter.sobel", converted_in)
dog_op = ops.op("filter.derivativeGauss", converted_in,1,1)
t_dim = data.dimensionIndex(Axes.TIME)
fixed_axis = [d for d in range(0, data.numDimensions()) if d != t_dim]
ops.slice(converted_out,converted_in, dog_op, fixed_axis)
output = ds.create(converted_out)
print("success")
@ctr26 that is failing for other reasons. Check the agreement of the arguments you are passing with the parameters of the Op (forum.image.sc is the place to discuss this). If you find any Ops that are experiencing the same issue that we are seeing with SobelRAI
and PartialDerivativesRAI
(within this code base), this would be the place to report it.
As I discovered by trying to solve a post on forum.image.sc,
SobelRAI
can throwArrayIndexOutOfBoundsException
s if the input image differs on the number of dimensions from what was passed to the matcher during the creation of the Op. The faulty line is here: if the input image has fewer dimensions than the image passed during creation, we will receive anArrayIndexOutOfBoundsException
in thatfor
loop, and if we have more dimensions than we had during Op creation, then not all dimensions of the image will be processed.Is there any reason that we do not run a
for
loop on all dimensions of the image and use only onederivativeComputer
? We could just transform the dimensions of the image to compute every dimension...