// Multilamellar vesicle IR stimulation experiment processing // Written to extract spectral and temporal information from spatial images of MLVs during IR stimulation. // This is written to process each experiment one at a time. since there were only 6, this isnt a problem. But if this needs to be repeated over dozens of images, there is room to automate this further. My recommendation is import the CARS and SRS images in as a single hyperstack, and batch process through each hyperstack/experiment as its listed in the file directory. // Written by Wilson R Adams | Vanderbilt Biophotonics Center | Oct 2020 // ================================================================== // // Open CARS and SRS image hyperstacks (in that order) win = getList("image.titles"); Array.show(win); // Assign images to a workable variable carsstack = win[0]; srsstack = win[1]; dir = getInfo("image.directory"); // Get the avgIP of the SRS stack in both dimensions (color/wavenumber and time) selectWindow(srsstack); run("Z Project...", "projection=[Average Intensity]"); Stack.setChannel(24); run("Enhance Contrast", "saturated=0.35"); srsavgip2 = getTitle(); run("Z Project...", "projection=[Average Intensity]"); srsavgip = getTitle(); close(srsavgip2); // we dont need this stack for anything yet // bkgd subtract a bit (rolling ball) and threshold out MLVs run("Subtract Background...", "rolling=3"); run("Enhance Contrast", "saturated=0.35"); saveAs("tiff", dir+"Results\\"+srsavgip+"_maskbase.tiff"); mask = getTitle(); setAutoThreshold("Huang dark"); setOption("BlackBackground", false); // Add in manual break for user to optimize thresholding (usually Huang, sometimes others) waitForUser("Threshold Optimization", "Select the best threshold for your image, then click OK"); run("Convert to Mask"); run("Create Selection"); roiManager("Add"); waitForUser("Manual ROI", "Add additional manual ROI's if you want"); // Apply threshold to CARS and SRS stacks and save results selectWindow(srsstack); roiManager("multi-measure one"); saveAs("Results", dir+"Results\\"+srsstack+"_Results.csv"); roiManager("save", dir+"Results\\"+srsstack+"_ROI.zip"); // Same ROIs for CARS selectWindow(carsstack); roiManager("multi-measure one"); saveAs("Results", dir+"Results\\"+carsstack+"_Results.csv"); // Close it all up close(srsavgip); close("Results"); roiManager("reset"); close(mask); //close(carsstack); //close(srsstack);