function action(input, filename) { open(input + filename); run("Split Channels"); selectWindow(File.nameWithoutExtension + ".tif " + "(blue)"); rename(File.nameWithoutExtension + "_Blue"); setAutoThreshold("Huang"); selectWindow(File.nameWithoutExtension + ".tif " + "(green)"); rename(File.nameWithoutExtension + "_Green"); setAutoThreshold("Huang"); selectWindow(File.nameWithoutExtension + ".tif " + "(red)"); rename(File.nameWithoutExtension + "_Red"); //run("Threshold..."); setAutoThreshold("Huang"); run("Set Measurements...", "area mean standard modal min fit integrated area_fraction limit display redirect=None decimal=3"); selectWindow(File.nameWithoutExtension + "_Blue"); run("Measure"); selectWindow(File.nameWithoutExtension + "_Green"); run("Measure"); selectWindow(File.nameWithoutExtension + "_Red"); run("Measure"); close("*"); } input = "/Users/jonah/Downloads/Photos/Viability_preTZ/"; setBatchMode(true); list = getFileList(input); for (i = 0; i < list.length; i++){ action(input, list[i]); } setBatchMode(false); selectWindow("Results"); saveAs("Results", File.directory + "/" + "Viability_Results.csv");