passing image to ImageJ via Java Web Start

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

passing image to ImageJ via Java Web Start

arnim.jenett
Hi,
is there a way to pass the path of an image to imagej when it is called by Java Web Start?

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 and 2) on a weak network it is rather slow to download Imagej every time I call it (often).
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.

for clarification; from a shell I would do this like this:
#!/bin/sh
java -jar /full/path/to/ImageJ/ij.jar -ijpath /full/path/to/ImageJ /full/path/to/my/image

reading up on this I hoped it would be as easy as passing the image to the call of ij.jar, so in the ImageJ.jnpl I changed

    <jar href="http://rsb.info.nih.gov/ij/signed-applet/ij.jar"/>

into

    <jar href="http://rsb.info.nih.gov/ij/signed-applet/ij.jar?arg=/tests/Photo1.jpg"/>

but that does not work.
I also tried to pass it as "<argument>" from inside the "<application-desc>" but that failed as well.

even nicer would be, if I could call the jnpl with the image's parameters (in hmtl).
Does something like this exist?
Thanks,
aRnim
Reply | Threaded
Open this post in threaded view
|

Re: passing image to ImageJ via Java Web Start

Bill Mohler
I've been fiddling with this myself. Can't do it just in the jnlp, from
my asking around.

My solution is currently to have an autorun startup macro in the ij.jar
called by my jnlp file. The autorun macro simply runs another macro from
a file at a url. The second macro contains a line that opens a movie
file. This might work for your images too. I have a Perl script that
actually rewrites the second server-side macro file to point to an
arbitrary selection from a movie collection, based on a user mouse click
in a web page.

Try clicking a "...Mov" link @ http://glowormnotes.blogspot.com to see
an example at work.

I can send you code bits as well.

Bill

 


arnim.jenett wrote:

> Hi,
> is there a way to pass the path of an image to imagej when it is called by
> Java Web Start?
>
> 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 and 2) on a weak network it
> is rather slow to download Imagej every time I call it (often).
> 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.
>
> for clarification; from a shell I would do this like this:
> #!/bin/sh
> java -jar /full/path/to/ImageJ/ij.jar -ijpath /full/path/to/ImageJ
> /full/path/to/my/image
>
> reading up on this I hoped it would be as easy as passing the image to the
> call of ij.jar, so in the ImageJ.jnpl I changed
>
>     <jar href="http://rsb.info.nih.gov/ij/signed-applet/ij.jar"/>
>
> into
>
>     <jar
> href="http://rsb.info.nih.gov/ij/signed-applet/ij.jar?arg=/tests/Photo1.jpg"/>
>
> but that does not work.
> I also tried to pass it as "<argument>" from inside the "<application-desc>"
> but that failed as well.
>
> even nicer would be, if I could call the jnpl with the image's parameters
> (in hmtl).
> Does something like this exist?
> Thanks,
> aRnim
>  
Reply | Threaded
Open this post in threaded view
|

Re: passing image to ImageJ via Java Web Start

dscho
In reply to this post by arnim.jenett
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
Reply | Threaded
Open this post in threaded view
|

Re: passing image to ImageJ via Java Web Start

ctrueden
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
>
Reply | Threaded
Open this post in threaded view
|

Re: passing image to ImageJ via Java Web Start

ctrueden
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
>
>
>
>  .
>
>
>
>
Reply | Threaded
Open this post in threaded view
|

ImageJ versions and changes in Inversion behavior

Robert Baer
There has apparently been a some subtle change to the way image inversion
occurs as we moved from ImageJ v1.41o to v1.43o.  Because I'm not entirely
clear what I'm looking for, the code I'm using is complex, and I'm not a
Java expert, I thought I'd start by asking if there are known changes to the
inversion behavior from1.41o to 1.43o.  The code I'm working with was
originally designed with a version prior to 1.41o, but continues to work at
least through version 1.41o.  It seems broken in v1.43o.  I'm using the
Windows XP version of ImageJ.

The change in behavior that I notice is basically that with ImageJ 1.41o I
get a black on white image, but with the newer 1.43o I get a white on black
image at a critical intermediate image of the complex .  The pixel count for
0 with version 1.43o  is identical with the pixel count for 255 with version
1.42o.  This is continues in this inverted fashion except for slight
deviations in pixel count at the highest "white values" (47-64) on the 1.42o
imageJ image which correspond to the "blackest values" on the 1.43o ImageJ
(207-190).  I'm attaching the tab separated text file of the histograms
although I don't know if it will survive posting.

The other slight clue I have is that with newer version 1.43o, if I take my
white on black 8-bit grayscale image, change it to RGB, and then change it
back to 8-bit grayscale, the histogram values get automatically stretched to
cover the entire 256 grayscale range.  With the older black on white image
from 1.42o, changing to RGB and back does not alter the histogram.  I
therefore wonder if there might be some image formating step that my code is
doing whose behavior is having secondary effects on the "apparent inversion"
of the histogram.  I reiterate that a single set of code has two outcomes
depending only on ImageJ version.

I realize this is limited information to go on, but I'm hoping for some
clues that might help me find the critical area of my code and produce a
clean reproducible example of my problem for more detailed feedback.  All
suggests of where to start are welcome.

Thanks,

Rob Baer
Reply | Threaded
Open this post in threaded view
|

Re: ImageJ versions and changes in Inversion behavior

Gabriel Landini
On Monday 01 Feb 2010  09:24:39 you wrote:
> The change in behavior that I notice is basically that with ImageJ 1.41o I
> get a black on white image, but with the newer 1.43o I get a white on black
> image at a critical intermediate image of the complex.

Hi Rob,
I cannot reproduce what you say in 1.43p4 under linux. Can you post a macro
showing that effect?
Are you sure that you are not using images with an inverted LUT?

> The other slight clue I have is that with newer version 1.43o, if I take my
> white on black 8-bit grayscale image, change it to RGB, and then change it
> back to 8-bit grayscale, the histogram values get automatically stretched
>  to cover the entire 256 grayscale range.

I can't reproduce this either...
A macro example would help to pinpoint what this problem might be.
BTW, what are your setting in Process>Binary>Options? and what are the colours
set in the Color Picker?
Cheers,
G.
Reply | Threaded
Open this post in threaded view
|

Re: passing image to ImageJ via Java Web Start

arnim.jenett
In reply to this post by Bill Mohler
Hi Bill,
thanks you very much for the nice reply.
I followed the link you send using firefox or safari (java 1.6, mac os
x, 10.5.8), but I was not able to run any of the movies you link to.
ImageJ opens via Java Web Start, but without any data. That makes me
think, that maybe something in the configuration of my local system is
not right. on a different machine I got an error message stating, that
"this macro needs 32bit Java" which makes sense, because both machines
are running 64bit Javas and I know that the movie player (Quicktime) in
ImageJ only works on 32bit-systems. therefore ,if you use the movie
player, the web start including a movie can not work on 64bit-systems,
which still is a pity.

Principally I like the idea of dynamically written macros called by an
autorun-macro. Would you mind to share some code? Maybe I can modify it
to my needs. I just need to open jpgs. that should be possible with the
construct you are using.

Thanks,
aRnim


On 1/31/10 8:56 PM Bill Mohler [via ImageJ] wrote:

> I've been fiddling with this myself. Can't do it just in the jnlp, from
> my asking around.
>
> My solution is currently to have an autorun startup macro in the ij.jar
> called by my jnlp file. The autorun macro simply runs another macro from
> a file at a url. The second macro contains a line that opens a movie
> file. This might work for your images too. I have a Perl script that
> actually rewrites the second server-side macro file to point to an
> arbitrary selection from a movie collection, based on a user mouse click
> in a web page.
>
> Try clicking a "...Mov" link @ http://glowormnotes.blogspot.com to see
> an example at work.
>
> I can send you code bits as well.
>
> Bill
>
>  
>
>
> arnim.jenett wrote:
>
>  > Hi,
>  > is there a way to pass the path of an image to imagej when it is
> called by
>  > Java Web Start?
>  >
>  > 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 and 2) on a weak
> network it
>  > is rather slow to download Imagej every time I call it (often).
>  > 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.
>  >
>  > for clarification; from a shell I would do this like this:
>  > #!/bin/sh
>  > java -jar /full/path/to/ImageJ/ij.jar -ijpath /full/path/to/ImageJ
>  > /full/path/to/my/image
>  >
>  > reading up on this I hoped it would be as easy as passing the image
> to the
>  > call of ij.jar, so in the ImageJ.jnpl I changed
>  >
>  >     <jar href="http://rsb.info.nih.gov/ij/signed-applet/ij.jar"/>
>  >
>  > into
>  >
>  >     <jar
>  >
> href="http://rsb.info.nih.gov/ij/signed-applet/ij.jar?arg=/tests/Photo1.jpg"/>
>
>  >
>  > but that does not work.
>  > I also tried to pass it as "<argument>" from inside the
> "<application-desc>"
>  > but that failed as well.
>  >
>  > even nicer would be, if I could call the jnpl with the image's
> parameters
>  > (in hmtl).
>  > Does something like this exist?
>  > Thanks,
>  > aRnim
>  >  
>
>
> ------------------------------------------------------------------------
> View message @
> http://n2.nabble.com/passing-image-to-ImageJ-via-Java-Web-Start-tp4490759p4492093.html 
>
> To unsubscribe from passing image to ImageJ via Java Web Start, click
> here
> <http://n2.nabble.com/subscriptions/Unsubscribe.jtp?code=amVuZXR0YUBqYW5lbGlhLmhobWkub3JnfDQ0OTA3NTl8LTIzNTM0MjcyMw==>.
>
>

jenetta.vcf (310 bytes) Download Attachment