ImageJ - Running concatenate from a macro - valid choice error

时间:2017-07-12 08:09:06

标签: java image image-processing imagej

I am trying to run concatenation of two images through a macro. The final aim is to use in a batch mode.

Here is the code:

dir1 = getDirectory("Choose Source Directory ");

list = getFileList(dir1);

i=0;
filename1 = dir1 + list[i];
filename2 = dir1 + list[i+1];

open(filename1);
open(filename2);

imag1 = list[i]; imag2 = list[i+1];

run("Concatenate...", "  title=[Concatenated Stacks] image1=imag1 image2=imag2");

When executed, the error is like this:

enter image description here

What is the right choice for executing this macro?

1 个答案:

答案 0 :(得分:1)

注意:最好在ImageJ forum而非此处询问ImageJ使用问题。)

您目前正在将输入设置为文字" imag1",并且没有打开的图片标题为" imag1"。您必须通过字符串连接或ImageJ特定的&variable语法,将变量的内容提供给Concatenate命令的选项字符串。

来自ImageJ1 Macro Language documentation

  

通过使用字符串连接,可以将对话框的输入字段设置为宏变量的内容:

noise = 50;
output = "Point Selection";
run("Find Maxima...", "noise="+noise+" output=["+output+"] light");
     

使用ImageJ 1.43及更高版本,有一种更简单的方法,只需要添加"&"到选项字符串中的变量名:

noise = 50;
output = "Point Selection";
run("Find Maxima...", "noise=&noise output=&output light");