计算表面并存储为 Excel 文件

Calculating surface and storing as Excel file

我是 imageJ 的新手,我正在尝试分析多张图像: 我有一个代码可以分析目录中一组图像的颜色阈值并将它们分开存储:

input = "/m_3/ImageJ/test_folder/";
output = "/m_3/ImageJ/finished2/";

function action(input, output, filename) {
    open(input + filename);
run("Set Scale...", "distance=872 known=9 pixel=1 unit=cm");
run("Color Threshold...");
// Color Thresholder 1.48v
// Autogenerated macro, single images only!
.
.
.
// Colour Thresholding-------------

saveAs("Jpeg", output + filename);
        close();
    }

setBatchMode(true); 
list = getFileList(input);
for (i = 0; i < list.length; i++)
        action(input, output, list[i]);
setBatchMode(false);

现在我想计算新保存的图像的面积,这应该与函数测量一起使用..

run("Measure");

如何将计算结果存储在 .xls 或 .csv 文件中? 是否也可以计算一个目录中所有文件的面积并将结果存储在一个 .xls 或 .csv 文件中?

看看斐济 wiki 上的解释 how to apply a common operation to a complete directory。您可以打开每个新保存的图像,设置阈值,测量和关闭每个图像,如下所示:

open("/path/to/your/image.jpg");
setAutoThreshold("Default");
run("Measure");
close();

并将该代码粘贴到脚本编辑器的进程文件夹模板(模板 > IJ1 宏 > 进程文件夹)中。

结果 table 之后可以通过 文件 > 另存为... 保存为 .xls 文件或:

saveAs("Results", "/path/to/your/file.xls");