Page 1 of 1

possible bioformats bug

PostPosted: Wed Dec 14, 2016 12:07 pm
by bob.stephens
Hi,
I am new to the forum. I have inherited a workflow that calls bioformats through imagej. I submitted this issue to the image forum, but have not received any response so I am trying here. The issue is an error that occurs when running headless and trying to import an image. I have several macros that attempt to load different images (nd2 and tiff) to reserve them in different formats or conversion states (eg. 32 to 16 bit). The same macros all produce the expected outputs when run from the command line on a window that allows gui creation (without the --headless switch), even though no gui is produced. The same command fails is I run it with the --headless switch or if I run it on a batch node with no GUI capability. If I remove the bioformats call, the macros run ok as far as I can tell so it seems it is within the bioformats part of the code.
It sounds to me like the code is trying to launch a dialog box and exits as soon as it fails that test:
here is the simple macro:
macro "simpleMacro" {
print("opened ok");
nd2file = getArgument();
setBatchMode(true);
p1=lastIndexOf(nd2file,"/");
p2=lastIndexOf(nd2file,".");
fileroot=substring(nd2file,p1+1,p2);
filepieces=split(fileroot,"_");
print(fileroot);
print("importing "+nd2file);
run("Bio-Formats Importer","open=nd2file");
print("read ok");
}
here is the command and error listing (partial)
../imagej.new/Fiji.app/ImageJ-linux64 --headless -macro simple_macro.ijm kras_nd2s/Plate_PharmaArava_2477_2480_WellH06_Seq0090.nd2
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=128m; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release
opened ok
Plate_PharmaArava_2477_2480_WellH06_Seq0090
importing kras_nd2s/Plate_PharmaArava_2477_2480_WellH06_Seq0090.nd2
java.lang.VerifyError: Bad type on operand stack
Exception Details:
Location:
loci/plugins/in/MainDialog.rebuildDialog(Lij/gui/GenericDialog;)V @1926: invokestatic
Reason:
Type 'ij/gui/GenericDialog' (current frame, stack[0]) is not assignable to 'java/awt/Container'
Current Frame:
bci: @1926
flags: { }
locals: { 'loci/plugins/in/MainDialog', 'ij/gui/GenericDialog', 'java/util/List', 'java/util/List', 'java/util/List', 'java/awt/Label', 'java/awt/Label', 'java/awt/Label', 'java/awt/Label', '[Ljava/awt/Component;', 'java/lang/String',

can you please provide some assistance - this is part of a high content assay so I really need to be able to run this in batch mode.
thank you for your help !
Bob

Re: possible bioformats bug

PostPosted: Thu Dec 15, 2016 11:37 am
by bramalingam
Hi,

Thank you for reporting your issue.
Could you please try the following logic,

nd2file= “<Path to file>”;
run("Bio-Formats Macro Extensions");
setBatchMode(true);
Ext.openImagePlus(nd2File);

This uses Bio-Formats macro extensions and should help run the importer in a windowless mode.
(logic: when setBatchMode(true) is called, all Bio-Formats macro extensions run in a windowless mode).

For more examples please take a look at the following page,
http://www.openmicroscopy.org/site/supp ... rs/imagej/
This covers the basics of using Bio-Formats via the macro language.

and for your use case please take a look at the logic used in the following example (in the page),
https://github.com/openmicroscopy/biofo ... onvert.txt
It runs the importer in batch-mode and should work in a windowless manner.

And for slightly advanced use-cases please take a look at the following ImageJ documentation page,
http://imagej.net/Bio-Formats

Hope that helps.

Best,
Balaji