【发布时间】:2017-09-15 19:12:39
【问题描述】:
我对 imageJ 中的批量图像处理非常陌生。我有一个宏,允许我在一个目录中处理多个图像。问题是宏会为每个处理过的图像生成一个单独的摘要窗口,让我手动将所有输出数据编译成单个 .csv 或 .xls。我希望所有汇总数据都自动编译到一个文件中。虽然我找到了几个显示如何做到这一点的来源,但它对我的情况并不是特别有帮助。
如果您能提供帮助,我将不胜感激。
下面是代码的缩略示例:
dir1 = getDirectory("Choose Source Directory ");
dir2 = getDirectory("Choose Destination directory");
list = getFileList(dir1);
setBatchMode(true);
for (i=0; i<list.length; i++){
print (list[i]);
open(dir1+list[i]);
name=File.nameWithoutExtension;
//Prepare the image by removing any scale and making 8-bit
run("Set Scale...", "distance=237.3933 known=1 pixel=1 unit=cm
global");
makeRectangle(4068, 5940, 1572, 1320);
run("Crop");
// Convert the image into RGB channels for proper thresholding
run("RGB Stack");
setSlice(3);
//Threshold
setAutoThreshold("Default");
// Analyze particles
// Provides total area of number of cotyledons in image
run("Analyze Particles...", "size=60-Infinity pixel display include
summarize");
run("Revert");
}
//Save the results
selectWindow("Summary");
saveAs("Results", dir2+"Results.xls");
【问题讨论】: