KNIME: using ImageWriter on orthogonal images

knime
Tags: #<Tag:0x00007fd5482fe7a0>

#1

In a KNIME workflow, I produced orthogonal (xz and yz)-images using the Image Cropper node. I then try to save these images using the ImageWriter. KNIME produces a corrupted image-file and gives as an error: Execute failed: ("ArrayIndexOutOfBoundsException"): -1
I have no problem saving a xy-cropped image, so I assume the problem is related with the dimensions of the image. I uploaded a simplified workflow: knime test files.zip (8.7 KB)
Thanks for the help.


#2

I can reproduce the issue. Node execution fails with the following exception:

java.lang.ArrayIndexOutOfBoundsException: -1
	at io.scif.formats.TIFFFormat$Writer.savePlane(TIFFFormat.java:1425)
	at io.scif.formats.TIFFFormat$Writer.writePlane(TIFFFormat.java:1532)
	at io.scif.AbstractWriter.savePlane(AbstractWriter.java:170)
	at io.scif.AbstractWriter.savePlane(AbstractWriter.java:161)
	at io.scif.img.ImgSaver.writePlanes(ImgSaver.java:681)
	at io.scif.img.ImgSaver.writeImg(ImgSaver.java:542)
	at io.scif.img.ImgSaver.writeImg(ImgSaver.java:528)
	at io.scif.img.ImgSaver.writeImg(ImgSaver.java:497)
	at io.scif.img.ImgSaver.writeImg(ImgSaver.java:459)
	at io.scif.img.ImgSaver.saveImg(ImgSaver.java:174)
	at io.scif.img.ImgSaver.saveImg(ImgSaver.java:158)
	at org.knime.knip.io.nodes.imgwriter2.ImgWriter2.writeImage(ImgWriter2.java:352)
	at org.knime.knip.io.nodes.imgwriter2.ImgWriter2.writeImage(ImgWriter2.java:243)
	at org.knime.knip.io.nodes.imgwriter2.ImgWriter2NodeModel.run(ImgWriter2NodeModel.java:345)
	at org.knime.knip.io.nodes.imgwriter2.ImgWriter2NodeModel.execute(ImgWriter2NodeModel.java:237)
	at org.knime.core.node.NodeModel.execute(NodeModel.java:733)
	at org.knime.core.node.NodeModel.executeModel(NodeModel.java:567)
	at org.knime.core.node.Node.invokeFullyNodeModelExecute(Node.java:1128)
	at org.knime.core.node.Node.execute(Node.java:915)
	at org.knime.core.node.workflow.NativeNodeContainer.performExecuteNode(NativeNodeContainer.java:561)
	at org.knime.core.node.exec.LocalNodeExecutionJob.mainExecute(LocalNodeExecutionJob.java:95)
	at org.knime.core.node.workflow.NodeExecutionJob.internalRun(NodeExecutionJob.java:179)
	at org.knime.core.node.workflow.NodeExecutionJob.run(NodeExecutionJob.java:110)
	at org.knime.core.util.ThreadUtils$RunnableWithContextImpl.runWithContext(ThreadUtils.java:328)
	at org.knime.core.util.ThreadUtils$RunnableWithContext.run(ThreadUtils.java:204)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at org.knime.core.util.ThreadPool$MyFuture.run(ThreadPool.java:123)
	at org.knime.core.util.ThreadPool$Worker.run(ThreadPool.java:246)

#3

Dear @aklemm,

You can work around that issue with the Set Image Metadata node and setting dimension 0 to “X” and dimension 1 to “Y”. It seems that the Image Writer doesn’t work well with non-XY images.

Best,
Stefan


#4

Thanks @stelfrich! That was exactly what I was looking for.