[ome-devel] HPC/OMERO integration

Curtis Rueden ctrueden at wisc.edu
Thu Mar 1 20:20:48 GMT 2012


Hi Alex, Josh et. al,

I have used a similar approach to call ImageJ within OMERO scripts. I had
> to overcome the Java headless problem (since my server does not have an X
> environment and Java's AWT libraries on linux are tied to the X server).
> This was easy enough for ImageJ with a few custom classes that do not show
> graphical objects. I can then call ImageJ with a script to do any
> processing I like on the exported TIFFs.
>

Fiji employs similar hacks. It used to have a special JAR file that was
prepended to the classpath before ij.jar, but now we opt to use Javassist
with runtime patching instead, as it is less susceptible to problems when
ij.jar changes. You can launch scripts and plugins headlessly using the
--headless option of the Fiji launcher. See:


http://fiji.sc/wiki/index.php/Scripting_Help#Running_Scripts_in_Headless_Mode

If you are going to try to integrate ImageJ1 with OMERO headlessly, I
strongly suggest using Fiji rather than struggling with these issues
yourself.

java.lang.VerifyError: (class: loci/plugins/in/MainDialog, method:
> rebuildDialog signature: (Lij/gui/GenericDialog;)V) Incompatible argument
> to function
>

We decided a while ago *not* to fix this in the Bio-Formats Importer plugin
for ImageJ1. ImageJ2 is much more headless-friendly, including its file
import mechanism (which is largely driven by Bio-Formats / SCIFIO).

I'm not sure what your use case is here, but is there way we can do it
using ImageJ2 instead of ImageJ1?

> Alternatively it may be that I should just recompile BioFormats against
> my headless.jar. Then the Java linking should be OK.
>

Unfortunately, I do not think this will work. You will need to change code
in the Bio-Formats Importer that makes assumptions about the GenericDialog.
One major issue is that the Importer attempts to rebuild a java.awt.Frame
to add scroll bars, meaning it calls various AWT routines that have no hope
of working headlessly.

-Curtis


On Wed, Feb 29, 2012 at 6:21 AM, Josh Moore <josh at glencoesoftware.com>wrote:

> Melissa, a few issues with headless exception of bioformats on the cluster
> which Alex recently brought up in a private message based on the forum
> post:
> https://www.openmicroscopy.org/community/viewtopic.php?f=6&t=1051#p3834
>
> Also, if anyone else is doing something similar with their cluster and
> OMERO, let us know.
>
> ~Josh.
>
>
> > Sent: Tue Feb 21, 2012 1:37 pm
> > by a.herbert
> >
> > Hi Josh,
> >
> > I can send you my code so you can have a look at it.
>
> Done. Thanks!
>
> > Basically I have an OMERO script that checks parameters and then calls a
> command-line script to do the work. This means I can test and develop the
> script without going through the OMERO scripts interface.
> >
> > First I export the image as single plane tiffs. The only way I have
> managed to get it to work for my 16-bit multi-plane images is to convert
> them using numpy to 32-bit floats. These can be IO handled by PIL. PIL is
> not as advanced at reading and writing TIFFs as it could be.
> >
> > The rest of the processing is done by submitting a bunch of jobs to a
> farm. The final script collates all the output images and uploads them
> using the Python API. This creates a new image using a numpy array
> generator that reads the TIFFs.
> >
> > It is a bit of a mishmash but I got it to work. The reusable parts would
> probably be the process for getting the images out of OMERO and back in.
> The rest of the code is custom.
> >
> > I have used a similar approach to call ImageJ within OMERO scripts. I
> had to overcome the Java headless problem (since my server does not have an
> X environment and Java's AWT libraries on linux are tied to the X server).
> This was easy enough for ImageJ with a few custom classes that do not show
> graphical objects. I can then call ImageJ with a script to do any
> processing I like on the exported TIFFs.
> >
> > I could not use BioFormats in a headless environment. It has code tied
> to the X lib too. So instead of trying to recode this I just export my
> images to TIFFs and ImageJ can read them.
>
> See below for a follow-up on this.
> ...
> > Alex
>
>
>
>
> > Sent: Tue Feb 28, 2012 4:41 pm
> > by a.herbert
> >
> > I just checked the problem with BioFormats again. The issue is that to
> run in a headless environement you have to alter the GenericDialog so that
> it does not extend java.awt.Dialog. The java.awt.Dialog class throws a
> HeadlessException when GraphicsEnvironment.isHeadless() returns true.
> >
> > Changing the signature causes BioFormats to error since the
> GenericDialog does not match the signature it is expecting:
> >
> > Code: Select all
> > java.lang.VerifyError: (class: loci/plugins/in/MainDialog, method:
> rebuildDialog signature: (Lij/gui/GenericDialog;)V) Incompatible argument
> to function
> >         at
> loci.plugins.in.ImporterPrompter.promptMain(ImporterPrompter.java:126)
> >         at
> loci.plugins.in.ImporterPrompter.statusUpdated(ImporterPrompter.java:79)
> >         at
> loci.plugins.in.ImportProcess.notifyListeners(ImportProcess.java:461)
> >         at loci.plugins.in.ImportProcess.step(ImportProcess.java:757)
> >         at loci.plugins.in.ImportProcess.execute(ImportProcess.java:142)
> >         at loci.plugins.in.Importer.showDialogs(Importer.java:125)
> >         at loci.plugins.in.Importer.run(Importer.java:77)
> >         at loci.plugins.LociImporter.run(LociImporter.java:79)
> >         at ij.IJ.runUserPlugIn(IJ.java:183)
> >         at ij.IJ.runPlugIn(IJ.java:150)
> >         at ij.Executer.runCommand(Executer.java:127)
> >         at ij.Executer.run(Executer.java:64)
> >         at ij.IJ.run(IJ.java:249)
> >         at ij.macro.Functions.doRun(Functions.java:579)
> >         at ij.macro.Functions.doFunction(Functions.java:82)
> >         at ij.macro.Interpreter.doStatement(Interpreter.java:203)
> >         at ij.macro.Interpreter.doStatements(Interpreter.java:191)
> >         at ij.macro.Interpreter.run(Interpreter.java:102)
> >         at ij.macro.Interpreter.run(Interpreter.java:72)
> >         at ij.macro.Interpreter.run(Interpreter.java:83)
> >         at ij.plugin.Macro_Runner.runMacro(Macro_Runner.java:102)
> >         at ij.plugin.Macro_Runner.runMacroFile(Macro_Runner.java:87)
> >         at ij.IJ.runMacroFile(IJ.java:117)
> >         at ij.ImageJ.main(ImageJ.java:610)
> >
> >
> > Maybe I have not got my headless modifications correct. There may be a
> way around this I have not tried.
> >
> > Alternatively it may be that I should just recompile BioFormats against
> my headless.jar. Then the Java linking should be OK.
> >
> > I'll package up my cluster scripts and send them to you.
> >
> > Alex
> _______________________________________________
> ome-devel mailing list
> ome-devel at lists.openmicroscopy.org.uk
> http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openmicroscopy.org.uk/pipermail/ome-devel/attachments/20120301/58561a5b/attachment.html>


More information about the ome-devel mailing list