Posted by
Emilio Miguelanez Martin on
Mar 09, 2008; 10:37am
URL: http://imagej.273.s1.nabble.com/Re-Displaying-raw-image-and-annotated-ROI-tp3696963p3696966.html
Albert,
Thanks for your valuable input. Your suggestion fits even better, considering that the images were opening from a plugin, and I didn't know how to set the location of the image window.
Cheers,
Emilio
-----Original Message-----
From: ImageJ Interest Group on behalf of Albert Cardona
Sent: Fri 3/7/2008 8:23 PM
To:
[hidden email]
Subject: Re: Placing image on the screen
Hi Emilio,
You can customize ImageJ to do it for you.
What you need:
- a plugin that implements an ImageListener
- a macro that launches the plugin at startup
The macro: edit macros/StartupMacros.txt, add the following
(or set into an existing AutoRun macro, if any):
macro "AutoRun" {
run("ImageWindow_Position");
}
The plugin, in its simplest form:
(just place into ImageJ plugins folder or subfolder, and call
"Compile and run" on it - then restart ImageJ)
(Be sure to copy this into a file named ImageWindow_Position.java )
import ij.*;
import ij.plugin.PlugIn;
import java.awt.*;
public class ImageWindow_Position implements PlugIn, ImageListener {
public void run(String arg) {
ImagePlus.addImageListener(this);
}
public void imageOpened(ImagePlus imp) {
ImageWindow win = imp.getWindow();
if (null == win) return;
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
Rectangle box = win.getBounds();
win.setLocation(screen.width - box.width,
(screen.height - box.height) / 2);
}
public void imageUpdated(ImagePlus imp) {}
public void imageClosed(ImagePlus imp) {}
}
--
Albert Cardona
http://www.mcdb.ucla.edu/Research/Hartenstein/acardona