input = getDirectory("Input directory");
output = getDirectory("Output directory");
Dialog.create("File type");
Dialog.addString("File suffix: ", ".tif", 5);
Dialog.show();
suffix = Dialog.getString();
processFolder(input);
function processFolder(input) {
list = getFileList(input);
for (i = 0; i < list.length; i++) {
if(File.isDirectory(list[i]))
processFolder("" + input + list[i]);
if(endsWith(list[i], suffix))
processFile(input, output, list[i]);
}
}
function processFile(input, output, filename) {
print("Processing: " + input + filename);
open(input + filename);
run("Split Channels");
selectWindow(filename+" (blue)");
close();
selectWindow(filename+" (green)");
close();
selectWindow(filename+" (red)");
run("Histogram");
getHistogram(values, counts, 256);
saveAs("Results", output + "Histogram of " + filename + ".csv");
close();
saveAs("TIFF", output+ "processed_" + filename);
selectWindow("processed_" + filename);
close();
}
我很欣赏每一个输入。干杯!
答案 0 :(得分:0)
不确定您是否可以使用IJ宏语言将其另存为csv文件。但是这里有一些代码可以做同样的事情但是把它保存为txt文件(这个例子只接受255的值)
getStatistics(mean, min, max, std, histogram);
white=histogram[255];
// list2 is the list of images in a for loop - adds image name to results
print(white,",", list2[j]+" smi31");
selectWindow("Log");
saveAs("txt", file1+"Result");
希望这有用: - )