ImageJ macro - montage to stack

I had this working before, on images with 1 channel. However now my image has 3 channels, since I worked around the image cropper problem. Now all of a sudden the Macro doesnt run anymore. Following errors are produced:


2016-03-04 13:49:04,124 : DEBUG : Run$_KNIME-Worker-191 : ImageJ Macro : ImageJ Macro : 2:9 : Execute failed: java.lang.IllegalArgumentException: Interval must fit into src in SubsetViews.subsetView(...)
java.lang.RuntimeException: java.lang.IllegalArgumentException: Interval must fit into src in SubsetViews.subsetView(...)
    at org.knime.knip.base.node.ValueToCellNodeModel$1.getCells(
    at org.knime.knip.base.node.ValueToCellNodeModel.execute(
    at org.knime.knip.imagej1.IJMacroNodeFactory$1.execute(
    at org.knime.core.node.NodeModel.executeModel(
    at org.knime.core.node.Node.invokeFullyNodeModelExecute(
    at org.knime.core.node.Node.execute(
    at org.knime.core.node.workflow.NativeNodeContainer.performExecuteNode(
    at org.knime.core.node.exec.LocalNodeExecutionJob.mainExecute(
    at org.knime.core.node.workflow.NodeExecutionJob.internalRun(
    at org.knime.core.util.ThreadUtils$RunnableWithContextImpl.runWithContext(
    at org.knime.core.util.ThreadUtils$
    at java.util.concurrent.Executors$
    at org.knime.core.util.ThreadPool$
    at org.knime.core.util.ThreadPool$
Caused by: java.lang.IllegalArgumentException: Interval must fit into src in SubsetViews.subsetView(...)
    at net.imglib2.ops.operation.SubsetOperations.subsetview(
    at org.knime.knip.imagej1.IJMacroNodeFactory$1.compute(
    at org.knime.knip.imagej1.IJMacroNodeFactory$1.compute(
    at org.knime.knip.base.node.ValueToCellNodeModel$1.getCells(
    ... 15 more

I tried to run a splitter after the segment cropper, but this gave the same error message. So probably the segment  cropper is the culprit.

In the ImageJ macro node, did you select all the dimensions that you'd like to process? When you tried with 1-channel images before, you probably had only X and Y selected in the dimension selector. Did you try selecting Channel as well?


There are no channels to select.

You said you're working with 3 channel images now.

What I meant was activating the Channel button in the Dimension Selection of the Macro node:

But maybe I'm misunderstanding your issue. Can you post an example workflow and image reproducing the problem?


The workflow including images is too large for me to upload. Could you send me your mail adres that I can send it to you?

There is no way "Montage to Stack" will work in the ImageJ Macro node, since it requires the input image and the result image to have the same dimensions. The "Montage to Stack" command will however inevitably add an additional dimension (stack) to your image, and in addition will change its x and y range.

You can however achieve what you want with KNIME Image Processing without requiring ImageJ macros. I'll follow up with a small example workflow soon.



Hi Jan,

I had it working before. So I know that it is possible, althought after changing my workflow I forgot to save an old version, so I have to rethink how it was working :)

I build a quick new workflow. Just add an image and run it.

Ok, I'm surprised that it works like that. But the problem might be that when you go to multiple channels and have a hyperstack within ImageJ, "Montage to Stack" will not work...

Anyhow, I attached a workflow avoiding ImageJ 1.x macros altogether. Maybe it helps for your project.


Have a nice weekend,



Looks wonderfull, thanks a lot!

Have a nice weekend as well.



This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.