// This macro has been designed to process image stacks of a two-channel image of FRET and CFP channels in alternating order // It is possible to edit this code to account for additional channels // The images used to test the macro were acquired using Andor IQ2 Software // Created by Daniel Shiwarski (c) 2013 Carnegie Mellon University // Begin the processing of the EPAC Ratio Analysis by following these steps: //1.) Open the image for analysis (making sure it is the only image open) //2.) Draw an ROI for the Background Region and save to ROI manager - Remove Slice Info from ROI //3.) Draw an ROI for the Whole Image Region and save to ROI manager - Remove Slice Info from ROI //4.) Proceede by following the onscreen prompts built into the macro //5.) Clicking OK during a prompt will continue; cancel during a prompt with abort the analysis // If you would like to use the Hotkeys to start the macro [F3] and close all of the open images [F4] you must first install // the macro upon imagej startup. macro "EPAC Analysis [F3]" { rename("EPAC Analysis"); waitForUser("Draw the Background ROI and \n an ROI for the whole image") //Dialog.create("ROI Background") //Dialog.addString("Draw a BG ROI", "") //Dialog.show() //Dialog.create("ROI Image") //Dialog.addString("Draw a Whole Image ROI", "") //Dialog.show() roiManager("Select", 0); roiManager("Remove Slice Info"); roiManager("Select", 1); roiManager("Remove Slice Info"); for (n= 1; n<=nSlices; n++) { setSlice(n); roiManager("Select", 0); run("Measure"); BG = getResult("Mean"); roiManager("Select", 1); run("Subtract...", "value=BG slice"); run("Next Slice [>]"); } Dialog.create("Channels") Dialog.addNumber("How many Channels?", 2) Dialog.show() ch=Dialog.getNumber() Dialog.create("Slices") Dialog.addNumber("How many Slices?", 1) Dialog.show() sl=Dialog.getNumber() Dialog.create("Frames") Dialog.addNumber("How many Frames?", 240) Dialog.show() fr=Dialog.getNumber() run("Stack to Hyperstack...", "order=xyczt(default) channels=ch slices=sl frames=fr display=Grayscale"); selectWindow("EPAC Analysis") run("Split Channels"); selectWindow("C1-EPAC Analysis"); rename("EPAC FRET"); run("Enhance Contrast", "saturated=0.35"); selectWindow("C2-EPAC Analysis"); rename("EPAC CFP"); run("Enhance Contrast", "saturated=0.35"); imageCalculator("Divide create 32-bit stack", "EPAC CFP","EPAC FRET"); selectWindow("Result of EPAC CFP"); rename("EPAC CFP/FRET"); selectWindow("EPAC FRET"); run("Duplicate...", "title=[EPAC FRET-1] duplicate range=1-fr"); selectWindow("EPAC FRET-1"); rename("EPAC FRET Mask"); setAutoThreshold("Default dark"); //run("Threshold..."); setOption("BlackBackground", false); run("Convert to Mask", "method=Default background=Dark calculate black"); selectWindow("EPAC FRET Mask"); run("Divide...", "value=255 stack"); selectWindow("EPAC FRET"); run("Duplicate...", "title=[EPAC FRET for Ratio] duplicate range=1-fr"); selectWindow("EPAC CFP"); run("Duplicate...", "title=[EPAC CFP for ratio] duplicate range=1-fr"); selectWindow("EPAC FRET for Ratio"); run("Gaussian Blur...", "sigma=2 stack"); selectWindow("EPAC CFP for ratio"); run("Gaussian Blur...", "sigma=2 stack"); imageCalculator("Divide create 32-bit stack", "EPAC CFP for ratio","EPAC FRET for Ratio"); selectWindow("Result of EPAC CFP for ratio"); rename("EPAC CFP/FRET Ratio"); imageCalculator("Multiply create 32-bit stack", "EPAC CFP/FRET Ratio","EPAC FRET Mask"); selectWindow("Result of EPAC CFP/FRET Ratio"); rename("Final CFP/FRET Image"); run("01 Jet"); selectWindow("Final CFP/FRET Image"); run("Clear Results"); setMinAndMax(0.5677, 0.7702); selectWindow("EPAC FRET Mask"); run("Close"); selectWindow("EPAC CFP/FRET Ratio"); run("Close"); selectWindow("EPAC CFP/FRET"); run("Close"); selectWindow("EPAC FRET for Ratio"); close(); selectWindow("EPAC CFP for ratio"); close(); run("Tile"); selectWindow("EPAC FRET"); selectWindow("EPAC CFP"); selectWindow("Final CFP/FRET Image"); } macro "Close All Windows [F4]" { while (nImages>0) { selectImage(nImages); close(); } }