Retaining filenames when importing image sequence

Posted by Stein Rørvik on
URL: http://imagej.273.s1.nabble.com/Retaining-filenames-when-importing-image-sequence-tp5021750.html

When importing images from a folder to a stack using Image Sequence, it is useful to have the filenames shown as the image subtitle.
This is especially useful when importing the series at odd increments higher than 1.
When importing as a virtual stack, the filenames are shown as the image subtitle.
But when importing as a regular stack to memory, the image label (if present) is used instead of the filename.

I have a problem with this, as the images I want to import all have the same label;
which is just the name of the third party software that created the images.
It seems that this behaviour started in ImageJ version 1.52d, as it worked fine in 1.52c.

If the behaviour is intended, it would be useful to have the option to turn it off in the Import -> Image Sequence dialog.
There could for example be added a checkbox "Use file names as slice labels" or similar.
This would be complementary to the "Use slice labels as file names" option in Save As -> Image Sequence.
If this checkbox is unchecked, the image label (if present) is then used as subtitle instead, as there are many cases when this is useful.

The macro below replicates the behaviour.

Demo macro:
------------------------------
run("Close All");
outDir = getDirectory("temp") + "MyImageFolder/";
if (!File.isDirectory(outDir)) File.makeDirectory(outDir);
run("Bridge (174K)");
strLabel = "Software: My Proprietary Software";
setMetadata("Info", strLabel);
saveAs("Tiff", outDir + "bridge_001.tif");
saveAs("Tiff", outDir + "bridge_002.tif");
saveAs("Tiff", outDir + "bridge_003.tif");
saveAs("Tiff", outDir + "bridge_004.tif");
saveAs("Tiff", outDir + "bridge_005.tif");
run("Close All");
run("Image Sequence...", "open=&outDir file=bridge sort");
run("Image Sequence...", "open=&outDir file=bridge sort use");
run("Tile");

//1.52c: filename is used as subtitle in both virtual stack and normal stack
//1.52k: label is used as subtitle in normal stack, filename is used in virtual stack
------------------------------


Stein


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