Posted by
Rasband, Wayne (NIH/NIMH) [E] on
Feb 27, 2014; 9:11pm
URL: http://imagej.273.s1.nabble.com/Open-an-image-sequence-using-a-macro-tp5005969p5006705.html
On Feb 27, 2014, at 5:44 AM, Martin Höhne wrote:
> Dear all,
> I also have problems with the use of Import Image Sequence in a macro.
>
> I have a directory with two subdirectories (named dir1 and dir2) containinig
> image series and I would like to open both series within a macro:
>
> When I start Fiji and run the macro give below for the first time, stack1 is
> opened fine without the Image Sequence dialog popping up. But stack2 does´t.
> Instead the Image sequence dialog pops up. The options given in the macro,
> e.g. scale=50) are not automatically taken in this dialog.
>
> When I run the macro for a second time, also the first stack is not opened
> automatically.
>
> It seems the the Import Image Sequence function has to be resetted after
> every imported stack. But how?
Here is a simplified version of the macro that should work better:
source_dir = getDirectory("Source Directory");
stack1=source_dir+"dir1"+File.separator;
run("Image Sequence...", "open=&stack1 scale=50 convert sort");
stack2=source_dir+"dir2"+File.separator;
run("Image Sequence...", "open=&stack2 scale=50 convert sort");
The original macro was missing the "&" notation needed for passing variables, it used a file path as the 'open=' parameter instead of a directory path, and it used parameters with default values ('number=', 'starting=', 'increment=', 'file=' and 'or=') that are not needed.
-wayne
> macro code:
>
> source_dir = getDirectory("Source Directory");
> stack1=source_dir+"dir1"+File.separator;
> list = getFileList(stack1);
> fileone=stack1 + list[0];
> nummer=list.length;
> run("Image Sequence...", "open=fileone number=nummer starting=1 increment=1
> scale=50 file=[] or=[] convert sort");
>
> stack2=source_dir+"dir2"+File.separator;
> list = getFileList(stack2);
> fileone=stack2 + list[0];
> nummer=list.length;
> run("Image Sequence...", "open=fileone number=nummer starting=1 increment=1
> scale=50 file=[] or=[] convert sort");
>
> --
> View this message in context:
http://imagej.1557.x6.nabble.com/Open-an-image-sequence-using-a-macro-tp5005969p5006696.html> Sent from the ImageJ mailing list archive at Nabble.com.
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html