Login  Register

Re: Close all but active window

Posted by Rasband, Wayne (NIH/NIMH) [E] on Aug 14, 2015; 10:44pm
URL: http://imagej.273.s1.nabble.com/Close-all-but-active-window-tp5014024p5014037.html

> On Aug 14, 2015, at 11:04 AM, Michael Elbaum <[hidden email]> wrote:
>
> Is it possible to do this from the gui as well, not in a macro? Often that would be useful too.

You can create a menu command that runs a macro by saving the macro in the plugins folder, or an immediate sub-folder, using a file name that contains at least one underscore or ends in “.ijm”. To create a “Close Others” command, save a file that contains the line

    close("\\Others”);

in the plugins folder as “Close_Others.ijm” and run the Help>Refresh Menus command. Use the Plugins>Shortcuts>Add Shortcut (previously “Create Shortcut”) command to create a keyboard shortcut for the new command.

-wayne


> On 14 באוג׳ 2015, at 05:06, Burri Olivier <[hidden email]> wrote:
>>
>> 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.

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