// This macro is designed to determine the amount of FKBP within the Golgi versus the ER. It employes the use of a Golgi Marker to mask the Golgi region. // The first channel of the image stack has been designed to be the Golgi Marker, or any ,marker being used for the pass through filter. // The second channel of the image stack has been designed to be the FKBP channel, or any protein marker whos location is being determined. // If more than 2 images are present within the stack they will be split, but not discarded. // The final result will be a tiled series of images with the original channels present and the thresholded channels to measure. //Designed by Dan Shiwarski version 1.0 November 25, 2013. Validated and used by Collin Bachert. // This is the start of the macro loop. macro "FKBP Analysis" { rename("FKBP Analysis"); 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() // This is a background subtraction loop to minimize the noise within the images. 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 [>]"); } // This is a series of steps to rename the images after the background has been removed. selectWindow("FKBP Analysis") run("Split Channels"); selectWindow("C1-FKBP Analysis"); rename("Golgi Channel"); run("Enhance Contrast", "saturated=0.35"); selectWindow("C2-FKBP Analysis"); rename("FKBP Channel"); run("Enhance Contrast", "saturated=0.35"); // This series of steps removes the spekle noise from the image and creates a mask of the Golgi to use as a passthrough filter. selectWindow("Golgi Channel") run("Duplicate...", "title=[Golgi Channel -1]"); run("Despeckle"); run("Despeckle"); run("Despeckle"); setAutoThreshold("MaxEntropy dark"); run("Convert to Mask"); run("Divide...", "value=255.000"); run("Enhance Contrast", "saturated=0.35"); // This series of steps removes the spekle noise from the image and mutiplies it by the Golgi filter to obatin FKBP within the Golgi. selectWindow("FKBP Channel"); run("Despeckle"); run("Despeckle"); run("Despeckle"); imageCalculator("Multiply create", "FKBP Channel","Golgi Channel -1"); selectWindow("Result of FKBP Channel"); rename("FKBP in Golgi"); run("Duplicate...", "title=[FKBP in Golgi-Threshold]"); setAutoThreshold("Triangle dark"); // Final Steps run auto thresholding procedures, ,clears any current results and Tiles the images. selectWindow("FKBP Channel"); run("Duplicate...", "title=[FKBP Channel-Threshold]"); setAutoThreshold("Triangle dark"); run("Clear Results"); selectWindow("Golgi Channel -1") run("Tile"); } // This macro enabels the F4 key to be used to close all open images if the macro has been imstalled prior to running the analysis. macro "Close All Windows [F4]" { while (nImages>0) { selectImage(nImages); close(); } }