Login  Register

Re: passing image to ImageJ via Java Web Start

Posted by ctrueden on Feb 01, 2010; 7:52pm
URL: http://imagej.273.s1.nabble.com/passing-image-to-ImageJ-via-Java-Web-Start-tp3689525p3689530.html

Hi Bill,

Will the jnlp arg approach work for files that "Open" won't open in ImageJ?
>
>
The short answer is "no," although you could make it work by creating your
own Java launcher class.

The idea is to code a class with a main method that accepts the arguments
you want to pass, and does whatever you want with them. So, you would have a
Java class, MyLauncher.java, with an appropriate main method, that processes
the arguments passed via "String[] args". These values are then provided in
the JNLP under the "<application-desc>" section as "<argument>" elements.
Since the arguments are programmatically generated, that's where the
PHP/Python/Perl/whatever comes in—populate the <argument> element with
whatever the appropriate string is. How your application's main method
handles the string is up to you.

Otherwise, rather than write your own Java class, you can invoke ij.ImageJ
or fiji.Main, and it should accept filename arguments (but only which, as
you point out, work with the "Open" command). But you must watch out for
what Johannes mentioned: Web Start apps cannot access the local filesystem
unless you are using signed JARs.

-Curtis

On Mon, Feb 1, 2010 at 1:25 PM, Bill Mohler <[hidden email]> wrote:

>  Curtis & Dscho-
>
> Will the jnlp arg approach work for files that "Open" won't open in ImageJ?
>
>
>
>
> Curtis Rueden wrote:
>
> Hi Arnim, Bill & Johannes,
>
>
>
>
>  Having said that, if you manage to make a .jnlp file that _does_ load an
> image as you want, it is relatively easy to produce a .php or .perl script
> to generate a custom .jnlp from HTTP variables (i.e. parameters you pass
> in by appending "?variable=value" to the URL).
>
>
>
>  Indeed, I used this technique to produce a tailored JNLP to launch VisBio
> from the old OME web client, to pass an image ID into the program:
> http://trac.openmicroscopy.org.uk/ome/browser/trunk/src/perl2/OME/Web/VisBio.pm
>
> Yours would surely be simpler, too. :-)
>
> -Curtis
>
> On Mon, Feb 1, 2010 at 4:33 AM, Johannes Schindelin <[hidden email]> wrote:
>
>
>
>  Hi,
>
> On Sun, 31 Jan 2010, arnim.jenett wrote:
>
>
>
>  Situation: I created a catalog of images using html. these images I
> currently can open in ImageJA (applet), but 1) after a couple of images I
> reliably run into a an "out-of-memory" exception
>
>
>  With Java >= 1.6, you can specify larger memory with applets:
>
>        https://jdk6.dev.java.net/plugin2/
>
>      and 2) on a weak network it is rather slow to download Imagej every time
> I call it (often).
>
>
>  Right.
>
>
>
>  Therefore I thought about using Java Web Start instead and found the
> corresponding jnpls ( thanks dscho, curtis and wayne). But there is no
>
>
>  way
>
>
>  documented how I could pass image information via the jnpl to ImageJ.
>
>
>  I would suggest something like this:
>
>        <application-desc main-class="fiji.Main">
>                <argument>http://example.com/image.png</argument>
>        </application-desc>
>
> (For Fiji, we run fiji.Main rather than ij.ImageJ)
>
>
>
>  I also tried to pass it as "<argument>" from inside the
>
>
>  "<application-desc>"
>
>
>  but that failed as well.
>
>
>  I guess that it does not work with local paths, unless you have a signed
> jnlp. Do you have any error message from that try?
>
>
>
>  even nicer would be, if I could call the jnpl with the image's parameters
> (in hmtl).
>
>
>  You can specify a Java Webstart only with a .jnlp file, i.e. this xml
> format you already know.  There is no way to specify any add-on options
> via .html.
>
> Having said that, if you manage to make a .jnlp file that _does_ load an
> image as you want, it is relatively easy to produce a .php or .perl script
> to generate a custom .jnlp from HTTP variables (i.e. parameters you pass
> in by appending "?variable=value" to the URL).
>
> Ciao,
> Dscho
>
>
>
>  .
>
>
>
>