Move active window to back

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

Move active window to back

PEARSON Matthew
Hi all,

In a macro, if I have a number of images open, how can i move the active image to the back?  I would use this to analyse open images in turn instead of analysing a whole directory.

Thanks for the help,

Matt





--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

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

Re: Move active window to back

Peterbauer Thomas
On 2015-03-15 19:45, Matt Pearson wrote:
> In a macro, if I have a number of images open, how can i move the active image to the back?

run("Put Behind [tab]");

More specific handling of image windows is possible. Each open image has
a unique identifier (a negative number), which you can retrieve from the
active image with:

id = getImageID();

To get an array with all IDs, you can loop over the open images:

imageIDs=newArray(nImages);
for (i=1; i<=nImages; i++) {
     selectImage(i); //positive number activates the i-th image
     imageIDs[i-1]=getImageID(); //array starts with index 0
}

for (i=0; i<imageIDs.length; i++) {
     print(imageIDs[i]);
}

With the stored IDs, you can later use the following commands:

selectImage(id);
isActive(id);
isOpen(id);

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

Re: Move active window to back

PEARSON Matthew
Hi Peter,

Thanks for your comments.  I did try put behind tab but this didn't work as I expected.  The macro comes back to an image its already analysed before it completes the others.  I'm running the macro in batch mode and this could be causing complications.  I'm familiar with imageID's and use them often, but i'll have to think a lot more carefully about how that will work in the context of this macro.  I'd actually completely forgotten you could count the number of open images with nImages, so that will be useful!

Thanks,

Matt







On 15 Mar 2015, at 19:42, Thomas Peterbauer <[hidden email]> wrote:

> On 2015-03-15 19:45, Matt Pearson wrote:
>> In a macro, if I have a number of images open, how can i move the active image to the back?
>
> run("Put Behind [tab]");
>
> More specific handling of image windows is possible. Each open image has a unique identifier (a negative number), which you can retrieve from the active image with:
>
> id = getImageID();
>
> To get an array with all IDs, you can loop over the open images:
>
> imageIDs=newArray(nImages);
> for (i=1; i<=nImages; i++) {
>    selectImage(i); //positive number activates the i-th image
>    imageIDs[i-1]=getImageID(); //array starts with index 0
> }
>
> for (i=0; i<imageIDs.length; i++) {
>    print(imageIDs[i]);
> }
>
> With the stored IDs, you can later use the following commands:
>
> selectImage(id);
> isActive(id);
> isOpen(id);
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>


--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

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

Re: Move active window to back

Peterbauer Thomas
On 2015-03-15 22:05, Matt Pearson wrote:
> The macro comes back to an image its already analysed before it completes the others.

Two suggestions:

a) just close an image once you are done with it:

run("Close");

It cannot interfere with the rest of the macro. If you need to/want to
leave all the images open:

b) use the loop I mentioned in my first reply to get an array with image
IDs as the first step. For processing, loop over this array, selecting
one image after the other by ID in each cycle of the loop. There cannot
be any confusion of the images, even if your code generates new images
during processing.

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

Re: Move active window to back

PEARSON Matthew
In reply to this post by PEARSON Matthew
I will incorporate this into the macro and see how it goes.

Thanks

-------- Original message --------
From: Thomas Peterbauer <[hidden email]>
Date:15/03/2015  22:22  (GMT+00:00)
To: [hidden email]
Subject: Re: Move active window to back

On 2015-03-15 22:05, Matt Pearson wrote:
> The macro comes back to an image its already analysed before it completes the others.

Two suggestions:

a) just close an image once you are done with it:

run("Close");

It cannot interfere with the rest of the macro. If you need to/want to
leave all the images open:

b) use the loop I mentioned in my first reply to get an array with image
IDs as the first step. For processing, loop over this array, selecting
one image after the other by ID in each cycle of the loop. There cannot
be any confusion of the images, even if your code generates new images
during processing.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html



--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html