【问题标题】:how to save multiple summary files batch process macro imageJ如何保存多个摘要文件批处理宏 imageJ
【发布时间】: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"); 

【问题讨论】:

    标签: macros analysis imagej


    【解决方案1】:

    在我的测试中(在 macOS 10.12.6 上使用 ImageJ 2.0.0-rc-61/1.51n),重复执行分析粒子并选中汇总选项会将摘要附加到现有的摘要窗口,然后可以将其另存为最后一个文件。

    例如,以下宏生成两个摘要行,然后将它们保存:

    setBatchMode(true);
    run("Blobs (25K)");
    setAutoThreshold("Default");
    run("Analyze Particles...", "size=60-Infinity pixel display include summarize");
    run("Boats (356K)");
    setAutoThreshold("Default");
    run("Analyze Particles...", "size=60-Infinity pixel display include summarize");
    selectWindow("Summary");
    saveAs("Results", "/Users/curtis/Desktop/Results.xls"); 
    

    【讨论】:

      猜你喜欢
      • 2019-12-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-08-09
      • 1970-01-01
      • 1970-01-01
      • 2012-12-18
      • 1970-01-01
      相关资源
      最近更新 更多