skimage2.measure.pearson_corr_coeff#
- skimage2.measure.pearson_corr_coeff(image0, image1, mask=None)[source]#
Calculate Pearsonâs Correlation Coefficient between pixel intensities in channels.
- Parameters:
- image0ndarray of shape (M, N)
Image of channel A.
- image1ndarray of shape (M, N)
Image of channel 2 to be correlated with channel B. Must have same dimensions as
image0.- mask(M, N) ndarray of dtype bool, optional
Only
image0andimage1pixels within this region of interest mask are included in the calculation. Must have same dimensions asimage0.
- Returns:
- pccfloat
Pearsonâs correlation coefficient of the pixel intensities between the two images, within the mask if provided.
- p-valuefloat
Two-tailed p-value.
Notes
Pearsonâs Correlation Coefficient (PCC) measures the linear correlation between the pixel intensities of the two images. Its value ranges from -1 for perfect linear anti-correlation to +1 for perfect linear correlation. The calculation of the p-value assumes that the intensities of pixels in each input image are normally distributed.
Scipyâs implementation of Pearsonâs correlation coefficient is used. Please refer to it for further information and caveats [1].
\[r = \frac{\sum (A_i - m_A_i) (B_i - m_B_i)} {\sqrt{\sum (A_i - m_A_i)^2 \sum (B_i - m_B_i)^2}}\]- where
\(A_i\) is the value of the \(i^{th}\) pixel in
image0\(B_i\) is the value of the \(i^{th}\) pixel inimage1, \(m_A_i\) is the mean of the pixel values inimage0\(m_B_i\) is the mean of the pixel values inimage1
A low PCC value does not necessarily mean that there is no correlation between the two channel intensities, just that there is no linear correlation. You may wish to plot the pixel intensities of each of the two channels in a 2D scatterplot and use Spearmanâs rank correlation if a non-linear correlation is visually identified [2]. Also consider if you are interested in correlation or co-occurence, in which case a method involving segmentation masks (e.g. MCC or intersection coefficient) may be more suitable [3] [4].
Providing the mask of only relevant sections of the image (e.g., cells, or particular cellular compartments) and removing noise is important as the PCC is sensitive to these measures [3] [4].
References
[3] (1,2)Dunn, K. W., Kamocka, M. M., & McDonald, J. H. (2011). A practical guide to evaluating colocalization in biological microscopy. American journal of physiology. Cell physiology, 300(4), C723âC742. https://doi.org/10.1152/ajpcell.00462.2010
[4] (1,2)Bolte, S. and CordeliÃĻres, F.P. (2006), A guided tour into subcellular colocalization analysis in light microscopy. Journal of Microscopy, 224: 213-232. https://doi.org/10.1111/j.1365-2818.2006.01706.x