我正在使用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();
答案 0 :(得分: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();
}
答案 1 :(得分: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();
您必须确定插件在给定映像上运行需要多长时间,但是原则上这应该可以解决您的问题。