Auto Scale Image View to 100%

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

Auto Scale Image View to 100%

Cochella Chris
Hi All,

Is there a way to give imagej a parameter for each image loaded via a  
URL so that it loads and scales the image for 100% view?


We have images larger than the current window size and would like them  
to load so that the complete image is viewable on first load.

Thanks,
Chris

Chris
Reply | Threaded
Open this post in threaded view
|

Re: Auto Scale Image View to 100%

Albert Cardona
Cochella Chris wrote:
> Hi All,
>
> Is there a way to give imagej a parameter for each image loaded via a
> URL so that it loads and scales the image for 100% view?
>
>
> We have images larger than the current window size and would like them
> to load so that the complete image is viewable on first load.


Hi Chris,

You could run the "Zoom Exact" plugin from my website on each opened image.
Something like (in javascript):

var imp = IJ.openImage("http://path/to/image.tif");
imp.show();
IJ.run(imp, "Zoom Exact", "zoom=100");


The Zoom exact plugin lets you set 35, 134, whatever magnification you
want, in percent, while keeping the size of the canvas limited to the
screen dimensions.

The plugin is here:
http://albert.rierol.net/software.html#ImageJ%20plugins:%20miscellaneous

Albert

--
Albert Cardona
http://albert.rierol.net
Reply | Threaded
Open this post in threaded view
|

Re: Auto Scale Image View to 100%

Wayne Rasband
On Mar 4, 2009, at 6:27 AM, Albert Cardona wrote:

> Cochella Chris wrote:
>> Hi All,
>>
>> Is there a way to give imagej a parameter for each image loaded via a  
>> URL so that it loads and scales the image for 100% view?
>>
>>
>> We have images larger than the current window size and would like  
>> them to load so that the complete image is viewable on first load.
>
>
> Hi Chris,
>
> You could run the "Zoom Exact" plugin from my website on each opened  
> image.
> Something like (in javascript):
>
> var imp = IJ.openImage("http://path/to/image.tif");
> imp.show();
> IJ.run(imp, "Zoom Exact", "zoom=100");
>
>
> The Zoom exact plugin lets you set 35, 134, whatever magnification you  
> want, in percent, while keeping the size of the canvas limited to the  
> screen dimensions.
>
> The plugin is here:
> http://albert.rierol.net/ 
> software.html#ImageJ%20plugins:%20miscellaneous

Albert's plugin is built into the ImageJ 1.42k daily build as the  
Image>Zoom>Exact command so you can open an image from a URL at 100%  
using macro code, for example:

    open("http://rsb.info.nih.gov/ij/images/NileBend.jpg");
    run("Exact...", "zoom=100");

Or you can check "Open Images at 100%" in Edit>Options>Appearance and  
all images will open at 100%.

-wayne
Reply | Threaded
Open this post in threaded view
|

Re: Auto Scale Image View to 100%

Cochella Chris
Thank you for the reply.

I am loading images with the applet parameters like:

<applet codebase="."
        code="ij.ImageJApplet.class" archive="./ij-1.42h.jar"
        width=750 height=550
        security=all-permissions>

<param name=url1 value="https://my.site.com/4029.jpg">
<param name=url2 value="https://my.site.com/4030.jpg">
       
</applet>


I would prefer not to output all the javascript code as the above is a  
nice simple solution.

Are there any attributes I can put in the "param" element and/or the  
applet element?


Thanks,
Chris



On Mar 4, 2009, at 11:06 AM, Wayne Rasband wrote:

> On Mar 4, 2009, at 6:27 AM, Albert Cardona wrote:
>
>> Cochella Chris wrote:
>>> Hi All,
>>>
>>> Is there a way to give imagej a parameter for each image loaded  
>>> via a URL so that it loads and scales the image for 100% view?
>>>
>>>
>>> We have images larger than the current window size and would like  
>>> them to load so that the complete image is viewable on first load.
>>
>>
>> Hi Chris,
>>
>> You could run the "Zoom Exact" plugin from my website on each  
>> opened image.
>> Something like (in javascript):
>>
>> var imp = IJ.openImage("http://path/to/image.tif");
>> imp.show();
>> IJ.run(imp, "Zoom Exact", "zoom=100");
>>
>>
>> The Zoom exact plugin lets you set 35, 134, whatever magnification  
>> you want, in percent, while keeping the size of the canvas limited  
>> to the screen dimensions.
>>
>> The plugin is here:
>> http://albert.rierol.net/software.html#ImageJ%20plugins: 
>> %20miscellaneous
>
> Albert's plugin is built into the ImageJ 1.42k daily build as the  
> Image>Zoom>Exact command so you can open an image from a URL at 100%  
> using macro code, for example:
>
>   open("http://rsb.info.nih.gov/ij/images/NileBend.jpg");
>   run("Exact...", "zoom=100");
>
> Or you can check "Open Images at 100%" in Edit>Options>Appearance  
> and all images will open at 100%.
>
> -wayne
Reply | Threaded
Open this post in threaded view
|

Re: Auto Scale Image View to 100%

Albert Cardona
> I would prefer not to output all the javascript code as the above is a
> nice simple solution.
>
> Are there any attributes I can put in the "param" element and/or the
> applet element?


Just put, into the autorun macro, a macro that runs the zooming 100% for
each open image.
I have no idea how that is done for an applet.

Albert

--
Albert Cardona
http://albert.rierol.net
Reply | Threaded
Open this post in threaded view
|

Re: Auto Scale Image View to 100%

Cochella Chris
Alberto,

Thanks.  I am having a hard time getting my head around this.

We are running a web application for expert reviewers of medical  
cases.  Thus, as the reviewer enters a new case we need to close prior  
images and open new images.

My first thought is to run ImageJ as an embedded applet (using ImageJA  
for now).  However, there seems to be a lot more functionality with  
the Java WebStart (looked at the one here http://rsbweb.nih.gov/ij/applets.html)


Does  the "autorun macro" work for the applet or Java Webstart?  Is  
one better than the other?

How would I dynamically open/close/open sets of images as a reviewer  
moves from case to case?


My apologies if I am a bit dense here...


Thanks,
Chris

 >>
Albert's plugin is built into the ImageJ 1.42k daily build as the  
Image>Zoom>Exact command so you can open an image from a URL at 100%  
using macro code, for example:

   open("http://rsb.info.nih.gov/ij/images/NileBend.jpg");
   run("Exact...", "zoom=100");
<<



On Mar 5, 2009, at 8:47 AM, Albert Cardona wrote:

>> I would prefer not to output all the javascript code as the above  
>> is a nice simple solution.
>>
>> Are there any attributes I can put in the "param" element and/or  
>> the applet element?
>
>
> Just put, into the autorun macro, a macro that runs the zooming 100%  
> for each open image.
> I have no idea how that is done for an applet.
>
> Albert
>
> --
> Albert Cardona
> http://albert.rierol.net
Reply | Threaded
Open this post in threaded view
|

Re: Auto Scale Image View to 100%

dscho
Hi,

On Thu, 5 Mar 2009, Cochella Chris wrote:

> My first thought is to run ImageJ as an embedded applet (using ImageJA for
> now).

Since Fri Jul 6 16:08:48 2007 +0100, ImageJA's applet can also interpret
"macro1".."macro9" and other params:
   
    We now interpret these params:
   
    - "url1".."url9" to load images,
    - "macro1".."macro9" to load macros, and
    - "eval1"..""eval9" to execute macro commands

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

Re: Auto Scale Image View to 100%

Albert Cardona
In reply to this post by Cochella Chris
Cochella Chris wrote:

> Alberto,
>
> Thanks.  I am having a hard time getting my head around this.
>
> We are running a web application for expert reviewers of medical
> cases.  Thus, as the reviewer enters a new case we need to close prior
> images and open new images.
>
> My first thought is to run ImageJ as an embedded applet (using ImageJA
> for now).  However, there seems to be a lot more functionality with
> the Java WebStart (looked at the one here
> http://rsbweb.nih.gov/ij/applets.html)
>
>
> Does  the "autorun macro" work for the applet or Java Webstart?  Is
> one better than the other?
>
> How would I dynamically open/close/open sets of images as a reviewer
> moves from case to case?
>
>
> My apologies if I am a bit dense here...


If you are using java web start, then you have it easier.

Make the launcher eval or execute a plugin. That plugin will launch an
ImageListener, than on image opened, does:

public void imageOpened(ImagePlus imp) {
       IJ.run(imp, "Zoom Exact", "zoom=100");
}


But even *way* *easier* than all that, is to set ImageJ property "Open
images at 100%" to true. It's on the Edit - Options - Appearance menu,
and you can set it manually either in the IJ_Props.txt file (it's the
dump of a Properties object), or if you don't get around to it, just
hard-code it in the .java source files.


Albert


PS: My name is Albert, pronunced like in French, not Alberto. I'm
neither Italian nor Spanish-born. I am Catalan.

--
Albert Cardona
http://albert.rierol.net
Reply | Threaded
Open this post in threaded view
|

Re: Auto Scale Image View to 100%

Cochella Chris
Albert,

Thank you.

My apologies for misspelling your name.

A follow-up question:

How would I communicate from a Web browser to close all open images  
then open a new list of images?  The use scenario is a person  
reviewing one list of images, then another list for a given web-start  
session.

Thanks,
Chris




On Mar 5, 2009, at 10:14 AM, Albert Cardona wrote:

> Cochella Chris wrote:
>> Alberto,
>>
>> Thanks.  I am having a hard time getting my head around this.
>>
>> We are running a web application for expert reviewers of medical  
>> cases.  Thus, as the reviewer enters a new case we need to close  
>> prior images and open new images.
>>
>> My first thought is to run ImageJ as an embedded applet (using  
>> ImageJA for now).  However, there seems to be a lot more  
>> functionality with the Java WebStart (looked at the one here http://rsbweb.nih.gov/ij/applets.html)
>>
>>
>> Does  the "autorun macro" work for the applet or Java Webstart?  Is  
>> one better than the other?
>>
>> How would I dynamically open/close/open sets of images as a  
>> reviewer moves from case to case?
>>
>>
>> My apologies if I am a bit dense here...
>
>
> If you are using java web start, then you have it easier.
>
> Make the launcher eval or execute a plugin. That plugin will launch  
> an ImageListener, than on image opened, does:
>
> public void imageOpened(ImagePlus imp) {
>      IJ.run(imp, "Zoom Exact", "zoom=100");
> }
>
>
> But even *way* *easier* than all that, is to set ImageJ property  
> "Open images at 100%" to true. It's on the Edit - Options -  
> Appearance menu, and you can set it manually either in the  
> IJ_Props.txt file (it's the dump of a Properties object), or if you  
> don't get around to it, just hard-code it in the .java source files.
>
>
> Albert
>
>
> PS: My name is Albert, pronunced like in French, not Alberto. I'm  
> neither Italian nor Spanish-born. I am Catalan.
>
> --
> Albert Cardona
> http://albert.rierol.net
Reply | Threaded
Open this post in threaded view
|

Re: Auto Scale Image View to 100%

Wayne Rasband
In reply to this post by Cochella Chris
On Mar 5, 2009, at 11:06 AM, Cochella Chris wrote:

> Alberto,
>
> Thanks.  I am having a hard time getting my head around this.
>
> We are running a web application for expert reviewers of medical
> cases.  Thus, as the reviewer enters a new case we need to close prior
> images and open new images.
>
> My first thought is to run ImageJ as an embedded applet (using ImageJA
> for now).  However, there seems to be a lot more functionality with
> the Java WebStart (looked at the one here
> http://rsbweb.nih.gov/ij/applets.html)
>
>
> Does  the "autorun macro" work for the applet or Java Webstart?  Is
> one better than the other?

Yes, if you add an "AutoRun" macro to StartupMacros.txt. When launched
as an applet, ImageJ looks for StartupMacros.txt in the directory on
the server containing the HTML file with the applet tag. When launched
using Web Start, it looks for StartupMacros.txt in the ImageJ/macros
directory in the users home directory. If not found, it uses the
default version in the macros directory of ij.jar.

> How would I dynamically open/close/open sets of images as a reviewer
> moves from case to case?

This is a programming problem. ImageJ can be customized by writing
plugins, macros of scripts. With applets, custom plugins have to be
added to ij.jar and commands to launch them added to the IJ_Props.txt
file in ij.jar. There is a link at
<http://rsb.info.nih.gov/ij/applet2/> to an applet version of ImageJ
with custom plugins.

-wayne

>
>
> My apologies if I am a bit dense here...
>
>
> Thanks,
> Chris
>
> >>
> Albert's plugin is built into the ImageJ 1.42k daily build as the
> Image>Zoom>Exact command so you can open an image from a URL at 100%
> using macro code, for example:
>
>   open("http://rsb.info.nih.gov/ij/images/NileBend.jpg");
>   run("Exact...", "zoom=100");
> <<
>
>
>
> On Mar 5, 2009, at 8:47 AM, Albert Cardona wrote:
>
>>> I would prefer not to output all the javascript code as the above is
>>> a nice simple solution.
>>>
>>> Are there any attributes I can put in the "param" element and/or the
>>> applet element?
>>
>>
>> Just put, into the autorun macro, a macro that runs the zooming 100%
>> for each open image.
>> I have no idea how that is done for an applet.
>>
>> Albert
>>
>> --
>> Albert Cardona
>> http://albert.rierol.net
>
Reply | Threaded
Open this post in threaded view
|

Re: Auto Scale Image View to 100%

Cochella Chris
Wayne,

Thank you for the reply.

 From what you said it sounds like there is not an easy way to  
relaunch web start with a different set of images each time where the  
image list is known only on the server.

Our usage is expert reviewers providing feedback on a variety of  
medical cases.  They log in to a website, pick the case, launch Image  
J with the images from that case.  Then they do it again.  So there is  
no way to put the image list on the user's computer.  Instead the  
image URL's would need to be dynamically sent to ImageJ webstart.  I  
have this working with the applet by specifying parameters in the HTML  
applet tag.  However, I would love to accomplish the same with Web  
Start as it seems to run better and give the user more control.

Any thoughts on how to dynamically launch Web start with a different  
set of images each time?  Is this a plugin?

Thanks,
Chris





On Mar 5, 2009, at 11:14 AM, Wayne Rasband wrote:

> On Mar 5, 2009, at 11:06 AM, Cochella Chris wrote:
>
>> Alberto,
>>
>> Thanks.  I am having a hard time getting my head around this.
>>
>> We are running a web application for expert reviewers of medical  
>> cases.  Thus, as the reviewer enters a new case we need to close  
>> prior images and open new images.
>>
>> My first thought is to run ImageJ as an embedded applet (using  
>> ImageJA for now).  However, there seems to be a lot more  
>> functionality with the Java WebStart (looked at the one here http://rsbweb.nih.gov/ij/applets.html)
>>
>>
>> Does  the "autorun macro" work for the applet or Java Webstart?  Is  
>> one better than the other?
>
> Yes, if you add an "AutoRun" macro to StartupMacros.txt. When  
> launched as an applet, ImageJ looks for StartupMacros.txt in the  
> directory on the server containing the HTML file with the applet  
> tag. When launched using Web Start, it looks for StartupMacros.txt  
> in the ImageJ/macros directory in the users home directory. If not  
> found, it uses the default version in the macros directory of ij.jar.
>
>> How would I dynamically open/close/open sets of images as a  
>> reviewer moves from case to case?
>
> This is a programming problem. ImageJ can be customized by writing  
> plugins, macros of scripts. With applets, custom plugins have to be  
> added to ij.jar and commands to launch them added to the  
> IJ_Props.txt file in ij.jar. There is a link at <http://rsb.info.nih.gov/ij/applet2/ 
> > to an applet version of ImageJ with custom plugins.
>
> -wayne
>
>>
>>
>> My apologies if I am a bit dense here...
>>
>>
>> Thanks,
>> Chris
>>
>> >>
>> Albert's plugin is built into the ImageJ 1.42k daily build as the  
>> Image>Zoom>Exact command so you can open an image from a URL at  
>> 100% using macro code, for example:
>>
>>  open("http://rsb.info.nih.gov/ij/images/NileBend.jpg");
>>  run("Exact...", "zoom=100");
>> <<
>>
>>
>>
>> On Mar 5, 2009, at 8:47 AM, Albert Cardona wrote:
>>
>>>> I would prefer not to output all the javascript code as the above  
>>>> is a nice simple solution.
>>>>
>>>> Are there any attributes I can put in the "param" element and/or  
>>>> the applet element?
>>>
>>>
>>> Just put, into the autorun macro, a macro that runs the zooming  
>>> 100% for each open image.
>>> I have no idea how that is done for an applet.
>>>
>>> Albert
>>>
>>> --
>>> Albert Cardona
>>> http://albert.rierol.net
>>