Open several image sequences using a macro

I’d like to open several image sequences located in subfolders, i.e dir1/s1, dir1/s2…dir1/sn.

Here is what I came up with so far:

dir1 = getDirectory("Choose Source Directory ");
list = getFileList(dir1);
for (i=0; i<list.length; i++) {
    incoming= dir1+list[i];
    Run("Image Sequence...", "open= ["+incoming+"] ");    
}

However, this returns “Undefined identifier in line x
Run(“Image Sequence…”, “open= [”+incoming+”] “);”

Could somebody help me out? Thanks!

The ImageJ1 macro language (as well as most programming languages) is case-sensitive: there is no Run function, only run.
In addition, your option string contains a superfluous space character after open= that will certainly lead to errors. This line should read:

run("Image Sequence...", "open=[" + incoming + "] ");

NB: I added spaces in the string concatenation to make it more readable, and to illustrate at what places the presence of spaces matters (i.e. inside option strings, where different options are separated by spaces) and where they’re optional (i.e. when concatenating different strings by +).

3 Likes

Hi Jan,

Thanks for the quick help! No idea why I had a capital R for run…
works like a charm now!

Cheers, Kai

1 Like