PSC Colocalization Plugin

A colocalization plugin for ImageJ which calculates correlation coefficients over areas of interest

This plug-in is a colocalization plugin for ImageJ which calculates Pearson and Spearman Correlation coefficients (hence PSC) over areas of interest. Requires Java Runtime Environment 1.5 onwards, Windows (running on java for a Mac seems unstable).


  • 15th July 2008. New release, v0.9.01. Notes
    • “Use Inverting Lookup Table” option bug Bug fix, in the form of a warning message if the Edit->Options->Appearance->”Use Inverted Lookup Table” global option is set. This causes a bug with the mask images which are created by the plugin, as it not only inverts the LUTs but also the pixel values themselves, causing the selection mask to be misinterpreted.
  • 2nd July 2008. New release, v0.9. Notes
    • ImageJ greyscale density calibration: this plug-in is not designed to work with ImageJ grey-scale calibration tables. Particularly, if global calibration is set, the values could cause the mask images to be misinterpreted, leading to erroneous results. This release has a warning message if the mask image is corrupted by a calibration table. Otherwise the release is the same as the previous one.
  • 12th June 2008. New release. Essential info:
    • This release is compiled with the additional Spearman and Pearson implementations (marked v2 in the output); see below for equation.Pearson correlation equation - MathML to followThis new version should be more stable than the old equation, which may have been susceptible to numerical innaccuracies with the large rank sums. With all the data I tested these innaccuracies never produced a result practically different from the previous results (ie. the only errors were several decimal places in). But its implemented here as an additional aid to catch bugs. These also implement Java’s BigDecimal arbitrary precision class, except for the final square roots.Other changes include:The ImageJ selection mask is displayed, for information. Pixels within this and within the blue-channel mask (if one exists) are used in the calculations.Please see the source code notes for more minor changes.
  • 5th June 2008. Slightly updated version of 3rd June release. Some minor changes. Essential info:
    • See source code notes at start of file for details. Changes include trying BigDecimal square roots, and the non-computational version of the Pearson equation. No practical differences have been observed so far. Please Note some of these changes are available in the source file, but aren’t by default used in the released .class file as I haven’t seen any practical differences in results yet.
  • 3rd June 2008. New release of the plugin. Essential info:
      • This version includes a test implementation of Java’s BigDecimal arbitrary precision maths class (results marked BD in the plugin output). In theory this should scale to larger images better than the original plugin, which might experience problems with number representation accuracy. In practice, so far results of both have been identical for practical purposes. Always treat results using big image areas with caution though.
    • Bugfix: the blue mask code may have caused problems when masking very large ( >8 megapixel) areas. This is fixed, although results from such large areas should be treated with caution anyway due to possible loss of accuracy.


  • The software outputs the Pearson coefficient for the selected/masked data, and both the short version of the Spearman calculation, and the longer version which calculates a Pearson coefficient across ranked data – this longer version is more suited than the shorter version to data with lots of ties, and is marked “Ties” in the software output. In practice, both Spearman calculations usually produce similar results.
  • Thresholds The user-set threshold level is used to exclude any pixel where both channels have a signal value lower than, or equal to, the set threshold level. Note: A threshold level of 0 still discounts pixels with no signal at all (ie. red=0, green=0). As the software is designed to work over areas of interest on the image, this is really just to exclude low level acquisition noise.
  • NaN in the results indicates the software is unable to complete the calculation – usually due to no pixels being left ‘active’ after masking and thresholding.
  • Computation time The new arbitrary-precision test code causes the plugin to take longer to run, so please be patient.
  • Accuracy of results All floating-point computational arithmetic can introduce errors into results. Although many digits are presented in the results, beyond a point they may be erroneous. Use your judgement and if you are unsure, feel free to look at / test the source code and drop me some feedback.
  • This plugin was originally written to work over small image areas. I have tried to ensure scaling to big images will not cause problems with the internal maths, but I can’t guarantee the results. Feel free to report any bugs and I’ll try my best.
  • Inverted LUTs Make sure Edit->Options->Appearance->”Use inverting lookup table” is NOT checked. This global option can invert the selection mask images, which is obviously a bad thing.

Please let me know if you come across any bugs. Check back here for bug fixes and updates.Please see the associated paper for example use.

LICENSE Copyright (c) 2008, University of Nottingham All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of the University of Nottingham nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


Download the PSC_Colocalization_ class file and place in ImageJ Plugins folderDownload PSC_Colocalization source file to view the source.