/* macro for ImageJ 1.50 by Michael Cammer - please cite NYULMC Microscopy Core if data published Macro for colocalization (Pearson's correlation) at thresholds set by the user. Pearson's correlation was coded in 2004 for use and distribution by Analytical Imaging Facility at Albert Einstein College of Medicine. Wrappers for ease of use changed since for many diffferent laboratories. v105 20150821 for requires a RGB image. The image is converted to Composite and two channels in the array "compare" are corrleated. Multiple regions of interest are in the ROI Manager and the correlation of each is listed in the Log window. There's a bug that if there are too many zeroes, NaN is calculated. Haven't figured out why. But add 1 globally to images, at least for the simulations, before running to get rid of this problem and shift the resut only minimally higher. Warning: spatial scale is removed from the image. Instructions: User selects regions of interest. Each one is put in ROI Manager. Recommend saving ROI Manager if need to do analysis on same regions again. (Regions selections may be sone on multiple files before doing actual analysis.) If opening ROI Manager files from disk, make sure previous one closed first. User runs macro. Save log window as text file or copy-paste into Excel or other spreadsheet. */ var thresholds = newArray(8, 16, 32, 48, 64, 80, 128); var median = true; // change to false if don't want to median filter images var compare = newArray(1 ,2 ); // The channels to compare, in this case green and blue //************************************************************** //Macros to implement Pearson's coefficient analysis of digital images. //michael.cammer@med.nyu.edu //Pearson's section written and tested 10 March 2004. //Additions written October 2010. // //************************************************************** //================================================= /* This macro assumes image is and RGB TIFF file. It is converted to a composite stack. */ /* convert RGB to composite; user will trace multiple regions and put in ROI manger; analyze each region */ macro "Coloc on single image multiple ROIs [q]" { requires("1.50"); close("\\Others"); run("Set Scale...", "distance=1 known=1 unit=pixels"); title = getTitle(); run("Split Channels"); run("Merge Channels...", "c1=[" + title + " (red)] c2=[" + title + " (green)] c3=[" + title + " (blue)] create"); rename(title); outputString = "filename "+ " \t " + "0" for (i=0; i