How to set DISPLAY environment variable when running ImageJ with NO_SHOW option

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to set DISPLAY environment variable when running ImageJ with NO_SHOW option

Mike O'Leary
I would like to use ImageJ as a library with no UI to do image transformations. I downloaded the source for version 2.44K and built it, and when my code makes the function call

ImageJ ijObj = new ImageJ(null, ImageJ.NO_SHOW);

because I was told that an ImageJ object needed to be constructed for some operations to succeed, even if they don't directly use the ImageJ object, I get an error message when running on a Linux machine that does not have the DISPLAY environment variable defined. The machine doesn't have X Windows installed on it, and it seems unnecessary to install it just in order to set DISPLAY to a value to satisfy ImageJ even though my code doesn't display anything. Is there a value I can set DISPLAY to that is an acceptable way to enable ImageJ to do whatever it needs to do with it when it is running in NO_SHOW mode? Thanks.
Mike
Reply | Threaded
Open this post in threaded view
|

Re: How to set DISPLAY environment variable when running ImageJ with NO_SHOW option

ctrueden
Hi Mike,

I get an error message when running on a Linux machine that does not have
> the DISPLAY environment variable defined.
>

First, I suggest trying your operations without invoking a "new ImageJ"
instance and see if they work, since some operations on ImagePlus do.

If that doesn't work, one simple option to solve the X11/DISPLAY issue is to
install a virtual frame buffer (xvfb) on your Linux box.

If you want to run ImageJ in true headless mode, it is a bit tricky. There
is a good writeup by Kota Miura here:
  http://cmci.embl.de/documents/100922imagej_cluster

Essentially there is a headless.jar library that you put in the classpath
before ij.jar, which overrides a handful of key ImageJ classes to work
better headlessly.

As a side note, Fiji (http://pacific.mpi-cbg.de/) also supports headless
operation with the "--headless" command line flag, using this same hack.

The ImageJDev effort (http://imagejdev.org) is working toward decoupling the
ImageJ user interface from the data model, which will make running headless
much easier, but it will be a few more months before we have something
stable and usable.

HTH,
Curtis

On Tue, Dec 14, 2010 at 12:39 PM, Mike O'Leary
<[hidden email]>wrote:

> I would like to use ImageJ as a library with no UI to do image
> transformations. I downloaded the source for version 2.44K and built it, and
> when my code makes the function call
>
> ImageJ ijObj = new ImageJ(null, ImageJ.NO_SHOW);
>
> because I was told that an ImageJ object needed to be constructed for some
> operations to succeed, even if they don't directly use the ImageJ object, I
> get an error message when running on a Linux machine that does not have the
> DISPLAY environment variable defined. The machine doesn't have X Windows
> installed on it, and it seems unnecessary to install it just in order to set
> DISPLAY to a value to satisfy ImageJ even though my code doesn't display
> anything. Is there a value I can set DISPLAY to that is an acceptable way to
> enable ImageJ to do whatever it needs to do with it when it is running in
> NO_SHOW mode? Thanks.
> Mike
>