//Custom ImageJ script to extract intensity information from confocal immunofluorescence images run("Close All"); // close all currently open images to prevent them from interfering with the macro commands tif = ".tif"; dir1 = getDirectory("Choose Source Directory"); // specify the experiment directory that contains images from the middle slice of confocal stacks, where the top and bottom of the stack are set to the top and bottom of the cell open(dir1+"Ch03_DAPI_MidSlice.tif"); rename("DAPI"); run("Subtract Background...", "rolling=50"); run("Duplicate...", "title=DAPI_mask"); setAutoThreshold("Triangle dark"); run("Convert to Mask"); run("Despeckle"); run("Erode"); run("Watershed"); run("Set Measurements...", "area mean standard center feret's integrated display redirect=None decimal=2"); run("Analyze Particles...", "size=30-300 show=Nothing exclude clear include add"); selectWindow("DAPI_mask"); run("Close"); selectWindow("DAPI"); run("Duplicate...", "title=DAPI_mask"); roiManager("Measure"); for (a=0; a 120) { IJ.deleteRows(a, a); roiManager("Select", a); roiManager("Delete"); } } roiManager("Deselect"); roiManager("Combine"); roiManager("Delete"); roiManager("Add"); run("Close"); roiManager("Deselect"); selectWindow("DAPI"); run("Duplicate...", "title=DAPI_MeasuredCells"); roiManager("Select",0); run("Clear Outside"); roiManager("Delete"); run("Select None"); run("Clear Results"); setAutoThreshold("Triangle dark"); run("Convert to Mask"); run("Despeckle"); run("Erode"); run("Watershed"); run("Set Measurements...", "area mean standard center feret's integrated display redirect=None decimal=2"); run("Analyze Particles...", "size=30-300 show=Overlay exclude clear include add"); saveAs("Jpeg", dir1+"DAPI_MeasuredCells"+".jpg"); // create DAPI-defined nuclear ROIs for measurement in all channels. An image of the measured nuclei is saved as DAPI_MeasuredCells.jpg. run("Close"); selectWindow("DAPI"); roiManager("Measure"); saveAs("Measurements", dir1+"DAPI.txt"); run("Clear Results"); open(dir1+"Ch00_H3K27me3_MidSlice.tif"); rename("H3K27me3"); run("Subtract Background...", "rolling=50"); roiManager("Measure"); saveAs("Measurements", dir1+"H3K27me3.txt"); run("Clear Results"); run("Close"); open(dir1+"Ch02_Nanog_MidSlice.tif"); rename("Nanog"); run("Subtract Background...", "rolling=50"); roiManager("Measure"); saveAs("Measurements", dir1+"Nanog.txt"); run("Clear Results"); run("Close"); roiManager("Deselect"); roiManager("Delete"); run("Close All");