0

我正在使用 ImageJ 宏来批处理图像。具体来说,我正在尝试在每个图像上运行一个名为 Log3D 的插件。出于某种原因,ImageJ 宏在运行脚本中的下一行之前不会等待命令完成运行。

有没有解决的办法?

谢谢!

我目前正在使用“waitForUser”手动让 ImageJ 知道何时继续,但是当我一次处理数百张图像时,这很烦人并且没有用。

selectWindow(file + " - C=" + chFISH);
run("LoG 3D", "sigmax=1.5 sigmay=1.5 sigmaz=1.5 displaykernel=0 volume=1");
waitForUser("Proceed when Log3D is complete");
run("Invert", "stack");
run("16-bit");
print("Saving smFIHS channel to: " + output);
saveAs("Tiff", output + File.separator + file + ".chFISH"); 
close();
4

2 回答 2

1

您可以尝试先在所有图像上运行 Log3D,然后在新处理的图像上运行其余部分。

openPath = getDirectory("Choose Source Directory");
files = getFileList(openPath);
savePath = getDirectory("Choose Destination Directory");

for (timePoint = 0; timePoint < (files.length); timePoint++)
{
    if (indexOf(files[timePoint], chFISH) >= 0) //Screens file names for your variable
    {
        tempName = getTitle();
        open(openPath + files[timePoint]);
        run("LoG 3D", "sigmax=1.5 sigmay=1.5 sigmaz=1.5 displaykernel=0 volume=1");
        saveAs("Tiff", savePath + tempName);
        close();
    }
}

files = getFileList(savePath);

for (timePoint = 0; timePoint < (files.length); timePoint++)
{
    run("Invert", "stack");
    run("16-bit");
    print("Saving smFIHS channel to: " + savePath);
    saveAs("Tiff", savePath + File.separator + file + ".chFISH"); 
    close();
}
于 2019-09-10T21:35:52.953 回答
0

如果您的图像具有一致的文件大小,您可以使用“等待”命令,这会导致 ImageJ 在继续之前等待“n”毫秒。

selectWindow(file + " - C=" + chFISH);
run("LoG 3D", "sigmax=1.5 sigmay=1.5 sigmaz=1.5 displaykernel=0 volume=1");
wait(30000); //Waits for 30 seconds
run("Invert", "stack");
run("16-bit");
print("Saving smFIHS channel to: " + output);
saveAs("Tiff", output + File.separator + file + ".chFISH"); 
close();

您必须计算出插件在给定图像上运行需要多长时间,但原则上这应该可以解决您的问题。

于 2019-08-15T08:08:25.683 回答