Is it possible to re-arrange the image order window menu?

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

Is it possible to re-arrange the image order window menu?

Stein Rørvik
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: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Is it possible to re-arrange the image order window menu?

Norbert Vischer
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: http://imagej.nih.gov/ij/list.html
>

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

Re: Is it possible to re-arrange the image order window menu?

Stein Rørvik
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&amp;data=04%7C01%7Cstein.rorvik%40sintef.no
> %7C8afee8aa65734c8f50ae08d8fffcb9fb%7Ce1f00f39604145b0b309e0210d8b32af
> %7C1%7C1%7C637540808209935944%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAw
> MDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=mx
> F3NRrFz0tUYLm3oj%2F4biD%2BwCckEeXAXYBBZDWitwA%3D&amp;reserved=0
>

--
ImageJ mailing list: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimagej.nih.gov%2Fij%2Flist.html&amp;data=04%7C01%7Cstein.rorvik%40sintef.no%7C8afee8aa65734c8f50ae08d8fffcb9fb%7Ce1f00f39604145b0b309e0210d8b32af%7C1%7C1%7C637540808209935944%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=mxF3NRrFz0tUYLm3oj%2F4biD%2BwCckEeXAXYBBZDWitwA%3D&amp;reserved=0

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

Re: Is it possible to re-arrange the image order window menu?

CARL Philippe (LBP)
In reply to this post by Norbert Vischer
Dear Norbert and Stein,
Alternatively to use the setBatchMode("hide") / setBatchMode("show") methods, you could alternatively use the Stack.swap macro method:
https://imagej.nih.gov/ij/developer/macro/functions.html#Stack.swap
thus giving you the following code:

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

run("Images to Stack", "name=Stack title=[] use");
Stack.swap(1, 3);
run("Stack to Images");
//Windows sequence is C B A

My best regards,
Philippe

Philippe CARL
Laboratoire de Bioimagerie et Pathologies
UMR 7021 CNRS - Université de Strasbourg
Faculté de Pharmacie
74 route du Rhin
67401 ILLKIRCH
Tel : +33(0)3 68 85 42 89

----- Mail original -----
De: "Norbert Vischer" <[hidden email]>
À: "imagej" <[hidden email]>
Envoyé: Jeudi 15 Avril 2021 12:42:10
Objet: 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: 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
Reply | Threaded
Open this post in threaded view
|

Re: Is it possible to re-arrange the image order window menu?

Stein Rørvik
My images are of different sizes, so "Images to Stack" will not work well.

-----Original Message-----
Sent: 15. april 2021 15:51
Subject: Re: Is it possible to re-arrange the image order window menu?

Dear Norbert and Stein,
Alternatively to use the setBatchMode("hide") / setBatchMode("show") methods, you could alternatively use the Stack.swap macro method:
https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fimagej.nih.gov%2Fij%2Fdeveloper%2Fmacro%2Ffunctions.html%23Stack.swap&amp;data=04%7C01%7Cstein.rorvik%40sintef.no%7C3b0360aa5b8c4758066608d90015d0e2%7Ce1f00f39604145b0b309e0210d8b32af%7C1%7C0%7C637540915970611001%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=IbtVB5LrbKYmair7aYMDpEcDVgQ9jVxsW3mqkVGqbQc%3D&amp;reserved=0
thus giving you the following code:

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

run("Images to Stack", "name=Stack title=[] use"); Stack.swap(1, 3); run("Stack to Images"); //Windows sequence is C B A

My best regards,
Philippe

Philippe CARL
Laboratoire de Bioimagerie et Pathologies UMR 7021 CNRS - Université de Strasbourg Faculté de Pharmacie
74 route du Rhin
67401 ILLKIRCH
Tel : +33(0)3 68 85 42 89

----- Mail original -----
De: "Norbert Vischer" <[hidden email]>
À: "imagej" <[hidden email]>
Envoyé: Jeudi 15 Avril 2021 12:42:10
Objet: 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&amp;data=04%7C01%7Cstein.rorvik%40sintef.no
> %7C3b0360aa5b8c4758066608d90015d0e2%7Ce1f00f39604145b0b309e0210d8b32af
> %7C1%7C0%7C637540915970611001%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAw
> MDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=W8
> 52UJPrG3Ku5wPL2FI%2B%2FNt9nHB3t3G1XS9MMNE40Hk%3D&amp;reserved=0
>

--
ImageJ mailing list: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimagej.nih.gov%2Fij%2Flist.html&amp;data=04%7C01%7Cstein.rorvik%40sintef.no%7C3b0360aa5b8c4758066608d90015d0e2%7Ce1f00f39604145b0b309e0210d8b32af%7C1%7C0%7C637540915970611001%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=W852UJPrG3Ku5wPL2FI%2B%2FNt9nHB3t3G1XS9MMNE40Hk%3D&amp;reserved=0

--
ImageJ mailing list: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimagej.nih.gov%2Fij%2Flist.html&amp;data=04%7C01%7Cstein.rorvik%40sintef.no%7C3b0360aa5b8c4758066608d90015d0e2%7Ce1f00f39604145b0b309e0210d8b32af%7C1%7C0%7C637540915970611001%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=W852UJPrG3Ku5wPL2FI%2B%2FNt9nHB3t3G1XS9MMNE40Hk%3D&amp;reserved=0

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

Re: Is it possible to re-arrange the image order window menu?

Fred Damen
In reply to this post by Stein Rørvik
Greetings,

Create the stack anyhow...
Image>Stacks>Tools>Make Substack...
Specify a comma separate ordered list of slices / frames you want in the
stack...

Fred

On Thu, April 15, 2021 5:25 am, Stein Rørvik 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: http://imagej.nih.gov/ij/list.html
>

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

Re: Is it possible to re-arrange the image order window menu?

Stein Rørvik
The image windows I want to re-arrange are different both in their size, number of slices, number of channels, datatype and LUT, so going via a stack to rearrange the order of such dissimilar windows is not practical at all. Sorry for not mentioning this in my first post.

Norbert's suggestion of hiding the windows in batchmode and then showing them again to make them appear at the end of the window list works fine for me.

Stein

-----Original Message-----
Sent: 15. april 2021 18:30
Subject: Re: Is it possible to re-arrange the image order window menu?

Greetings,

Create the stack anyhow...
Image>Stacks>Tools>Make Substack...
Specify a comma separate ordered list of slices / frames you want in the stack...

Fred

On Thu, April 15, 2021 5:25 am, Stein Rørvik 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&amp;data=04%7C01%7Cstein.rorvik%40sintef.no
> %7C093b8833be624c4879be08d9002bf94d%7Ce1f00f39604145b0b309e0210d8b32af
> %7C1%7C0%7C637541011150825628%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAw
> MDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=hw
> 1LMPiP6TiVOHU8hnhXzbosjNYQ7bc6A7lchw8qZEA%3D&amp;reserved=0
>

--
ImageJ mailing list: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimagej.nih.gov%2Fij%2Flist.html&amp;data=04%7C01%7Cstein.rorvik%40sintef.no%7C093b8833be624c4879be08d9002bf94d%7Ce1f00f39604145b0b309e0210d8b32af%7C1%7C0%7C637541011150825628%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=hw1LMPiP6TiVOHU8hnhXzbosjNYQ7bc6A7lchw8qZEA%3D&amp;reserved=0

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