Posted by
Oliver Bannach on
URL: http://imagej.273.s1.nabble.com/macro-for-automatic-import-of-image-sequences-tp3696770p3696772.html
Dear Michael,
thank you very much for your support. I changed my macro according to
your suggestions:
dirX = getDirectory("Choose Source Directory ");
list = getFileList(dirX+"/ch0/");
file0 = list [0];
run("Image Sequence...", "open=["+dirX+"/"+ch0+"/"+file0"] number=6
starting increment=1 scale=100 file=[] or=[] convert sort file=[.tif]");
run("Green");
list = getFileList(dirX+"/ch1/");
file0 = list [0];
run("Image Sequence...", "open=["+dirX+"/"+ch1+"/"+file0"] number=6
starting increment=1 scale=100 file=[] or=[] convert sort file=[.tif]");
run("Red");
When I run the macro, I can choose a directory. But next an error
message is displayed "Undefined variable in line 4". What is still wrong?
Thank you!
Oliver
Michael Schmid schrieb:
> Hi Oliver,
>
> you can't specify a file with a "*" in run("Image Sequence...
> You should specify one of the files there.
> If you don't know the name of one file in advance, get one.
> E.g., if there are only .tifs in the directory, you can write:
>
> list = getFileList(dirX+"/ch0/");
> file0 = list[0];
>
> otherwise you have to loop through the list to find a tiff that
> you can use as a starting point.
>
> To specify that you want to import tiffs only, you can write
> file=[.tif] in the run("Image Sequence... arguments.
>
>
> Also, make sure that you have no variable names inside the
> quotes. The argument should be, e.g.,
> "open=["+dirX+"/"+ch1+"/"file0] number=..."
>
> The plus sign is the string concatenation operator.
>
> Michael
> ________________________________________________________________
>
> On 25 Mar 2008, at 17:53, Oliver Bannach wrote:
>
>> Hi folks
>>
>> I'd like to have a macro for automatic opening of image sequences. This
>> is what the macro should do:
>> 1) The main directory (dirX) needs to be specified by a popup dialog
>> 2) The .tif files are located in subdirectories named ch0/ and ch1/,
>> respectively. The files (*.tif) in these two directories should be
>> imported as two image sequences
>> 3) The two sequences should be colored red and green
>>
>> I wrote this macro, but it doesn't seem to work:
>>
>> dirX = getDirectory("Choose Source Directory ");
>> run("Image Sequence...", "open=[dirX\\ch0\\*.tif] number=6 starting=1
>> increment=1 scale=100 file=[] or=[] convert sort");
>> run("Green");
>> run("Image Sequence...", "open=[dirX\\ch1\\*.tif] number=6 starting=1
>> increment=1 scale=100 file=[] or=[] convert sort");
>> run("Red");
>>
>> Maybe somebody can fix it? Any help is greatly appreciated. Many thanks
>> in advance!
>>
>> regards
>> Oliver