// This macro is an iteration of Bologna_AstroCaProcess_v3.ijm macro meant to be applied to // nd2 files thrown from the STORM microscope in the Nikon Imaging core at Vanderbilt. // Turns out it's REALLY REALLY SLOW for big image files. took almost 10min to process one video. // I'm making a new slimmer version to cut down on the processing time and speed things up. path = File.openDialog("Select Folder Containing Images") par = File.getParent(path) Dialog.create("Experiment Info"); Dialog.addMessage("Input Image Info?"); Dialog.addNumber("Number of Images = ", 301) Dialog.addString("File Header = ", "PDL_") Dialog.show() ; stack = Dialog.getNumber(); header = Dialog.getString() //stack = 200 // How many images in each file stack run("Bio-Formats", "open=[&path]"); //run("Green Fire Blue"); rename(header) orig = getTitle() // Original imagge stack variable File.makeDirectory(par+"\\processed") // Make processed images directory in parent directory File.makeDirectory(par+"\\processed\\!Final\\") // !Final directory in 'processed' directory for final corrected stacks + time plots File.makeDirectory(par+"\\processed\\"+orig+"\\") // subfolder for each trial in the 'processed' folder for originals, IPs, masks, ROI lists, FFC factors, etc processed_dir = par+"\\processed\\" final_dir = par+"\\processed\\!Final\\" pro_head_dir = par+"\\processed\\"+header+"\\" save(pro_head_dir+header+".tif") getRawStatistics(mean) mean1 = mean t = nSlices() run("Z Project...", "projection=[Sum Slices]"); run("Green Fire Blue"); rename(orig+"_SIP") SIP = getTitle() getRawStatistics(mean) mean2 = mean run("Duplicate...", " "); rename(SIP+"_FFC") FFC = getTitle() run("Subtract Background...", "rolling=60 create"); run("Calculator Plus", "i1=&SIP i2=&FFC operation=[Subtract: i2 = (i1-i2) x k1 + k2] k1=1 k2=&mean2 create"); rename(SIP+"_corr") selectWindow(FFC) run("Duplicate...", " "); rename(FFC+"_stack") FFC_stack = getTitle() run("Divide...", "value=&t"); run("Calculator Plus", "i1=&orig i2=&FFC_stack operation=[Subtract: i2 = (i1-i2) x k1 + k2] k1=1 k2=&mean1 create"); rename(orig+"_final") corr = getTitle() close(FFC) close(FFC_stack) selectWindow(SIP) save(pro_head_dir+SIP+".tif") close(SIP) selectWindow(SIP+"_corr") SIPcorr = getTitle() selectWindow(corr) save(final_dir+corr+".tif") selectWindow(corr) run("Z Project...", "start=10 projection=[Median]"); // Start from image 10 to get rid of photobleaching artifact. run("Green Fire Blue"); rename(orig+"_MedIP") MedIP = getTitle() save(pro_head_dir+MedIP+".tif") selectWindow(MedIP) run("Enhance Contrast", "saturated=0.35"); roiManager("reset"); roiManager("show all with labels") setTool("ellipse"); string = "Use the Elipse tool to make your own ROIs. Press 'Ctrl+T' to add each ROI to the ROI list. Click 'OK' when all ROIs are measured" waitForUser(string) // Wait for user input once ROIs are selected setTool("oval"); string = "Select a background ROI with the oval tool, then press 'OK'" waitForUser(string) roiManager("Add") roiManager("save", pro_head_dir+orig+"_ROImanual.zip") // ROIs will be outputted in a fashion where each collumn is a cell/ROI, and the last collumn is a Background // Measure ROIs and save output data selectWindow(orig) roiManager("show all with labels") run("Set Measurements...", "mean redirect=None decimal=6"); roiManager("multi measure one") run("Input/Output...", "jpeg=85 gif=-1 file=.csv use_file"); saveAs("Results", final_dir+header+"_data"); close(MedIP) selectWindow(orig) close() close(SIPcorr) close("Results") roiManager("open", pro_head_dir+orig+"_ROImanual.zip") roiManager("show all with labels") selectWindow(corr) run("Plot Z-axis Profile");