Fail in batch mode

Hi,
I often have this issue where I can run macros fine but when I try to run them in batch mode I can’t any more.
For example the following works fine unless I set setBatchMode to “true”.

setBatchMode(false);
run("Fly Brain (1MB)");
name=getTitle();
selectWindow(name);
run("Deinterleave", "how=2 keep");

Could someone explain me how to fix this ?

Thank you very much

This is a bug in the Deinterleave plugin that the person who maintains that plugin will need to fix. In the meantime, you can work around the bug by using the Split Channels command, for example

  setBatchMode(true);
  run("Fly Brain (1MB)");
  run("Split Channels");
  setBatchMode("exit and display")

Thanks for the clarification @Wayne,

I actually really need to use the Deinterleave function. What would be the best way to deinterleave without using the deinterleave function ?

Sadly I find no contact information for the author of the plugin.

Thanks a lpt

Please provide a small macro that uses Deinterleave and demonstrates what you want to do.

Thank you for your help,
I literally open my files and the first thing I need to do is to deinterleave them as follows:

directory = getDirectory("Choose input files");
list=getFileList(directory);
setBatchMode(false);
for (i=0;i<list.length-1;i++) {

open(directory+list[i]);
name= File.name();
run("Deinterleave", "how=2 keep");

Thanks a lot

Please provide a sample image so we can run this macro, or provide a macro that uses one of the built in sample images. And why do you use the ‘keep’ option?

I managed to sort this out. By opening my files with bioformats I don’t need to deinterleave them. So I don’t have any more the issue described above.

Thank you for your help

Hi @Wayne
I am the maintainer of the stack manipulation package. Until Tony Collins (the author) returns, I have to fix it myself.
Could you point me to how to reproduce the bug?

Hi @tinevez,
If you run the following as it is, it works fine but if you set BatchMode to true then in fails.

setBatchMode(false);
run("Fly Brain (1MB)");
name=getTitle();
selectWindow(name);
run("Deinterleave", "how=2 keep");

Thanks !

This bug should be easy to fix. Replace

impTmp.getWindow().repaint();

with

  ImageWindow win = impTmp.getWindow();
  if (win!=null)
      win.repaint();

And replace

imp2.getWindow().close();

with

imp2.close();

2 Likes

Hi @Wayne and @LPUoO

Thank you very much. I implemented this fix:

I have released and uploaded Stack_Manipulation-2.1.2.jar to the Fiji java8 update site. If you update Fiji now you will get it.

Could you test it on your side and tell me whether it works?

1 Like

I updated Fiji and now the following test macro no longer throws an exception:

setBatchMode(true);
run("Fly Brain (1MB)");
name=getTitle();
selectWindow(name);
run("Deinterleave", "how=2 keep");
3 Likes