imagej-ops icon indicating copy to clipboard operation
imagej-ops copied to clipboard

filter.dog breaks with an UnsignedByteType input and a FloatType output

Open gselzer opened this issue 2 years ago • 1 comments

I feel like the following should work, as a user, but it doesn't. May be an Ops issue, just filing it here because this is where I'm seeing it.

  1. Run `filter.dog(img "out"?, img "in", number "sigma1", number "sigma2", outOfBoundsFactory "fac"?) -> (img "out"?)
  2. in -> the bricks sample image
  3. 2 as sigma1
  4. 5 as sigma2
  5. Create a new image of type float32 as the output image
  6. Click Run
  7. See the following error:
java.lang.ClassCastException: net.imglib2.type.numeric.integer.UnsignedByteType cannot be cast to net.imglib2.type.numeric.real.FloatType
	at net.imglib2.type.numeric.real.FloatType.sub(FloatType.java:56)
	at net.imagej.ops.math.IIToIIOutputII$Subtract.compute(IIToIIOutputII.java:181)
	at net.imagej.ops.math.IIToIIOutputII$Subtract.compute(IIToIIOutputII.java:137)
	at net.imagej.ops.special.hybrid.BinaryHybridCI1.mutate(BinaryHybridCI1.java:61)
	at net.imagej.ops.special.hybrid.BinaryHybridCFI1.mutate(BinaryHybridCFI1.java:75)
	at net.imagej.ops.special.hybrid.BinaryHybridCI1.run(BinaryHybridCI1.java:70)
	at net.imagej.ops.special.hybrid.BinaryHybridCFI1.run(BinaryHybridCFI1.java:65)
	at net.imagej.ops.special.hybrid.BinaryHybridCFI.run(BinaryHybridCFI.java:68)
	at net.imagej.ops.special.hybrid.BinaryHybridCFI.run(BinaryHybridCFI.java:75)
	at org.scijava.command.CommandModule.run(CommandModule.java:196)
	at net.imagej.ops.OpEnvironment.run(OpEnvironment.java:960)
	at net.imagej.ops.OpEnvironment.run(OpEnvironment.java:157)
	at net.imagej.ops.filter.dog.DefaultDoG.compute(DefaultDoG.java:94)
	at net.imagej.ops.filter.dog.DefaultDoG.compute(DefaultDoG.java:54)
	at net.imagej.ops.special.chain.UHCFViaUHCF.compute(UHCFViaUHCF.java:63)
	at net.imagej.ops.filter.dog.DoGSingleSigmas.compute(DoGSingleSigmas.java:98)
	at net.imagej.ops.filter.dog.DoGSingleSigmas.compute(DoGSingleSigmas.java:54)
	at net.imagej.ops.special.hybrid.UnaryHybridCF.run(UnaryHybridCF.java:75)
	at net.imagej.ops.special.hybrid.UnaryHybridCF.run(UnaryHybridCF.java:97)
	at org.scijava.command.CommandModule.run(CommandModule.java:196)
	at net.imagej.ops.OpEnvironment.run(OpEnvironment.java:960)
	at net.imagej.ops.OpEnvironment.run(OpEnvironment.java:136)
	at net.imagej.ops.OpListingModule.run(OpListingModule.java:68)
	at org.scijava.module.ModuleRunner.run(ModuleRunner.java:165)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:125)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:64)
	at org.scijava.thread.DefaultThreadService.lambda$wrap$2(DefaultThreadService.java:247)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:750)

gselzer avatar Oct 12 '23 19:10 gselzer

This is in fact an issue with imagej-ops: see here, where the input and output images must be the same type. Of course, this is really an issue in the Op matcher, where this Op shouldn't even match!

However, I don't see why we couldn't fix the Op to cover more cases...

gselzer avatar Oct 14 '24 22:10 gselzer