Created by
Dave Mason
| /*
* IJ script to pull measurements from an Ilastik Simple Segmentation Output with 3 labels
*/
#@ File (label = "Input directory", style = "directory") input
#@ String (label = "File suffix", value = "Segmentation.tif") suffix
//-- pre
setBatchMode(true);
run("Clear Results");
saveSettings();
run("Set Measurements...", "area limit display redirect=None decimal=0");
//-- run
processFolder(input);
//-- post
restoreSettings();
print("done");
function processFolder(input) {
list = getFileList(input);
list = Array.sort(list);
for (i = 0; i < list.length; i++) {
if(endsWith(list[i], suffix))
processFile(input, list[i]);
}
}
function processFile(input, file) {
print("Processing: " + input + File.separator + file);
open(input + File.separator + file);
for (labels=1;labels<4;labels++){
setThreshold(labels, labels);
run("Measure");
}
resetThreshold();
close("*");
}
|