Bugs in the Window menu

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

Bugs in the Window menu

Stein Rørvik
There has for a long time been a bug in the Window menu that sometimes causes the wrong image to be selected when selecting an image name from the dropdown, but I have not been able to reproduce it earlier as it depends on the order of window opening and closing. But today I found a simple way to reproduce the issue:

dir = "C:/Users/steinr/Temp/t1-head/";
run("Close All");
run("Image Sequence...", "open=&dir sort");
rename("t1-head");
run("Image Sequence...", "open=&dir sort");
rename("t2-head");
run("Image Sequence...", "open=&dir sort");
rename("t3-head");
run("Image Sequence...", "open=&dir sort");
rename("t4-head");

Selecting the first image on the list selects the first window, but the window title entries in the Window menu is in the wrong order; "t1-head" is at the bottom of the list.

This bug has been there for a couple of years; I reverted to earlier versions and found that this was working in 1.52e and fails in 1.52f.

Another bug is that if a plugin should happen to install an entry to the Window menu, the plugin entry appears as expected before the list of open images, but the image titles in the menu do not match the corresponding image window. Probably the building of the window menu list forgets to take into account the possibility of extra menu entries already there. This bug does not occur in Fiji.

Stein

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

Re: Bugs in the Window menu

Michael Schmid
Hi Stein,

concerning the first issue, the unexpected ordering of the images in the
Window menu, it might be a race condition. On my Linux machine, the
Window menu has t1-head at the top and t4-head at the bottom.
I tried with many images (387) as well as with few images (3) in the
input directory.

Could you please have a look at the imageIDs? Images added later should
have a more negative ImageID (you can see it with Image>Show Info, there
is a line starting with "ID".
Usually, each new image gets the most negative ID so far minus 1.
In the current case, opening an image sequence creates a temporary image
for each file opened (as many as there are images in the directory), so
the spacing between the IDs will be more than one.


I did not try to reproduce the 2nd bug, installing a Plugin in the
Windows menu.
I noticed, however, that "Help>Refresh Menus" erases the list of images
in the Window menu (and after "Help>Refresh Menus" and opening new
images, images that are closed sometimes don't disappear from the Window
menu). So it would make sense to add some method that rebuilds the list
of Windows (probably sorted by the ImageIDs), and call this method not
only with "Help>Refresh Menus" but also if a plugin is installed.


Michael
________________________________________________________________
On 22.10.20 20:39, Stein Rørvik wrote:

> There has for a long time been a bug in the Window menu that sometimes causes the wrong image to be selected when selecting an image name from the dropdown, but I have not been able to reproduce it earlier as it depends on the order of window opening and closing. But today I found a simple way to reproduce the issue:
>
> dir = "C:/Users/steinr/Temp/t1-head/";
> run("Close All");
> run("Image Sequence...", "open=&dir sort");
> rename("t1-head");
> run("Image Sequence...", "open=&dir sort");
> rename("t2-head");
> run("Image Sequence...", "open=&dir sort");
> rename("t3-head");
> run("Image Sequence...", "open=&dir sort");
> rename("t4-head");
>
> Selecting the first image on the list selects the first window, but the window title entries in the Window menu is in the wrong order; "t1-head" is at the bottom of the list.
>
> This bug has been there for a couple of years; I reverted to earlier versions and found that this was working in 1.52e and fails in 1.52f.
>
> Another bug is that if a plugin should happen to install an entry to the Window menu, the plugin entry appears as expected before the list of open images, but the image titles in the menu do not match the corresponding image window. Probably the building of the window menu list forgets to take into account the possibility of extra menu entries already there. This bug does not occur in Fiji.
>
> 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: Bugs in the Window menu

Stein Rørvik
The imageIDs are in the correct order of more negative numbers. I don't think this is connected to imageIDs, as selecting the second entry of the menu selects the secondly opened file. It is the shown names in the menu that are incorrect.

I found out after posting this that the problem is connected to the line rename("t1-head");
If we write rename("t0-head"); instead, the menu ordering is correct. If we rename one of the later windows in the macro to "t1-head" instead, that window name is put at the bottom of the menu and the order is wrong again.

"t1-head" is the default window name of that file. Perhaps ImageJ gets confused when we rename from and to the same name?

Stein

-----Original Message-----
From: ImageJ Interest Group <[hidden email]> On Behalf Of Michael Schmid
Sent: 22. oktober 2020 22:09
To: [hidden email]
Subject: Re: Bugs in the Window menu

Hi Stein,

concerning the first issue, the unexpected ordering of the images in the Window menu, it might be a race condition. On my Linux machine, the Window menu has t1-head at the top and t4-head at the bottom.
I tried with many images (387) as well as with few images (3) in the input directory.

Could you please have a look at the imageIDs? Images added later should have a more negative ImageID (you can see it with Image>Show Info, there is a line starting with "ID".
Usually, each new image gets the most negative ID so far minus 1.
In the current case, opening an image sequence creates a temporary image for each file opened (as many as there are images in the directory), so the spacing between the IDs will be more than one.


I did not try to reproduce the 2nd bug, installing a Plugin in the Windows menu.
I noticed, however, that "Help>Refresh Menus" erases the list of images in the Window menu (and after "Help>Refresh Menus" and opening new images, images that are closed sometimes don't disappear from the Window menu). So it would make sense to add some method that rebuilds the list of Windows (probably sorted by the ImageIDs), and call this method not only with "Help>Refresh Menus" but also if a plugin is installed.


Michael
________________________________________________________________
On 22.10.20 20:39, Stein Rørvik wrote:

> There has for a long time been a bug in the Window menu that sometimes causes the wrong image to be selected when selecting an image name from the dropdown, but I have not been able to reproduce it earlier as it depends on the order of window opening and closing. But today I found a simple way to reproduce the issue:
>
> dir = "C:/Users/steinr/Temp/t1-head/"; run("Close All"); run("Image
> Sequence...", "open=&dir sort"); rename("t1-head"); run("Image
> Sequence...", "open=&dir sort"); rename("t2-head"); run("Image
> Sequence...", "open=&dir sort"); rename("t3-head"); run("Image
> Sequence...", "open=&dir sort"); rename("t4-head");
>
> Selecting the first image on the list selects the first window, but the window title entries in the Window menu is in the wrong order; "t1-head" is at the bottom of the list.
>
> This bug has been there for a couple of years; I reverted to earlier versions and found that this was working in 1.52e and fails in 1.52f.
>
> Another bug is that if a plugin should happen to install an entry to the Window menu, the plugin entry appears as expected before the list of open images, but the image titles in the menu do not match the corresponding image window. Probably the building of the window menu list forgets to take into account the possibility of extra menu entries already there. This bug does not occur in Fiji.
>
> 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
> %7C1c5348cdba4d4568ad8908d876c74bf7%7Ce1f00f39604145b0b309e0210d8b32af
> %7C1%7C0%7C637389945644480449%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAw
> MDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=nO
> m7Y716uVEIWy0olzckaWhPZL1lqijTOMHSZGAPzdE%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%7C1c5348cdba4d4568ad8908d876c74bf7%7Ce1f00f39604145b0b309e0210d8b32af%7C1%7C0%7C637389945644480449%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=nOm7Y716uVEIWy0olzckaWhPZL1lqijTOMHSZGAPzdE%3D&amp;reserved=0

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

Re: Bugs in the Window menu

Wayne Rasband-2
In reply to this post by Stein Rørvik
> On Oct 22, 2020, at 2:39 PM, Stein Rørvik <[hidden email]> wrote:
>
> There has for a long time been a bug in the Window menu that sometimes causes the wrong image to be selected when selecting an image name from the dropdown, but I have not been able to reproduce it earlier as it depends on the order of window opening and closing. But today I found a simple way to reproduce the issue:

I ran this test macro on MacOS and Windows and was not able to reproduce the problem. The images were always listed in the Window menu  in the expected order.

-wayne

>
> dir = "C:/Users/steinr/Temp/t1-head/";
> run("Close All");
> run("Image Sequence...", "open=&dir sort");
> rename("t1-head");
> run("Image Sequence...", "open=&dir sort");
> rename("t2-head");
> run("Image Sequence...", "open=&dir sort");
> rename("t3-head");
> run("Image Sequence...", "open=&dir sort");
> rename("t4-head");
>
> Selecting the first image on the list selects the first window, but the window title entries in the Window menu is in the wrong order; "t1-head" is at the bottom of the list.
>
> This bug has been there for a couple of years; I reverted to earlier versions and found that this was working in 1.52e and fails in 1.52f.
>
> Another bug is that if a plugin should happen to install an entry to the Window menu, the plugin entry appears as expected before the list of open images, but the image titles in the menu do not match the corresponding image window. Probably the building of the window menu list forgets to take into account the possibility of extra menu entries already there. This bug does not occur in Fiji.
>
> 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: Bugs in the Window menu

Stein Rørvik
Strange that you can't reproduce it; I see the same behaviour on different PC's, different Java versions and different ImageJ versions as long as they are newer than 1.52e.

First, notice that this example only fails if the folder name is also "t1-head", as that will set the default name of the window when opened. If we rename the folder to "t0-head" the macro will not fail.

Here is a more complete macro, which also creates the folder to be opened:

run("Close All");
run("T1 Head (16-bits)");
dir = getDirectory("Temp");
dir += "t1-head/";
if (!File.isDirectory(dir)) File.makeDirectory(dir);
print(dir);
run("Image Sequence... ", "dir=[&dir] format=TIFF");

run("Close All");
run("Image Sequence...", "open=&dir sort");
rename("t1-head");
run("Image Sequence...", "open=&dir sort");
rename("t2-head");
run("Image Sequence...", "open=&dir sort");
rename("t3-head");
run("Image Sequence...", "open=&dir sort");
rename("t4-head");

I tried to use the debugger, and this reveals where the problem lies.
See the attached screenshots if you still can't reproduce it.

After we have imported the folder the first time, the first window is named "t1-head" as expected. When the folder is opened for the second time, the name of the new window is also "t1-head" since that is the name of the folder. So we now have two windows named "t1-head", and two menu entries "t1-head". The second rename correctly renames the second window to "t2-head", but the FIRST window menu entry named "t1-head" is changed instead of the second one. So now the names in the window menu entries no longer match the names of the windows. Then opening the folder for  the third time, the same repeats. We get a second window named "t1-head", and the wrong window menu entry is renamed, so the "t1-head" entry pops down.

Stein

-----Original Message-----
Sent: 25. oktober 2020 21:48
Subject: Re: Bugs in the Window menu

> On Oct 22, 2020, at 2:39 PM, Stein Rørvik <[hidden email]> wrote:
>
> There has for a long time been a bug in the Window menu that sometimes causes the wrong image to be selected when selecting an image name from the dropdown, but I have not been able to reproduce it earlier as it depends on the order of window opening and closing. But today I found a simple way to reproduce the issue:

I ran this test macro on MacOS and Windows and was not able to reproduce the problem. The images were always listed in the Window menu  in the expected order.

-wayne

>
> dir = "C:/Users/steinr/Temp/t1-head/"; run("Close All"); run("Image
> Sequence...", "open=&dir sort"); rename("t1-head"); run("Image
> Sequence...", "open=&dir sort"); rename("t2-head"); run("Image
> Sequence...", "open=&dir sort"); rename("t3-head"); run("Image
> Sequence...", "open=&dir sort"); rename("t4-head");
>
> Selecting the first image on the list selects the first window, but the window title entries in the Window menu is in the wrong order; "t1-head" is at the bottom of the list.
>
> This bug has been there for a couple of years; I reverted to earlier versions and found that this was working in 1.52e and fails in 1.52f.
>
> Another bug is that if a plugin should happen to install an entry to the Window menu, the plugin entry appears as expected before the list of open images, but the image titles in the menu do not match the corresponding image window. Probably the building of the window menu list forgets to take into account the possibility of extra menu entries already there. This bug does not occur in Fiji.
>
> 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
> %7C70c1195961484c9a41a608d8792bd61c%7Ce1f00f39604145b0b309e0210d8b32af
> %7C1%7C0%7C637392576506306854%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAw
> MDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=7n
> AHXKI1PXLXdI9Sf5k2BRKJa%2BsDN7pkm%2BISO0RsQGw%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%7C70c1195961484c9a41a608d8792bd61c%7Ce1f00f39604145b0b309e0210d8b32af%7C1%7C0%7C637392576506306854%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=7nAHXKI1PXLXdI9Sf5k2BRKJa%2BsDN7pkm%2BISO0RsQGw%3D&amp;reserved=0

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

1 - after first open.png (121K) Download Attachment
2 - after second open.png (126K) Download Attachment
3 - after second rename.png (126K) Download Attachment
4 - after third open.png (151K) Download Attachment
5 - after third rename.png (151K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Bugs in the Window menu

Gabriel Landini
I can reproduce this problem under linux with Java 14  IJ 1.53f48

Interestingly when you record the selection of the images with a macro,
reveals that it might be the shown name in the dialogue which is wrong. E.g.
the 4th image in the list shows "t1-head" but selecting it from the menu
records:
selectWindow("t4-head");

Cheers

Gabriel


On Monday, 26 October 2020 11:40:22 GMT [hidden email] wrote:

> run("Close All");
> run("T1 Head (16-bits)");
> dir = getDirectory("Temp");
> dir += "t1-head/";
> if (!File.isDirectory(dir)) File.makeDirectory(dir);
> print(dir);
> run("Image Sequence... ", "dir=[&dir] format=TIFF");
>
> run("Close All");
> run("Image Sequence...", "open=&dir sort");
> rename("t1-head");
> run("Image Sequence...", "open=&dir sort");
> rename("t2-head");
> run("Image Sequence...", "open=&dir sort");
> rename("t3-head");
> run("Image Sequence...", "open=&dir sort");
> rename("t4-head");

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

Re: Bugs in the Window menu

Stein Rørvik
Thanks,
Yes, it seems this problem is limited to the Window menu.
Calling selectWindow in a macro selects the correct window number.

I can also reproduce this problem with the Blobs image:

run("Close All");
run("Blobs (25K)");
//title of first window is "blobs.gif"
run("Blobs (25K)");
//title of second window is "blobs-1.gif"
rename("blobs.gif");
//title of second window is now "blobs.gif" too
rename("blobs-2.gif");
//title of second window is "blobs-2.gif"
//title of first menu entry is "blobs-2.gif"

//the second window was renamed correctly,
//but the first menu entry instead of the second one was renamed

selectWindow("blobs-2.gif");
//selects the second window as expected

Stein

-----Original Message-----
Sent: 26. oktober 2020 13:00
Subject: Re: Bugs in the Window menu

I can reproduce this problem under linux with Java 14  IJ 1.53f48

Interestingly when you record the selection of the images with a macro, reveals that it might be the shown name in the dialogue which is wrong. E.g.
the 4th image in the list shows "t1-head" but selecting it from the menu
records:
selectWindow("t4-head");

Cheers

Gabriel


On Monday, 26 October 2020 11:40:22 GMT [hidden email] wrote:

> run("Close All");
> run("T1 Head (16-bits)");
> dir = getDirectory("Temp");
> dir += "t1-head/";
> if (!File.isDirectory(dir)) File.makeDirectory(dir); print(dir);
> run("Image Sequence... ", "dir=[&dir] format=TIFF");
>
> run("Close All");
> run("Image Sequence...", "open=&dir sort"); rename("t1-head");
> run("Image Sequence...", "open=&dir sort"); rename("t2-head");
> run("Image Sequence...", "open=&dir sort"); rename("t3-head");
> run("Image Sequence...", "open=&dir sort"); rename("t4-head");

--
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%7C8d51512b94894e9ea89c08d879a6e9a1%7Ce1f00f39604145b0b309e0210d8b32af%7C1%7C1%7C637393105084804385%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=K2nzP4Pub2XBP2vlIENYPFL%2BS8uHLdmGYs%2F4zmGb0fM%3D&amp;reserved=0

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

Re: Bugs in the Window menu

Wayne Rasband-2
In reply to this post by Stein Rørvik
> On Oct 22, 2020, at 2:39 PM, Stein Rørvik <[hidden email]> wrote:
>
> There has for a long time been a bug in the Window menu that sometimes causes the wrong image to be selected when selecting an image name from the dropdown, but I have not been able to reproduce it earlier as it depends on the order of window opening and closing. But today I found a simple way to reproduce the issue:

This bug is fixed in the ImageJ 1.53g1 daily build.

-wayne

> dir = "C:/Users/steinr/Temp/t1-head/";
> run("Close All");
> run("Image Sequence...", "open=&dir sort");
> rename("t1-head");
> run("Image Sequence...", "open=&dir sort");
> rename("t2-head");
> run("Image Sequence...", "open=&dir sort");
> rename("t3-head");
> run("Image Sequence...", "open=&dir sort");
> rename("t4-head");
>
> Selecting the first image on the list selects the first window, but the window title entries in the Window menu is in the wrong order; "t1-head" is at the bottom of the list.
>
> This bug has been there for a couple of years; I reverted to earlier versions and found that this was working in 1.52e and fails in 1.52f.
>
> Another bug is that if a plugin should happen to install an entry to the Window menu, the plugin entry appears as expected before the list of open images, but the image titles in the menu do not match the corresponding image window. Probably the building of the window menu list forgets to take into account the possibility of extra menu entries already there. This bug does not occur in Fiji.
>
> 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: Bugs in the Window menu

Stein Rørvik
Thanks, works fine!

BTW, there is another issue with such folders imported as image sequence:

getDirectory("image") and Image → Show Info both correctly reports the image directory as the pathname.
But the File → Show Folder → Image does not work, it just gives the error message "Image not found". It would be useful if this command would open the same path name as getDirectory("image") returns.

Stein

-----Original Message-----
From: ImageJ Interest Group <[hidden email]> On Behalf Of Wayne Rasband
Sent: 26. oktober 2020 18:22
To: [hidden email]
Subject: Re: Bugs in the Window menu

> On Oct 22, 2020, at 2:39 PM, Stein Rørvik <[hidden email]> wrote:
>
> There has for a long time been a bug in the Window menu that sometimes causes the wrong image to be selected when selecting an image name from the dropdown, but I have not been able to reproduce it earlier as it depends on the order of window opening and closing. But today I found a simple way to reproduce the issue:

This bug is fixed in the ImageJ 1.53g1 daily build.

-wayne

> dir = "C:/Users/steinr/Temp/t1-head/"; run("Close All"); run("Image
> Sequence...", "open=&dir sort"); rename("t1-head"); run("Image
> Sequence...", "open=&dir sort"); rename("t2-head"); run("Image
> Sequence...", "open=&dir sort"); rename("t3-head"); run("Image
> Sequence...", "open=&dir sort"); rename("t4-head");
>
> Selecting the first image on the list selects the first window, but the window title entries in the Window menu is in the wrong order; "t1-head" is at the bottom of the list.
>
> This bug has been there for a couple of years; I reverted to earlier versions and found that this was working in 1.52e and fails in 1.52f.
>
> Another bug is that if a plugin should happen to install an entry to the Window menu, the plugin entry appears as expected before the list of open images, but the image titles in the menu do not match the corresponding image window. Probably the building of the window menu list forgets to take into account the possibility of extra menu entries already there. This bug does not occur in Fiji.
>
> 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
> %7C35c29bd0dac64fb8459608d879d42c70%7Ce1f00f39604145b0b309e0210d8b32af
> %7C1%7C0%7C637393299469258913%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAw
> MDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=ir
> M4vEnOhzZR5YpoGT%2FtejC8nNJz5VFz4KRrRbd9EBg%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%7C35c29bd0dac64fb8459608d879d42c70%7Ce1f00f39604145b0b309e0210d8b32af%7C1%7C0%7C637393299469258913%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=irM4vEnOhzZR5YpoGT%2FtejC8nNJz5VFz4KRrRbd9EBg%3D&amp;reserved=0

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

Re: Bugs in the Window menu

Michael Schmid
In reply to this post by Stein Rørvik
Hi Stein,

just for the record: I could reproduce the problem with your new macro,
and I can confirm that Wayne's fix is fine - it works correctly with
today's daily build, 1.53g1.

Best,

Michael
________________________________________________________________

On 26.10.20 12:40, Stein Rørvik wrote:

> Strange that you can't reproduce it; I see the same behaviour on different PC's, different Java versions and different ImageJ versions as long as they are newer than 1.52e.
>
> First, notice that this example only fails if the folder name is also "t1-head", as that will set the default name of the window when opened. If we rename the folder to "t0-head" the macro will not fail.
>
> Here is a more complete macro, which also creates the folder to be opened:
>
> run("Close All");
> run("T1 Head (16-bits)");
> dir = getDirectory("Temp");
> dir += "t1-head/";
> if (!File.isDirectory(dir)) File.makeDirectory(dir);
> print(dir);
> run("Image Sequence... ", "dir=[&dir] format=TIFF");
>
> run("Close All");
> run("Image Sequence...", "open=&dir sort");
> rename("t1-head");
> run("Image Sequence...", "open=&dir sort");
> rename("t2-head");
> run("Image Sequence...", "open=&dir sort");
> rename("t3-head");
> run("Image Sequence...", "open=&dir sort");
> rename("t4-head");
>
> I tried to use the debugger, and this reveals where the problem lies.
> See the attached screenshots if you still can't reproduce it.
>
> After we have imported the folder the first time, the first window is named "t1-head" as expected. When the folder is opened for the second time, the name of the new window is also "t1-head" since that is the name of the folder. So we now have two windows named "t1-head", and two menu entries "t1-head". The second rename correctly renames the second window to "t2-head", but the FIRST window menu entry named "t1-head" is changed instead of the second one. So now the names in the window menu entries no longer match the names of the windows. Then opening the folder for  the third time, the same repeats. We get a second window named "t1-head", and the wrong window menu entry is renamed, so the "t1-head" entry pops down.
>
> Stein
>
> -----Original Message-----
> Sent: 25. oktober 2020 21:48
> Subject: Re: Bugs in the Window menu
>
>> On Oct 22, 2020, at 2:39 PM, Stein Rørvik <[hidden email]> wrote:
>>
>> There has for a long time been a bug in the Window menu that sometimes causes the wrong image to be selected when selecting an image name from the dropdown, but I have not been able to reproduce it earlier as it depends on the order of window opening and closing. But today I found a simple way to reproduce the issue:
>
> I ran this test macro on MacOS and Windows and was not able to reproduce the problem. The images were always listed in the Window menu  in the expected order.
>
> -wayne
>
>>
>> dir = "C:/Users/steinr/Temp/t1-head/"; run("Close All"); run("Image
>> Sequence...", "open=&dir sort"); rename("t1-head"); run("Image
>> Sequence...", "open=&dir sort"); rename("t2-head"); run("Image
>> Sequence...", "open=&dir sort"); rename("t3-head"); run("Image
>> Sequence...", "open=&dir sort"); rename("t4-head");
>>
>> Selecting the first image on the list selects the first window, but the window title entries in the Window menu is in the wrong order; "t1-head" is at the bottom of the list.
>>
>> This bug has been there for a couple of years; I reverted to earlier versions and found that this was working in 1.52e and fails in 1.52f.
>>
>> Another bug is that if a plugin should happen to install an entry to the Window menu, the plugin entry appears as expected before the list of open images, but the image titles in the menu do not match the corresponding image window. Probably the building of the window menu list forgets to take into account the possibility of extra menu entries already there. This bug does not occur in Fiji.
>>
>> 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
>> %7C70c1195961484c9a41a608d8792bd61c%7Ce1f00f39604145b0b309e0210d8b32af
>> %7C1%7C0%7C637392576506306854%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAw
>> MDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=7n
>> AHXKI1PXLXdI9Sf5k2BRKJa%2BsDN7pkm%2BISO0RsQGw%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%7C70c1195961484c9a41a608d8792bd61c%7Ce1f00f39604145b0b309e0210d8b32af%7C1%7C0%7C637392576506306854%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=7nAHXKI1PXLXdI9Sf5k2BRKJa%2BsDN7pkm%2BISO0RsQGw%3D&amp;reserved=0
>
> --
> 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: Bugs in the Window menu

Wayne Rasband-2
In reply to this post by Stein Rørvik
> On Oct 26, 2020, at 8:29 PM, Stein Rørvik <[hidden email]> wrote:
>
> Thanks, works fine!
>
> BTW, there is another issue with such folders imported as image sequence:
>
> getDirectory("image") and Image → Show Info both correctly reports the image directory as the pathname.
> But the File → Show Folder → Image does not work, it just gives the error message "Image not found". It would be useful if this command would open the same path name as getDirectory("image") returns.

This bug is fixed in the ImageJ 1.53g3 daily build. The File>Show Folder>Image command now uses the IJ.getDir(“image”) method to get the directory.

-wayne

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