How to NOT open windows above each other

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

How to NOT open windows above each other

Burni
This post was updated on .
Greetings,

I'm working on a program in Beanshell.
At one point, I'm opening a number of plot profiles which I then fit.
So if I for example generate 5 plot profiles and fit each one, I'll have 10 windows, which all open on top of each other.
Is there a way to open windows so that they occupy an 'unused' part of the screen?
I already found something that might help a little. With the setNextLocation()-function I can specify the location of the next opened window. But I would have to specify the position of every single window. Is there an automated function for what I have in mind?

Burni
Reply | Threaded
Open this post in threaded view
|

Re: How to NOT open windows above each other

Rasband, Wayne (NIH/NIMH) [E]
On Apr 9, 2014, at 5:49 AM, Burni wrote:

> Greetings,
>
> I'm working on a program in Beanshell.
> At one point, I'm opening a number of plot profiles which I then fit.
> So if I for example generate 5 plot profiles and fit each one, I'll have 10
> windows, which all open on top of each other.
> Is there a way to open windows so that they occupy an 'unused' part of the
> screen?
> I already found something that might help a little. With the
> setLocationAndSize()-function I can specify the location of the next opened
> window. But I would have to specify the position of every single window. Is
> there an automated function for what I have in mind?

You get get the profile data without displaying a plot window. For example, this JavaScript prints the mean, min and max value of the pixels along the current line selection:

  imp = IJ.getImage();
  pp = new ProfilePlot(imp);
  profile = pp.getProfile();
  ip = new FloatProcessor(profile.length,1,profile);
  stats = ip.getStatistics();
  print(stats);

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: How to NOT open windows above each other

Burni
Hi Wayne,

I specifically want the plot profiles and the fits to be shown.
I just don't want to arrange them each time I run my program.

Burni
Reply | Threaded
Open this post in threaded view
|

Re: How to NOT open windows above each other

Rasband, Wayne (NIH/NIMH) [E]
On Apr 9, 2014, at 1:29 PM, Burni wrote:

> Hi Wayne,
>
> I specifically want the plot profiles and the fits to be shown.
> I just don't want to arrange them each time I run my program.

PlotWindows are ImageWindows so you can use the ImageWindow.setNextLocation() method to specify the location where the next plot will be opened. You will need to upgrade to the latest ImageJ daily build (1.48y22), which fixes a bug that prevents setNextLocation() from working with windows normally centered on the screen. Here is a JavaScript example:

  imp = IJ.openImage("http://imagej.nih.gov/ij/images/blobs.gif");
  imp.setRoi(new Line(46, 128, 161, 68));
  x=10; y=100;
  ImageWindow.setNextLocation(x, y);
  IJ.run(imp, "Plot Profile", "");
  win = IJ.getImage().getWindow();
  bounds = win.getBounds();
  x += bounds.width + 10;
  ImageWindow.setNextLocation(x, y);
  imp.setRoi(new Line(47, 147, 82, 144));
  IJ.run(imp, "Plot Profile", "");

And here is a macro version:

  requires("1.48u");
  run("Blobs (25K)");
  id = getImageID;
  x=10; y=100;
  makeLine(46, 128, 161, 68);
  call("ij.gui.ImageWindow.setNextLocation", x, y);
  run("Plot Profile");
  getLocationAndSize(x, y, width, height);
  selectImage(id);
  makeLine(47, 147, 82, 144);
  x += width + 10;
  call("ij.gui.ImageWindow.setNextLocation", x, y);
  run("Plot Profile");


> --
> View this message in context: http://imagej.1557.x6.nabble.com/How-to-NOT-open-windows-above-each-other-tp5007253p5007264.html
> Sent from the ImageJ mailing list archive at Nabble.com.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: How to NOT open windows above each other

Burni
The problem is, that the number of windows opened is variable, so there might be many depending on what I want to do. A built-in automatic function would have made it much easier.
But thanks for your response, I'll be trying your suggestion.

Burni.