Login  Register

Re: Use of Image Sequence in macros is broken since 1.53d

Posted by Wayne Rasband-2 on Sep 14, 2020; 2:03pm
URL: http://imagej.273.s1.nabble.com/Use-of-Image-Sequence-in-macros-is-broken-since-1-53d-tp5023928p5023931.html

> On Sep 13, 2020, at 6:26 AM, Stein Rørvik <[hidden email]> wrote:
>
> Thanks for the quick fix, it seems to work fine now.
>
> I see that the "number" option is now supported from macro, but there is no field for it in the dialog.
> I assume that this is because the new dialog does not "pre-scan" the image folder as the previous version did;
> however it would perhaps still make sense to include it, perhaps as a blank field or with a default value "all" to give the user information about the possibility to open a specified number of images.

The 1.53e23 daily build adds a “Count” field with a default value of “—“.

> I also have another issue with Image Sequence which is not a bug, but a suggestion for an improvement:
>
> My image sequence folders (output from a micro-CT) usually include a zip file with metadata (a group of text files) at the start of the folder, like this:
>
> metadata.zip
> myimage01.tif
> myimage02.tif
> myimage03.tif
> ...
>
> If I specify ".tif" as a file pattern it works as expected.
>
> If I do not do that, I get an error message dialog that "this Zip archive does not contain a TIF.."
> which is logical as it tries to open the first file as an image. The problem is that this halts the macro, and does not provide the filename of the file that failed to open.

With the 1.53e23 daily build, the error message is written to the Log window and it includes the file path.

-wayne


> What about instead of providing this halting error message dialog, just silently continue and instead write the warning along with the failing filename in the log window? That will give the user a better option to investigate the file that was not included. When launching Image Sequence from the GUI, this is what happens; the error message is shown in the Log window instead of a dialog, but the filename is still not shown.
>
> Stein
>
> -----Original Message-----
> From: ImageJ Interest Group <[hidden email]> On Behalf Of Wayne Rasband
> Sent: 13. september 2020 02:10
> To: [hidden email]
> Subject: Re: Use of Image Sequence in macros is broken since 1.53d
>
>> On Sep 12, 2020, at 5:38 AM, Stein Rørvik <[hidden email]> wrote:
>>
>> I see from the changelog that some changes have been done to Image Sequence to allow drag-and-drop.
>> These changes has caused the use of Image Sequence in macros to be severely broken since 1.53d.
>
> This regression is fixed in ImageJ 1.53e, now available via the Help>Update ImageJ command.
>
> -wayne
>
>>
>> See the below demo macro to reproduce the problem.
>> I am trying this with daily build 1.53e with Java 8 on Windows 10/64 but the problem is also present in 1.53d.
>>
>> It seems that the problem is simply that the previously available options were removed from the new dialog.
>> But instead of warning the user that the functionality was removed, it is just silently ignored, giving the wrong results.
>>
>> So, can the previously available options be migrated to the new dialog?
>> Or can the new dialog be renamed to something else, restoring the old one, so that existing macros will work?
>>
>> My workflow completely depends on the ability to open virtual stacks with specified slice spacing as I work with very large stacks (16GB to 64GB) so always needing to open all slices in memory is not an alternative, especially not over a slow network or when working on a computer with less than 128GB of RAM.
>>
>> Stein
>> -----------------------
>>
>> dir = "C:/Users/steinr/Temp/";
>> path1 = dir + "t1-head/";
>> path2 = dir + "t1-rendering/";
>> File.makeDirectory(path1);
>> File.makeDirectory(path2);
>> run("Close All");
>>
>> //create two example dirs with image sequences
>> run("T1 Head (16-bits)");
>> run("Image Sequence... ", "format=TIFF save="+dir+"t1-head/");
>> run("T1 Head Renderings");
>> run("Image Sequence... ", "format=TIFF save="+dir+"t1-rendering/");
>>
>> //load generated folders as image stacks using some of the available
>> options
>>
>> //open 25 slices at 50% size:
>> run("Image Sequence...", "open=&path1 starting=5 increment=5 scale=50
>> sort"); //1.53c and before: options works as expected //1.53d and
>> after: options are silently ignored giving the wrong results
>>
>> //open 12 slices virtual:
>> run("Image Sequence...", "open=&path2 increment=3 sort use"); //1.53c
>> and before: options works as expected //1.53d and after: options are
>> silently ignored giving the wrong results
>>
>> //re-open path1
>> run("Image Sequence...", "open=&path1 file=.tif sort use"); //1.53c
>> and before: path1 (t1-head) was opened as requested //1.53d and after:
>> path2 (t1-rendering) was silently opened instead of path1; I don't
>> understand why
>>
>> //trying a wrong path
>> path3 = "X:/some/non/existant/path/";
>> run("Image Sequence...", "open=&path3 file=.tif sort use"); //1.53c
>> and before: macro exits with an error message //1.53d and after:
>> t1-rendering was silently opened instead of giving an error message
>>
>> run("Tile");

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