Login  Register

Re: Close all but active window

Posted by Olivier Burri on Aug 14, 2015; 9:01am
URL: http://imagej.273.s1.nabble.com/Close-all-but-active-window-tp5014024p5014030.html

Hi,

Use
selectImage(image of interest):
close("\\Others");

Best

Oli

On 14 Aug 2015 6:51 am, Volko Straub <[hidden email]> wrote:
Here is a macro that closes all images apart from the image that is
currently at the front/active. There may be a more elegant way of doing
this, but it works for me.
Hope this helps,
Volko

currentImageID=getImageID();           //get image ID for current image
totalOpenImages=nImages;                //get total number of open images
imageIDs=newArray(nImages);          //create array to hold all image IDs
for(i=0;i<nImages;i++){                        //and populate array with
image IDs
     selectImage(i+1);
     imageIDs[i]=getImageID();
};

for(i=0;i<totalOpenImages;i++){           //run through array of image IDs
     if(imageIDs[i]!=currentImageID){     //and check whether it matches
current image
         selectImage(imageIDs[i]);             //if it doesn't match,
select image and close it
         close();
     };
};

On 14/08/2015 02:19, jswalker wrote:

> Hi all,
>
> Simple problem that probably has a simple fix. Any help would be
> appreciated--
>
> During the course of my image analysis I have the image I opened (A1
> DAPI.jpg, for example), the same image converted to mask (A1 DAPI-1.jpg),
> and then the same image reverted with maxima stuck onto it (A1 DAPI-1.jpg
> Maxima).
>
> There comes a critical point where I need to have ImageJ (well, Fiji) close
> all but the Maxima image. How do I do this?
>
> Is there a closeAllButActive function that I am not aware of?
> Failing that, is there a way to tell the macro to close any/all images that
> /don't/ have the word "Maxima" in the image title?
>
> I would rather not close any open ROI or Results windows if I can help it.
>
> Thanks, IJ wizards.
>
>
>
> --
> View this message in context: http://imagej.1557.x6.nabble.com/Close-all-but-active-window-tp5014024.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

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

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