-1

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

4

1 回答 1

0

假设您的图像在逻辑上是有序的(例如,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);
于 2017-11-01T00:35:46.897 回答