Posted by
Stein Rørvik on
URL: http://imagej.273.s1.nabble.com/Is-it-possible-to-re-arrange-the-image-order-window-menu-tp5024609p5024611.html
Thanks Norbert,
this works perfectly!
Inspired by your approach I wrote the below macro, which will move any image matching a pattern to the end of the window list:
arrImages = getList("image.titles");
MoveImagesToEndOfWindowList("Min.*");
MoveImagesToEndOfWindowList("Max.*");
MoveImagesToEndOfWindowList("Std.*");
MoveImagesToEndOfWindowList("Ave.*");
arrImagesReordered = getList("image.titles");
Array.show(arrImages,arrImagesReordered);
function MoveImagesToEndOfWindowList(strMatch) {
//hide images matching strMatch
for(i = 0; i < arrImages.length; i++)
if (matches(arrImages[i], strMatch)) {
selectImage(arrImages[i]);
setBatchMode("hide");
}
//show images matching strMatch
for(i = 0; i < arrImages.length; i++)
if (matches(arrImages[i], strMatch)) {
selectImage(arrImages[i]);
setBatchMode("show");
}
}
This solves what I wanted to do: To rearrange a group of Z projections named Min.. Max.. Ave.. Std.. Min.. Max.. Ave.. Std.. Min.. Max.. Ave.. Std.. as Min.. Min.. Min.. Max.. Max.. Max.. Std.. Std.. Std.. Ave.. Ave.. Ave..
Stein
-----Original Message-----
Sent: 15. april 2021 12:42
Subject: Re: Is it possible to re-arrange the image order window menu?
Hi Stein,
below is an example using setBatchMode.
Best regards, Norbert
close("*");
newImage("A", "8-bit ramp", 600, 300, 1); newImage("B", "8-bit ramp", 600, 300, 1); newImage("C", "8-bit ramp", 600, 300, 1);
waitForUser; //Windows sequence is A B C
selectImage("A");
setBatchMode("hide");
selectImage("B");
setBatchMode("hide");
selectImage("C");
setBatchMode("hide");
selectImage("C");
setBatchMode("show");
selectImage("B");
setBatchMode("show");
selectImage("A");
setBatchMode("show");
//Windows sequence is C B A
>
>
>
> On 15. Apr 2021, at 12:25, Stein Rørvik <
[hidden email]> wrote:
>
> I want to swap the order of some images as they appear in the image window menu, to make them arrange in the desired order when tiling them.
>
> Is it technically possible to swap the order the images appear in? If yes, do someone have an example?
> I assume a JavaScript would be needed for this.
>
> Stein
>
> --
> ImageJ mailing list:
>
https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimage> j.nih.gov%2Fij%2Flist.html&data=04%7C01%7Cstein.rorvik%40sintef.no
> %7C8afee8aa65734c8f50ae08d8fffcb9fb%7Ce1f00f39604145b0b309e0210d8b32af
> %7C1%7C1%7C637540808209935944%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAw
> MDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=mx
> F3NRrFz0tUYLm3oj%2F4biD%2BwCckEeXAXYBBZDWitwA%3D&reserved=0
>
--
ImageJ mailing list:
https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimagej.nih.gov%2Fij%2Flist.html&data=04%7C01%7Cstein.rorvik%40sintef.no%7C8afee8aa65734c8f50ae08d8fffcb9fb%7Ce1f00f39604145b0b309e0210d8b32af%7C1%7C1%7C637540808209935944%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=mxF3NRrFz0tUYLm3oj%2F4biD%2BwCckEeXAXYBBZDWitwA%3D&reserved=0--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html