dir = getDirectory("Navigate to the folder to be processed"); print("STARTING file extraction: "+dir); filelist = getFileList(dir); Array.show(filelist); // Loop through each folder in the parent directory //for (i = 0; i < 1; i++) { // for debugging one folder at a time for (i = 0; i < filelist.length; i++) { // only open folders, not files in the parent direcory if (endsWith(filelist[i], "/")) { // List image files in sub folder sublist = getFileList(filelist[i]); firsttif = dir+filelist[i]+"ChanA_001_001_001_001.tif"; // If folder has images in it, if (File.exists(firsttif)) { // Import image using Bioformats to preserve metadata. // Uses virtual stacks for speed and RAM, especially on server run("Bio-Formats Importer", "open=[&firsttif] color_mode=Default rois_import=[ROI manager] view=Hyperstack stack_order=XYCZT use_virtual_stack"); // Rename all of the files once imported (assumes MANTIS) runMacro("SicLab_imgrename_ext.ijm"); // Save in parent directory and close all of the images wins = getList("image.titles"); for (j = 0; j < wins.length; j++) { selectWindow(wins[j]); // Open ROI file roiManager("reset"); roiManager("open", dir+wins[0]+"_roi.zip"); roiManager("show all with labels"); // Multimeasure roiManager("multi-measure one"); saveAs("Results", dir+wins[0]+"_results.csv"); close("Results"); // Close out of window close(wins[0]); } // Print progress once images are extracted print(filelist[i]+" COMPLETE"); } // end of 'file exist' if stmt } // end of title folder if statment } // end of image folder for loop print(dir+" COMPLETE");