MosaicIA: an ImageJ/Fiji plugin for spatial pattern and interaction analysis
 Arun Shivanandan^{2, 3},
 Aleksandra Radenovic^{3} and
 Ivo F Sbalzarini^{1, 2}Email author
DOI: 10.1186/1471210514349
© Shivanandan et al.; licensee BioMed Central Ltd. 2013
Received: 29 May 2013
Accepted: 8 November 2013
Published: 3 December 2013
Abstract
Background
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 colocalization analysis to spatial interaction analysis. However, no userfriendly software for this type of analysis was available so far.
Results
We present an ImageJ/Fiji plugin that implements the complete workflow of spatial pattern and interaction analysis for spotlike 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 singlemolecule microscopy.
Conclusions
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.
Keywords
Spatial pattern analysis Microscopy Colocalization analysis Interaction analysis PALM ImageJ Fiji Image analysisBackground
We present a software plugin to analyze and quantify spatial patterns of objects in images using the free opensource imageprocessing platform ImageJ [1] or its distribution Fiji [2]. The spatial arrangement of objects relative to each other is a rich source of phenotypic information. This ranges from spatial patterns of subcellular 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 [35]. 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 [6].
Biology has long relied on colocalization analysis in order to quantify the spatial distribution of one set of objects with respect to another one. This includes pixelbased and objectbased colocalization analysis methods [7]. Pixelbased methods typically use a correlation measure between the pixel intensities in different images in order to quantify the degree of overlap or colocalization between the object distributions represented in the images. Objectbased methods first detect and delineate the objects of interest in the images and then quantify their degree of colocalization using an overlap measure. While pixelbased 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 PhotoActivation Localization Microscopy (PALM) and STochastic Optical Reconstruction Microscopy (STORM) [810], it is not obvious what constitutes an image [11], as these methods provide locations and localization uncertainties of individual molecules. Pixelbased 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. Objectbased 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 diffractionlimited data [12]. Singlemolecule imaging, like PALM and STORM, directly provides point locations, rendering a separate objectdetection step unnecessary.
While colocalization analysis captures the amount of overlap between objects, it is not sufficient to describe spatial patterns and interactions [6]. Also, colocalization 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 colocalization 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 distancedependent 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 contextcorrected version of traditional thresholdbased colocalization measure is recovered [6]. 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 piecewise linear nonparametric function is used. Plots of the different parametric potential shapes provided by the plugin are shown in Figure 1d.
Implementation
The plugin is written in Java. It uses the opensource Java library Weka [13] for efficiently computing NN distances using kdtrees and for kernel density estimation of probability distributions. The plugin further uses CMAES (the Covariance Matrix Adaptation Evolution Strategy) [14] for parameter optimization. This optimizer is less prone to get stuck in local optima than the simplex method used in the original publication [6]. 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 [6]. In order to work with nonpoint objects in the present plugin, they can be segmented using other software, e.g. the Region Competition plugin for ImageJ [17], 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 dropdown menu. Both parametric and nonparametric functions are provided. The plugin then estimates the potential or its parameters from the data by minimizing the ℓ^{2} difference $\parallel \widehat{p}\left(d\right)p\left(d\right){\parallel}_{2}$ between the observed NN distance distribution $\widehat{p}\left(d\right)$ 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 $\widehat{p}\left(d\right),p\left(d\right)$, 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 α[6].
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 imageprocessing part of the plugin. The algorithm used to detect bright objects (blobs) in the images and extract their location is described in Ref. [15]. See this reference for a more indepth 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 cutoff for falsepositive 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 subpixel 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 timeconsuming 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 $\widehat{p}\left(d\right)$. The value of this parameter is critical, and a rough estimate for it is computed using Silverman’s rule [16]. 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 finegrained, less smooth fit.
List of potentials provided
The plugin provides both parametric and nonparametric potentials that can be used to describe an interaction. The nonparametric 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 nonparametric 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.
Parametric potentials
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:

Step potential:${f}^{\text{st}}\left(r\right)=\left\{\begin{array}{ll}1& \text{if}\phantom{\rule{1em}{0ex}}r<0\\ 0& \text{else}.\end{array}\right.$(2)

Hernquist potential:${f}^{\text{he}}\left(r\right)=\left\{\begin{array}{ll}{(r+1)}^{1}& \text{if}\phantom{\rule{1em}{0ex}}r>0\\ (1r)& \text{else}.\end{array}\right.$(3)

Linear potential, type 1:${f}^{\text{l}1}\left(r\right)=\left\{\begin{array}{ll}0& \text{if}\phantom{\rule{1em}{0ex}}r>1\\ (1r)& \text{else}.\end{array}\right.$(4)

Linear potential, type 2:${f}^{\text{l}2}\left(r\right)=\left\{\begin{array}{ll}0& \text{if}\phantom{\rule{1em}{0ex}}r>1\\ 1& \text{if}\phantom{\rule{1em}{0ex}}r<0\\ (1r)& \text{else}.\end{array}\right.$(5)

Plummer potential:${f}^{\text{pl}}\left(r\right)=\left\{\begin{array}{ll}{\left({r}^{2}+1\right)}^{0.5}& \text{if}\phantom{\rule{1em}{0ex}}r>0\\ 1& \text{else}.\end{array}\right.$(6)
Plots of these potentials are shown in Figure 1d. Other potentials can easily be implemented, if needed.
Nonparametric potential
The nonparametric 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 bloblike, or for which the objectdetection step of the plugin does not work well. These objects can be detected and segmented using any other tool, e.g. the Region Competition [17] or the splitBregman/Squassh [18] plugins for ImageJ/Fiji, and their coordinates stored in a file. A commaseparated 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. noninteracting, 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 objectbased colocalization 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 realworld cases: interactions between viruses and endosomes in HER911 cells as inferred from fluorescence confocal microscopy images, and clathrinGPCR interactions as inferred from PALM superresolution data in HeLa cells.
Application to virusendosome interaction from confocal images
We apply the plugin to analyze the interactions between human adenoviruses of serotype 2 (Ad2), stained with ATTO647, and Rab5EGFPstained endosomes in HER911 cells (image data: Greber lab, University of Zurich). Similar data has also been used in Ref. [6].
Application to GPCRclathrin interaction from PALM data
Superresolution 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 [11].
Gproteincoupled receptors (GPCRs) are important signaling proteins that are transported in clathrincoated vesicles. The sizes of these vesicles are typically below the resolution limit of classical microscopy, rendering them a good system to be studied with superresolution 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 5fold lower than when using a step potential. Figures 5g,h show controls obtained by randomly scrambling the clustercenter 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 noninteracting one. Analysis with other potential shapes provided similar results.
Conclusions
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, spotlike objects, or it reads the coordinates of two sets of objects from files. It then uses a nearestneighbor Gibbs interaction model from spatial statistics in order to infer the pairwise interaction potential that is most likely to create the observed distribution of objects. Compared to classical pixelbased or objectbased colocalization analysis, this makes better use of the information present in the image and hence provides superior statistical detection power [6]. 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 imageprocessing errors than classical colocalization analysis [20]. 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 realworld data. We demonstrated its application to virus trafficking data obtained with confocal fluorescence microscopy and to PALM superresolution data of the interaction between clathrin and β2AR. 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 5fold better than a step potential, i.e., than contextcorrected objectbased colocalization 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 [21]. 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 bloblike, 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 intraset 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.mpicbg.de/?q=downloads/imageJ Fiji update site:http://mosaic.mpicbg.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. [6] in any publications that use this software. Any restrictions to use by nonacademics: licenseneeded
Declarations
Acknowledgements
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.
Authors’ Affiliations
References
 Abramoff MD, Magelhaes PJ, Ram SJ: Image processing with ImageJ. Biophotonics Int. 2004, 11 (7): 3642.Google Scholar
 Schindelin J, ArgandaCarreras 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 opensource platform for biologicalimage analysis. Nature Methods. 2012, 9 (7): 676682. 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: SpringerVerlagView 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 colocalization: inferring spatial interactions between subcellular structures from microscopy images. BMC Bioinformatics. 2010, 11: 37210.1186/1471210511372.PubMed CentralView ArticlePubMedGoogle Scholar
 Bolte S, Cordeliéres FP: A guided tour into subcellular colocalization analysis in light microscopy. J Microsc. 2006, 224 (3): 213232. 10.1111/j.13652818.2006.01706.x.View ArticlePubMedGoogle Scholar
 Betzig E, Patterson GH, Sougrat R, Lindwasser OW, Olenych S, Bonifacino JS, Davidson MW, LippincottSchwartz J, Hess HF: Imaging intracellular fluorescent proteins at nanometer resolution. Science. 2006, 313 (5793): 16421645. 10.1126/science.1127344.View ArticlePubMedGoogle Scholar
 Rust MJ, Bates M, Zhuang X: Subdiffractionlimit imaging by stochastic optical reconstruction microscopy (STORM). Nat Methods. 2006, 3 (10): 793796. 10.1038/nmeth929.PubMed CentralView ArticlePubMedGoogle Scholar
 Hess ST, Girirajan TP, Mason MD: Ultrahigh resolution imaging by fluorescence photoactivation localization microscopy. Biophys J. 2006, 91 (11): 42584272. 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): 6472. 10.1017/S143192760999122X.View ArticlePubMedGoogle Scholar
 Lachmanovich E, Shvartsman DE, Malka Y, Botvin C, Henis YI, Weiss AM: Colocalization analysis of complex formation among membrane proteins by computerized fluorescence microscopy: application to immunofluorescence copatching studies. J Microsc. 2003, 212 (2): 122131. 10.1046/j.13652818.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: 1018. 10.1145/1656274.1656278.View ArticleGoogle Scholar
 Hansen N, Ostermeier A: Completely derandomized selfadaptation in evolution strategies. Evol Computat. 2001, 9 (2): 159195. 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): 182195. 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): 35313545.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): 6993. 10.1007/s1126301306152.View ArticleGoogle Scholar
 Annibale P, Scarselli M, Greco M, Radenovic A: Identification of the factors affecting colocalization precision for quantitative multicolor localization microscopy. Opt Nanoscopy. 2012, 1 (9): 113.Google Scholar
 Helmuth JA: Computational methods for analyzing and simulating intracellular 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): 28952902. 10.1093/bioinformatics/btr480. [http://bioinformatics.oxfordjournals.org/content/27/20/2895.abstract]PubMed CentralView ArticlePubMedGoogle Scholar
Copyright
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.