Login  Register

Small bug in import sequence

Posted by Stein Rørvik on Apr 22, 2021; 9:41am
URL: http://imagej.273.s1.nabble.com/Small-bug-in-import-sequence-tp5024643.html

Hello,

I have encountered what appears to be a small bug in the import Image Sequence command.

What I want to do is to open image number N in a large amount folders to compare these images. The result image title should be named according to the folder name, not the file name, as the file names are the same for all folders. The file name (displaying the number in the sequence) should be set as the image(slice)label.

I thought an easy way to do this would be to use File → Import → Image Sequence and specify N as the starting image and 1 as the number of slices.
That should result in a one-slice stack named the same as the folder, with the file name as the label.

This does not work however; if the number of images is set to 1. The correct file is opened, but the label is set to image 1 in the sequence.
If the number of images is 2 or more, it works as expected.

It also works correctly if the "separate images" option is chosen, but that is not what I want because the result image name will then be equal to the filename not the folder name.

Example macro to reproduce the issue:

dir = "C:/Users/steinr/Temp/";
path = dir + "t1-head/";
File.makeDirectory(path);
run("Close All");

//create sequence
run("T1 Head (16-bits)");
run("Image Sequence... ", "dir=[&path] format=TIFF name=t1-head_ start=1");

//open one slice
run("Image Sequence...", "dir=[&path] start=50 count=1 sort");
//fails, opens image 50 but the label is from image 1

//open two slices
run("Image Sequence...", "dir=[&path] start=50 count=2 sort");
//works, opens image 50 and 51 with correct labels

//open one slice, separate
run("Image Sequence...", "dir=[&path] start=50 count=1 sort open");
//works, opens image 50

//open two slices, separate
run("Image Sequence...", "dir=[&path] start=50 count=2 sort open");
//works, opens image 50 and 51

Stein

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