I'm currently trying to batch process a lot of lab images at once using ImageJ/Fiji but I'm having a hard time making it process the images. Whenever a file is pulled up, there are three images which are split into channels and open in separate windows . During the processing, each window is selected and needs to be processed differently. I am currently trying to figure out how to make the program select each different window based on a specific parameter rather than the exact name of the window. Each of the windows will end in "C=0", "C=1", or "C=2". I want the code to select the windows that contain the string "C=0", "C=1", or "C=2" in them but I can't seem to get it to work. As of now, it only runs through the first file but not the rest. The current code I'm running looks like this.
open("/Users/name/Desktop/name of file");
selectWindow("name of window - C=1");
setOption("ScaleConversions", true);
run("8-bit");
setAutoThreshold("Default");
//run("Threshold...");
//setThreshold(0, 10);
setOption("BlackBackground", true);
run("Convert to Mask");
run("Convert to Mask");
run("Analyze Particles...");
close();
run("Close");
selectWindow("name of window - C=0");
setOption("ScaleConversions", true);
run("8-bit");
setAutoThreshold("Default");
//run("Threshold...");
//setThreshold(0, 20);
run("Convert to Mask");
run("Convert to Mask");
run("Analyze Particles...", "size=20-700 show=Overlay display summarize add composite");
run("Analyze Particles...");
roiManager("Show None");
roiManager("Show All");
run("Close");
close();
run("Close");
selectWindow("name of window - C=2");
setOption("ScaleConversions", true);
run("8-bit");
setAutoThreshold("Default");
//run("Threshold...");
//setThreshold(0, 4);
run("Convert to Mask");
run("Convert to Mask");
run("Analyze Particles...");
saveAs("Results", "/Users/name/Desktop/results/Summary.csv");
Any and all help would be super appreciated. Thank you.