imagej / imagej/imagej-ops

ClassCastException from ConstantToIIOutputII

Open
#648 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
94
Forks
44
PR merge metrics
No merged PRs in 30d

Description

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

```jython
#@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 `T`s not matching between the `ByteType` of the images and the `DoubleType` of the value.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the Fiji Jython script using ArrayImgs.bytes, DoubleType, and ops.run("math.add", output, input, value). Start by tracing matching for ConstantToIIOutputII.Add and the generic types selected for the ByteType images and DoubleType value. Done means the incompatible types no longer reach an invalid cast and the operation reports a valid matching failure or handles the types correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
computer-vision
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.