【问题标题】:How to average all files within a folder by image j macro如何通过图像 j 宏平均文件夹中的所有文件
【发布时间】:2017-10-24 13:34:56
【问题描述】:

嘿,我是 ImageJ 宏编程的新手,我想平均一个文件夹中的所有图像,将单个平均图像保存在一个单独的文件夹中

【问题讨论】:

    标签: average imagej-macro


    【解决方案1】:

    假设您的图像按逻辑顺序排列(例如,image001、image002、image003 等...) - 试试这个:

    setBatchMode(true);
    
    //retrieve images from directory
    dir = getDirectory("Choose a directory of images...");
    list = getFileList(dir);
    
    for (i=0; i <list.length; i++) {
        path = dir + list[i];
        open(path); 
    }
    run("Images to Stack", "name=Stack title=[] use");
    stackImage = getTitle();
    
    //make an average intensity image
    run("Z Project...", "projection=[Average Intensity]");
    
    //save out to new folder
    outputPath = dir + File.separator + "separateFolder";
    if (!File.exists(outputPath)) File.makeDirectory(outputPath);
    newPath = outputPath + File.separator + "averagedImage";
    run("Save","save=[newPath]");
    close(stackImage);
    close();
    
    setBatchMode(false);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-06-11
      • 1970-01-01
      • 1970-01-01
      • 2016-08-19
      • 2023-03-08
      • 2021-01-08
      • 2012-06-24
      • 2016-09-22
      相关资源
      最近更新 更多