ImageJ and X11

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

ImageJ and X11

Mohana Ramaratnam-2
Hello,

 

I want to use ImageJ as a "background" process to create some images.
These images are not viewed but written on disk. The environment that I
am running this is on doesn't have any DISPLAY variable.

 

I have tried launching my java app with -Djava.awt.headless=true with no
success (java version 1.5.0_06 OS: solaris).

 

The error that I get is:

 

java.awt.HeadlessException

 

at java.awt.GraphicsEnvironment.checkHeadless
(GraphicsEnvironment.java:159)

at java.awt.Window. <init> (Window.java:317)

....

at ij.process.ImageProcessor.setupFrame (ImageProcessor.java:827)

at ij.process.ImageProcessor.getStringWidth (ImageProcessor.java:934)

....

 

Does anybody have any suggestions?

 

Mohana

 
Reply | Threaded
Open this post in threaded view
|

Re: ImageJ and X11

Stansfield, William
Mohana,
 
Without being an expert, I can tell you that I rec'd similar error messages in switching from Mac to Unix processing.
1st, when you log in to your system using X11, make sure that you ssh with X-window display forwarding:
     ssh -X [hidden email]
 
Next, you should probably use the latest versions of ImageJ and Java; last time I updated it was 1.38j and Java v1.6.
 
It may or may not help to run your macros in batch mode, which turns off ImageJ's desire to display images as it generates them.
 
That was my experience.
Good luck,
Bill Stansfield
 
 
________________________________

From: ImageJ Interest Group on behalf of Mohana Ramaratnam
Sent: Tue 3/13/2007 4:12 PM
To: [hidden email]
Subject: ImageJ and X11



Hello,



I want to use ImageJ as a "background" process to create some images.
These images are not viewed but written on disk. The environment that I
am running this is on doesn't have any DISPLAY variable.



I have tried launching my java app with -Djava.awt.headless=true with no
success (java version 1.5.0_06 OS: solaris).



The error that I get is:



java.awt.HeadlessException



at java.awt.GraphicsEnvironment.checkHeadless
(GraphicsEnvironment.java:159)

at java.awt.Window. <init> (Window.java:317)

....

at ij.process.ImageProcessor.setupFrame (ImageProcessor.java:827)

at ij.process.ImageProcessor.getStringWidth (ImageProcessor.java:934)

....



Does anybody have any suggestions?



Mohana
Reply | Threaded
Open this post in threaded view
|

Re: ImageJ and X11

Albert Cardona
In reply to this post by Mohana Ramaratnam-2
There are past posts on the issue. You can use the equivalent to
/dev/null for your framebuffer, which is a virtual frame buffer for X
windows (I can't remember its name, please look it up in the list archives).

Otherwise, use the ImageJ classes directly from a plugin without neither
instantiating ImageJ's main class (which requires X11 because it creates
menus even if not shown) nor calling "show()" on any ImagePlus instance.
Then any java code can use the ij.jar and run in the background without
problems. Even execute macros from the internal macro interpreter.

Hope it helps.

Albert
Reply | Threaded
Open this post in threaded view
|

Re: ImageJ and X11

dscho
In reply to this post by Mohana Ramaratnam-2
Hi,

On Tue, 13 Mar 2007, Mohana Ramaratnam wrote:

> I want to use ImageJ as a "background" process to create some images.
> These images are not viewed but written on disk. The environment that I
> am running this is on doesn't have any DISPLAY variable.
>
> I have tried launching my java app with -Djava.awt.headless=true with no
> success (java version 1.5.0_06 OS: solaris).

You should try to run it in batch mode instead. I.e. write a macro, and
call ImageJ with "-batch <macro>".

Hth,
Dscho