advice on running ImageJ headless

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

advice on running ImageJ headless

Brian Willkie-2
Hello,

I need a command line application to process ~17000 images, tracking  
particles and collecting (at least) particle-id, centroid, and area,  
(and possibly standard deviation, min/max, and mean within the  
particle,). I also need to format and write the results to disk, doing  
all with no gui/ no additional interaction once the command-line  
options are set.

I've found a little information on Headless ImageJA from the wiki:

http://imagejdocu.tudor.lu/imagej-documentation-wiki/faq/how-do-i-run-imagej-without-a-graphics-environment-headless/?searchterm=no%20gui

Given the size of this project,  I'd like to solicit some advice on  
how to proceed:
1. Can I run headless ImageJA only in batch mode (i.e. do I have to  
work with macros?), or can I use headless ImageJA to build my own  
application using the ImageJ API?
2. I've had the most success in particle-tracking with MTrack2.  
However MTrack2 won't provide the area (nor standard deviation,  
min/max, nor mean). I don't mind adapting the code myself, but I'd  
like to know if this is the best (only?) option?

If the answers to 1 and 2 are yes, then I assume the way to proceed is:
1. adapt the MTrack2 code for my own plugin to be called in a macro  
following the examples in the ImpProps and Image5D_Extensions plugins.
2. Write a macro that calls my adapted particle-tracking plugin.
3. Run ImageJ from the command line with headless.jar in the  
classpath, the -batch flag, and call my macro.

Does this sound accurate? Am I missing something? Is there a better  
way, or is this the way to go?

Thanks,
Brian Willkie
Reply | Threaded
Open this post in threaded view
|

Re: advice on running ImageJ headless

dscho
Hi,

On Mon, 28 Apr 2008, Brian Willkie wrote:

> 1. Can I run headless ImageJA only in batch mode (i.e. do I have to work
>    with macros?), or can I use headless ImageJA to build my own
>    application using the ImageJ API?

You can run ImageJA in head"full" mode.  Use the Macro Recorder there to
get an initial macro that you can extend by hand (for example, making a
loop around it, calling the same things for every image in a directory).

Then use headless ImageJA to run it: headless ImageJA cannot run with a
GUI.

Ciao,
Dscho
Reply | Threaded
Open this post in threaded view
|

Re: advice on running ImageJ headless

Albert Cardona
In reply to this post by Brian Willkie-2
Hi Brian,

You can run ImageJ or ImageJA on a virtual frame buffer. For example:

$ Xvfb :15 &
$ DISPLAY=:15 java -Xms3600m -Xmx3600m -classpath ij.jar ij.ImageJ -eval
'run("My PlugIn Name");'

Just be sure to call System.exit(0) at the very last line of your
plugin, or you won't see it return when its done.

The above assumes an X11 installation exists.

Hope that helped.

Albert

--
Albert Cardona
http://www.mcdb.ucla.edu/Research/Hartenstein/acardona
Reply | Threaded
Open this post in threaded view
|

Re: advice on running ImageJ headless

Brian Willkie-2
Hi Albert,

Thanks for the reply. I'm running on a Mac (cluster), so I'm not sure  
if this is an option. There's a mention of it on the wiki, but it's  
rather vague:

http://imagejdocu.tudor.lu/imagej-documentation-wiki/faq/how-do-i-run-imagej-without-a-graphics-environment-headless/?searchterm=no%20gui

Thanks,
Brian

Quoting Albert Cardona <[hidden email]>:

> Hi Brian,
>
> You can run ImageJ or ImageJA on a virtual frame buffer. For example:
>
> $ Xvfb :15 &
> $ DISPLAY=:15 java -Xms3600m -Xmx3600m -classpath ij.jar ij.ImageJ
> -eval 'run("My PlugIn Name");'
>
> Just be sure to call System.exit(0) at the very last line of your
> plugin, or you won't see it return when its done.
>
> The above assumes an X11 installation exists.
>
> Hope that helped.
>
> Albert
>
> --
> Albert Cardona
> http://www.mcdb.ucla.edu/Research/Hartenstein/acardona
Reply | Threaded
Open this post in threaded view
|

Re: advice on running ImageJ headless

Albert Cardona
Brian Willkie wrote:
> Hi Albert,
>
> Thanks for the reply. I'm running on a Mac (cluster), so I'm not sure
> if this is an option. There's a mention of it on the wiki, but it's
> rather vague:
>
> http://imagejdocu.tudor.lu/imagej-documentation-wiki/faq/how-do-i-run-imagej-without-a-graphics-environment-headless/?searchterm=no%20gui 
>
>



As far as I remember, launching ImageJ from the comand line on a remote
mac will display the GUI in that remote mac no matter what (aqua
interface blues) but that should not be a problem at all: ImageJ will
run just the same.

So you don't need the Xvfb neither the DISPLAY variable.

If the run on a cluster macosx throws some sort of headless exception,
then use ImageJA headless.jar. It will work fine as long as the plugins
you execute neither import nor use any java.awt or javax.swing classes,
which includes the ImageWindow (extends java.awt.Window).

The headless.jar, when placed before ij.jar in the classpath, will
provide replacements (the classpath loads the first class found) for the
problematic ij.Menus and ij.GenericDialog.

Albert

--
Albert Cardona
http://www.mcdb.ucla.edu/Research/Hartenstein/acardona
Reply | Threaded
Open this post in threaded view
|

Opening MATROX Lossless JPEG

picheral
Dear Albert,
I'm trying to open JPEG lossaless images
compressed by the MATROX library. Is there any plugin available for that ?
Regards
Marc P.



----------------------------------------------------------------------------------
VISIT our WEB site !

http://www.obs-vlfr.fr/LOV/ZooPart/
----------------------------------------------------------------------------------

Marc PICHERAL, ingenieur
Laboratoire d'Océanologie de Villefranche sur mer
CNRS UPMC UMR7093
Observatoire Océanologique de Villefranche-sur-Mer
Station Zoologique
La Darse
BP 28
06234 Villefranche sur mer
Tel : 04 93 76 38 08
Fax: 04 93 76 38 34  
Reply | Threaded
Open this post in threaded view
|

Re: Opening MATROX Lossless JPEG

ctrueden
Hi Marc,

I'm trying to open JPEG lossaless images compressed by the MATROX library.
> Is there any plugin available for that ?
>

The Matrox library uses standard JPEG2000 JP2 format, right? Have you tried
Bio-Formats?

-Curtis

On Tue, Apr 29, 2008 at 2:03 AM, Marc Picheral <[hidden email]>
wrote:

> Dear Albert,
> I'm trying to open JPEG lossaless images compressed by the MATROX library.
> Is there any plugin available for that ?
> Regards
> Marc P.
>
>
>
>
> ----------------------------------------------------------------------------------
> VISIT our WEB site !
>
> http://www.obs-vlfr.fr/LOV/ZooPart/
>
> ----------------------------------------------------------------------------------
>
> Marc PICHERAL, ingenieur
> Laboratoire d'Océanologie de Villefranche sur mer
> CNRS UPMC UMR7093
> Observatoire Océanologique de Villefranche-sur-Mer
> Station Zoologique
> La Darse
> BP 28
> 06234 Villefranche sur mer
> Tel : 04 93 76 38 08
> Fax: 04 93 76 38 34
>
Reply | Threaded
Open this post in threaded view
|

Re: Opening MATROX Lossless JPEG

picheral
Dear Curtis,
Thanks for your response, but this format is not the JPEG2000 or JP2. I
have not yet tried the Bio format.
Regards
Marc P.


> Hi Marc,
>
> I'm trying to open JPEG lossaless images compressed by the MATROX library.
>> Is there any plugin available for that ?
>>
>
> The Matrox library uses standard JPEG2000 JP2 format, right? Have you
> tried
> Bio-Formats?
>
> -Curtis
>
> On Tue, Apr 29, 2008 at 2:03 AM, Marc Picheral <[hidden email]>
> wrote:
>
>> Dear Albert,
>> I'm trying to open JPEG lossaless images compressed by the MATROX
>> library.
>> Is there any plugin available for that ?
>> Regards
>> Marc P.
>>
>>
>>
>>
>> ----------------------------------------------------------------------------------
>> VISIT our WEB site !
>>
>> http://www.obs-vlfr.fr/LOV/ZooPart/
>>
>> ----------------------------------------------------------------------------------
>>
>> Marc PICHERAL, ingenieur
>> Laboratoire d'Océanologie de Villefranche sur mer
>> CNRS UPMC UMR7093
>> Observatoire Océanologique de Villefranche-sur-Mer
>> Station Zoologique
>> La Darse
>> BP 28
>> 06234 Villefranche sur mer
>> Tel : 04 93 76 38 08
>> Fax: 04 93 76 38 34
>>
>


--
Marc Picheral
Laboratoire d'Oceanologie de Villefranche
CNRS-UPMC
Station Zoologique
Chemin du Lazaret
06234 Villefranche sur mer
Tel: +4 93 76 38 08
Fax: +4 93 76 38 34