imagej / imagej-ops

ImageJ Ops: "Write once, run anywhere" image processing
https://imagej.net/libs/imagej-ops
BSD 2-Clause "Simplified" License
89 stars 42 forks source link

ClassCastException from ConstantToIIOutputII #648

Open gselzer opened 2 years ago

gselzer commented 2 years ago

The following script, run in Fiji, throws a ClassCastException. I couldn't find any existing issue for this.

#@OpService ops

from net.imglib2.img.array import ArrayImgs
from net.imglib2.type.numeric.real import DoubleType

input = ArrayImgs.bytes(10, 10)
output = ArrayImgs.bytes(10, 10)
value = DoubleType(10)

ops.run("math.add", output, input, value)

This is probably due to Ops' insufficient generic type reasoning during matching; ConstantToIIOutputII.Add (it's autogenerated, or I'd link it), is being satisfied despite the Ts not matching between the ByteType of the images and the DoubleType of the value.