MosaicIA: an ImageJ/Fiji plugin for spatial pattern and interaction analysis
© Shivanandan et al.; licensee BioMed Central Ltd. 2013
Received: 29 May 2013
Accepted: 8 November 2013
Published: 3 December 2013
Analyzing spatial distributions of objects in images is a fundamental task in many biological studies. The relative arrangement of a set of objects with respect to another set of objects contains information about potential interactions between the two sets of objects. If they do not “feel” each other’s presence, their spatial distributions are expected to be independent of one another. Spatial correlations in their distributions are indicative of interactions and can be modeled by an effective interaction potential acting between the points of the two sets. This can be used to generalize co-localization analysis to spatial interaction analysis. However, no user-friendly software for this type of analysis was available so far.
We present an ImageJ/Fiji plugin that implements the complete workflow of spatial pattern and interaction analysis for spot-like objects. The plugin detects objects in images, infers the interaction potential that is most likely to explain the observed pattern, and provides statistical tests for whether an inferred interaction is significant given the number of objects detected in the images and the size of the space within which they can distribute. We benchmark and demonstrate the present software using examples from confocal and PALM single-molecule microscopy.
The present software greatly simplifies spatial interaction analysis for point patterns, and makes it available to the large user community of ImageJ and Fiji. The presented showcases illustrate the usage of the software.
KeywordsSpatial pattern analysis Microscopy Co-localization analysis Interaction analysis PALM ImageJ Fiji Image analysis
We present a software plugin to analyze and quantify spatial patterns of objects in images using the free open-source image-processing platform ImageJ  or its distribution Fiji . The spatial arrangement of objects relative to each other is a rich source of phenotypic information. This ranges from spatial patterns of sub-cellular structures or proteins, to the spatial patterns formed by cells in tissues, to spatial patterns of organisms in ecosystems. The mathematical framework of spatial statistics allows quantifying and analyzing such patterns, comparing them with each other, and performing statistical tests on them [3-5]. This for example allows testing whether the distribution of a set of objects is significantly different from random, or whether the objects in one set are distributed independently of the objects in another set. Significant deviations from spatial randomness are indicative of interactions (of some sort) between the objects, as formalized in the framework of spatial interaction analysis .
Biology has long relied on co-localization analysis in order to quantify the spatial distribution of one set of objects with respect to another one. This includes pixel-based and object-based co-localization analysis methods . Pixel-based methods typically use a correlation measure between the pixel intensities in different images in order to quantify the degree of overlap or co-localization between the object distributions represented in the images. Object-based methods first detect and delineate the objects of interest in the images and then quantify their degree of co-localization using an overlap measure. While pixel-based measures are easy to compute, they are difficult to interpret. They are also sensitive to blurring and noise in the image. Moreover, in some observations, like those from Photo-Activation Localization Microscopy (PALM) and STochastic Optical Reconstruction Microscopy (STORM) [8-10], it is not obvious what constitutes an image , as these methods provide locations and localization uncertainties of individual molecules. Pixel-based methods are hence not directly applicable, unless one first renders a synthetic image from the observed point locations. This, however, leads to a loss of information as nearby molecule detections fuse into one blob in the rendered image. Object-based methods are more intuitive to interpret, as they directly work with locations of objects. However, they depend on prior object detection and segmentation. It is also not clear when two object should be considered “overlapping”. This requires defining a distance threshold, which typically is ≈200 nm for diffraction-limited data . Single-molecule imaging, like PALM and STORM, directly provides point locations, rendering a separate object-detection step unnecessary.
While co-localization analysis captures the amount of overlap between objects, it is not sufficient to describe spatial patterns and interactions . Also, co-localization measures do not account for the fact that accidental overlap occurs even in randomly distributed objects and becomes more frequent as the object density increases. This typically leads to a density bias in the final co-localization score.
Spatial interaction analysis
The notion of “interaction” used here is purely geometric. We say that two sets of objects interact if the spatial distribution of one set is not independent of the distribution of the other set (see Figure 1b). The objects do not interact if the distribution of one set can be explained by a random distribution that does not depend on the other, the reference set (see Figure 1c). These interactions or spatial patterns need not imply causal interactions.
The Interaction analysis model
where Z is the normalization constant (partition function), and ϕ(d) the unknown distance-dependent interaction potential. The role of the potential is to “deform” the context in order to explain the distribution of X with respect to Y as a result of the points in X interacting with their nearest neighbors in Y through the potential ϕ (see Figure 1b,c).
The potential ϕ(d) can be of any shape, including a step function for which a context-corrected version of traditional threshold-based co-localization measure is recovered . Often, we use a parametric potential of the form ϕ(d) = ε f((d - t) / σ), where ε is the interaction strength, σ the length scale of the interaction, and t a threshold closer than which objects are considered overlapping. The function f defines the shape of the potential. If the shape f is unknown, a piece-wise linear non-parametric function is used. Plots of the different parametric potential shapes provided by the plugin are shown in Figure 1d.
The plugin is written in Java. It uses the open-source Java library Weka  for efficiently computing NN distances using kd-trees and for kernel density estimation of probability distributions. The plugin further uses CMA-ES (the Covariance Matrix Adaptation Evolution Strategy)  for parameter optimization. This optimizer is less prone to get stuck in local optima than the simplex method used in the original publication . The plugin has been tested with both ImageJ and Fiji on Windows, MacOS X, and Linux. It should run on any platform where Java and ImageJ are available. Running a complete analysis using the present plugin takes between a few seconds and a few minutes, depending on the number of objects present in the image.
The plugin currently works with point objects only, even though the interaction analysis framework generalizes to extended objects too . In order to work with non-point objects in the present plugin, they can be segmented using other software, e.g. the Region Competition plugin for ImageJ , and their centers of mass can be read into the present plugin. Representing extended objects by their centers of mass does not significantly change the result of the interaction analysis, as shown in the PALM example below.
The type of the potential function can be selected from a drop-down menu. Both parametric and non-parametric functions are provided. The plugin then estimates the potential or its parameters from the data by minimizing the ℓ2 difference between the observed NN distance distribution and the one predicted from the interaction model p(d). The results, including the residual fitting error, are then shown along with a plot of , and q(d), as shown as in Figure 2b,c.
The plugin also provides hypothesis tests to check whether the estimated interaction is statistically significant. The test statistic is computed from K Monte Carlo samples of point distributions corresponding to the null hypothesis of “no interaction”. The test statistic from the actually observed distribution is ranked against these K random samples. If it ranks higher than ⌈(1 - α)K⌉-th, the null hypothesis of “no interaction” is rejected on the significance level α.
List of parameter inputs to the plugin
The plugin has six parameters that the user can set to control its behavior. These parameters and their typical values are described below.
Parameters for object detection
The following parameters control the image-processing part of the plugin. The algorithm used to detect bright objects (blobs) in the images and extract their location is described in Ref. . See this reference for a more in-depth discussion of these parameters and for illustrations of how they affect object detection.
Radius: Approximate radius of the blobs in the images in units of pixels. This value should be slightly larger than the visible object radius, but smaller than the smallest NN object separation.
Cutoff: The score cut-off for false-positive rejection. The larger the cutoff, the more conservative the algorithm becomes to only select objects that look alike.
Percentile: Determines how bright a blob has to be in order to be considered an object. All local intensity maxima in the given upper percentile of the image intensity histogram are considered candidate objects.
Parameters for computing distance distributions
Once the objects have been detected in both images, or their coordinates have been read from files, the following parameters can be used to control interaction inference:
Grid spacing: The grid spacing controls how finely the context q(d) is sampled in units of pixels. It should ideally be less than half of shortest possible interaction that can be detected with the available data. For an image without sub-pixel object detection, 0.5 (pixel) is hence sufficient. In cases where finer resolution is needed, the user can try successively smaller values until the context q(d) does not change any more. Grid sampling the context q(d) is the most time-consuming part of the analysis. Adjusting the grid size hence significantly influences the computational time.
Kernel wt(q): This is the weight parameter used by the kernel density estimator to estimate the smooth context p.d.f. q(d) from the grid samples. Since the number of grid points is usually large, a small kernel weight of 0.001 should be sufficient to produce smooth results. This parameter usually does not need to be changed.
Kernel wt(p): This is the weight parameter used by the kernel density estimator to estimate the smooth NN distance distribution . The value of this parameter is critical, and a rough estimate for it is computed using Silverman’s rule . The resulting value is shown as a suggestion. This parameter should be carefully tuned so that the resulting distribution contains all relevant information from the histogram, without overfitting it. A larger value for this parameter leads to a more fine-grained, less smooth fit.
List of potentials provided
The plugin provides both parametric and non-parametric potentials that can be used to describe an interaction. The non-parametric potential is more flexible and does not require the user to assume anything about the functional shape of the interaction. However, it requires more computer time to be estimated and does not support statistical tests for the significance of an interaction. Parametric potentials offer an intuitive interpretation of an interaction by its strength and length scale. Frequently, one first estimates a non-parametric potential in order to get an idea of the rough shape of the interaction. Then, one selects the parametric potential most similar to it and repeats the estimation.
Potentials are parameterized as ϕ(d) =vε f((d - t) / σ) with interaction strength ε, length scale σ, and a hard core t. For the step potential, σ = 1. For all other potentials, t = 0. The shapes f(·) of the various potentials are:
Linear potential, type 1:(4)
Linear potential, type 2:(5)
Plots of these potentials are shown in Figure 1d. Other potentials can easily be implemented, if needed.
The non-parametric potential does not assume any specific shape and can be used to gain an approximate idea of the shape of an unknown interaction. It is defined as a weighted sum of linear kernel functions centered on P support points (defined in the #support pts field). The more support points are used, the finer the potential is resolved, but the more costly and unstable the estimation becomes. The smoothness of the estimated potential is controlled by the smoothness parameter, which penalizes differences between adjacent support points. Larger smoothness parameters lead to smoother potentials, but may miss or average out interesting interactions. Therefore, this parameter should be used with caution.
Working with coordinates instead of images
It is possible to directly use MosaicIA on localization data. This is useful when working with imaging modalities like PALM and STORM that provide point coordinates rather than images. It is also useful when working with objects that are not blob-like, or for which the object-detection step of the plugin does not work well. These objects can be detected and segmented using any other tool, e.g. the Region Competition  or the split-Bregman/Squassh  plugins for ImageJ/Fiji, and their coordinates stored in a file. A comma-separated text file of object coordinates can be read into MosaicIA by clicking load coordinates instead of load images. Each line in the file should contain the coordinates of one object in the format x, y, (z). The spatial boundaries of the point patterns (they must be identical for both X and Y) are entered in the fields provided. For objects detected in a 400×400 pixel image, the boundaries are (0, 399) in both directions.
Interpreting the results
The estimated interaction potentials and parameters can be used to quantitatively compare spatial distributions across different samples and conditions (e.g., perturbations). Comparisons based on interaction strengths and length scales, however, should only be done for results obtained with the same potential shape.
The strength of an interaction, ε, is equal to zero for independent, i.e. non-interacting, point patterns. However, due to noise and random overlap in the data, the strength may be slightly greater than zero even in the case of no interaction. A hypothesis test is therefore provided in order to check whether an estimated interaction is statistically significant given the amount and quality of the data used to infer it.
The hard core of an interaction, t, is akin to the distance threshold in classical object-based co-localization analysis. If two objects are closer to each other than this hard core, they are considered overlapping.
The length scale of an interaction, σ, quantifies the units of length in which the potential is scaled. It hence provides information about the length scale of organization between the two point patterns. The unit of length is pixels if the objects are detected from images. If coordinates are read from a file, the unit of length is as defined in that file.
Results and discussion
We validated and tested the plugin on synthetically generated point distributions in the presence and absence of interactions and confirmed that interactions were correctly detected (results not shown). We show here the application of the plugin to two real-world cases: interactions between viruses and endosomes in HER-911 cells as inferred from fluorescence confocal microscopy images, and clathrin-GPCR interactions as inferred from PALM super-resolution data in HeLa cells.
Application to virus-endosome interaction from confocal images
We apply the plugin to analyze the interactions between human adenoviruses of serotype 2 (Ad2), stained with ATTO-647, and Rab5-EGFP-stained endosomes in HER-911 cells (image data: Greber lab, University of Zurich). Similar data has also been used in Ref. .
Application to GPCR-clathrin interaction from PALM data
Super-resolution microscopy techniques such as PALM and STORM do not provide images, but produce point clouds by measuring the coordinates of individual fluorophores and their localization uncertainties. Directly working with these position data provides more information than first rendering an artificial image from them and then working with that image .
G-protein-coupled receptors (GPCRs) are important signaling proteins that are transported in clathrin-coated vesicles. The sizes of these vesicles are typically below the resolution limit of classical microscopy, rendering them a good system to be studied with super-resolution techniques like PALM and STORM.
We can either analyze the interactions between the individual molecules in one color channel with those in the other channel, or we may exploit the biological knowledge that the actual interaction acts at the organelle level rather than the molecular level. For the latter, we hence analyze the interactions between the centers of the detected clusters across the two color channels. For the sake of simplicity, we do not explicitly model localization uncertainty, registration errors, and limited detection efficiency.
The results corresponding to the parametric potential that provided the best fit (in this case an L1 linear potential) are shown in Figure 5. Figures 5c,d show the results of the analysis based on cluster centers, Figures 5e,f those based on individual molecules. In both cases, the residual fitting error is 5-fold lower than when using a step potential. Figures 5g,h show controls obtained by randomly scrambling the cluster-center locations. We see that: (1) the plugin correctly infers an interaction (estimated ε=1.85) in the data with cluster centers, but detects no interaction in the randomized control (ε=0.6; the null hypothesis of no interaction has rank 512 of 1000 and cannot be rejected). (2) The results when applying the analysis to individual molecules or to cluster centers are similar, with the former estimating ε=2.0, indicating that the analysis is robust against clustering effects and correctly identifies the length scale of the interaction. A randomization control based on individual molecules yields ε=0.3 (data not shown), and the null hypothesis of no interaction cannot be rejected (rank 202 of 1000). This indicates that analyzing interactions between organelles by considering their cluster centers, rather than individual molecules, may be sufficient to distinguish an interacting pattern from a non-interacting one. Analysis with other potential shapes provided similar results.
We presented MosaicIA, an ImageJ/Fiji plugin for spatial point pattern and interaction analysis. The plugin takes as an input two 2D or 3D images showing the spatial distributions of two sets of bright, spot-like objects, or it reads the coordinates of two sets of objects from files. It then uses a nearest-neighbor Gibbs interaction model from spatial statistics in order to infer the pair-wise interaction potential that is most likely to create the observed distribution of objects. Compared to classical pixel-based or object-based co-localization analysis, this makes better use of the information present in the image and hence provides superior statistical detection power . The analysis also accounts for the context created by the shape of the space within which the objects are distributed and by the object distribution within the reference set. Estimating interaction models is more robust against imaging noise and image-processing errors than classical co-localization analysis . Statistical tests are provided by the plugin in order to check the significance of an interaction. The estimated interaction parameters provide a quantitative way of comparing spatial patterns across different samples, conditions, and perturbations.
The plugin has been tested on both synthetic and real-world data. We demonstrated its application to virus trafficking data obtained with confocal fluorescence microscopy and to PALM super-resolution data of the interaction between clathrin and β2-AR. In the latter case, we compared the results from applying the analysis to individual points with the results obtained from cluster centers. In all tested cases, the best interaction potential explained the data 4 to 5-fold better than a step potential, i.e., than context-corrected object-based co-localization analysis. Without context correction, the fits would be even worse.
Despite the fact that we have here only demonstrated the plugin for fluorescence microscopy and PALM data, it can be applied to distributions of any type of objects (organelles, cells, organisms), as long as their positions can be extracted from images or read from files. For example, in the case of cells in a tissue, it can be applied with the help of segmentation methods that can provide the spatial location that best fits a cell . Comparing the model fits obtained with different parametric potentials can also be used to test and compare hypothetical interaction mechanisms directly on the data.
Future work includes extending the plugin to also handle extended objects that are not blob-like, and to explicitly account for localization uncertainties and registration (aberration) errors. Other useful extensions could be testing for spatial randomness within a single set of objects from the intra-set NN distance histogram, and automatic estimation of algorithm parameters from the data.
Availability and requirements
The present plugin is available as part of the MOSAICsuite for ImageJ and Fiji.
Project name: MosaicIA Project home page: http://mosaic.mpi-cbg.de/?q=downloads/imageJ Fiji update site:http://mosaic.mpi-cbg.de/Downloads/update/Fiji/MosaicToolsuiteOperating system(s): Linux, MacOS X, Windows Programming language: Java Other requirements: ImageJ or Fiji License: GNU LGPL v3. Please cite this paper as well as Ref.  in any publications that use this software. Any restrictions to use by non-academics: licenseneeded
We thank all members of the MOSAIC Group and the Radenovic lab for many fruitful discussions. In particular, we thank Grégory Paul and Jo Helmuth for sharing their expertise on spatial point statistics, and Janick Cardinale and Pietro Incardona for help with the software implementation. We thank Urs Greber (University of Zurich) for kindly providing the virus/endosome demo data and Paolo Annibale for kindly providing the PALM data and for discussions. AS was funded by an NCCBI PhD fellowship from the Swiss National Competence Center for Biomedical Imaging, jointly awarded to AR and IFS.
- Abramoff MD, Magelhaes PJ, Ram SJ: Image processing with ImageJ. Biophotonics Int. 2004, 11 (7): 36-42.Google Scholar
- Schindelin J, Arganda-Carreras I, Frise E, Kaynig V, Longair M, Pietzsch T, Preibisch S, Rueden C, Saalfeld S, Schmid B, Tinevez JY, White DJ, Hartenstein V, Eliceiri K, Tomancak P, Cardona A: Fiji: an open-source platform for biological-image analysis. Nature Methods. 2012, 9 (7): 676-682. 10.1038/nmeth.2019.View ArticlePubMedGoogle Scholar
- Mecke KR, Stoyan D: Statistical Physics and Spatial Statistics: the Art of Analyzing and Modeling Spatial Structures and Pattern Formation. 2000, Berlin, Heidelberg: Springer-VerlagView ArticleGoogle Scholar
- Diggle PJ: Statistical Analysis of Spatial Point Patterns. 2003, London: ArnoldGoogle Scholar
- Moller J, Waagepetersen RP: Statistical Inference and Simulation for Spatial Point Processes. 2003, Boca Raton, FL: Chapman Hall/CRCView ArticleGoogle Scholar
- Helmuth J, Paul G, Sbalzarini I: Beyond co-localization: inferring spatial interactions between sub-cellular structures from microscopy images. BMC Bioinformatics. 2010, 11: 372-10.1186/1471-2105-11-372.PubMed CentralView ArticlePubMedGoogle Scholar
- Bolte S, Cordeliéres FP: A guided tour into subcellular colocalization analysis in light microscopy. J Microsc. 2006, 224 (3): 213-232. 10.1111/j.1365-2818.2006.01706.x.View ArticlePubMedGoogle Scholar
- Betzig E, Patterson GH, Sougrat R, Lindwasser OW, Olenych S, Bonifacino JS, Davidson MW, Lippincott-Schwartz J, Hess HF: Imaging intracellular fluorescent proteins at nanometer resolution. Science. 2006, 313 (5793): 1642-1645. 10.1126/science.1127344.View ArticlePubMedGoogle Scholar
- Rust MJ, Bates M, Zhuang X: Sub-diffraction-limit imaging by stochastic optical reconstruction microscopy (STORM). Nat Methods. 2006, 3 (10): 793-796. 10.1038/nmeth929.PubMed CentralView ArticlePubMedGoogle Scholar
- Hess ST, Girirajan TP, Mason MD: Ultra-high resolution imaging by fluorescence photoactivation localization microscopy. Biophys J. 2006, 91 (11): 4258-4272. 10.1529/biophysj.106.091116.PubMed CentralView ArticlePubMedGoogle Scholar
- Baddeley D, Cannell MB, Soeller C: Visualization of localization microscopy data. Microsc Microanal. 2010, 16 (01): 64-72. 10.1017/S143192760999122X.View ArticlePubMedGoogle Scholar
- Lachmanovich E, Shvartsman DE, Malka Y, Botvin C, Henis YI, Weiss AM: Co-localization analysis of complex formation among membrane proteins by computerized fluorescence microscopy: application to immunofluorescence co-patching studies. J Microsc. 2003, 212 (2): 122-131. 10.1046/j.1365-2818.2003.01239.x.View ArticlePubMedGoogle Scholar
- Hall M, Frank E, Holmes G, Pfahringer B, Reutemann P, Witten IH: The WEKA data mining software: an update. SIGKDD Explor Newsl. 2009, 11: 10-18. 10.1145/1656274.1656278.View ArticleGoogle Scholar
- Hansen N, Ostermeier A: Completely derandomized self-adaptation in evolution strategies. Evol Computat. 2001, 9 (2): 159-195. 10.1162/106365601750190398.View ArticleGoogle Scholar
- Sbalzarini IF, Koumoutsakos P: Feature point tracking and trajectory analysis for video imaging in cell biology. J Struct Biol. 2005, 151 (2): 182-195. 10.1016/j.jsb.2005.06.002.View ArticlePubMedGoogle Scholar
- Silverman BW, Green PJ: Density Estimation for Statistics and Data Analysis. 1986, London: Chapman and HallView ArticleGoogle Scholar
- Cardinale J, Paul G, Sbalzarini IF: Discrete region competition for unknown numbers of connected regions. IEEE Trans Image Process. 2012, 21 (8): 3531-3545.View ArticlePubMedGoogle Scholar
- Paul G, Cardinale J, Sbalzarini IF: Coupling image restoration and segmentation: a generalized linear model/Bregman perspective. Intl J Comput Vis. 2013, 104 (1): 69-93. 10.1007/s11263-013-0615-2.View ArticleGoogle Scholar
- Annibale P, Scarselli M, Greco M, Radenovic A: Identification of the factors affecting co-localization precision for quantitative multicolor localization microscopy. Opt Nanoscopy. 2012, 1 (9): 1-13.Google Scholar
- Helmuth JA: Computational methods for analyzing and simulating intra-cellular transport processes. PhD thesis, Diss. ETH No. 19190, ETH Zürich; 2010Google Scholar
- Qu L, Long F, Liu X, Kim S, Myers E, Peng H: Simultaneous recognition and segmentation of cells: application in C.elegans. Bioinformatics. 2011, 27 (20): 2895-2902. 10.1093/bioinformatics/btr480. [http://bioinformatics.oxfordjournals.org/content/27/20/2895.abstract]PubMed CentralView ArticlePubMedGoogle Scholar
This article is published under license to BioMed Central Ltd. This is an Open Access article distributed under the terms of the Creative Commons Attribution License(http://creativecommons.org/licenses/by/2.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.