IPSDK 0.2
IPSDK : Image Processing Software Development Kit
Pearson Correlation Coefficient 2dSee full documentation
scalarpearsonCorrelationCoefficient2d (inImg1,inImg2)

Detailed Description

computes the Pearson correlation coefficient in the image

The Pearson correlation coefficient, also known as Pearson colocalization, is a linear correlation measure between the two input images InImg1 and InImg2. This coefficient is calculated with the following formula :

\[ PCC = \sum_{\textbf{x} \in \Omega}{\frac{ \left( InImg1[\textbf{x}] - \mu_1\right) \left( InImg2[\textbf{x}] - \mu_2\right)}{\sigma_1 \sigma_2}} \]

Where $\Omega$ is the image domain, $ \mu_i, i \in [1, 2]$ is the mean intensity of $InImg_i$ and $\sigma_i$ is its standard deviation.

Two wrappers can be called : the pearsonCorrelationCoefficient2d wrapper is only used to compute the Pearson coefficient on a grey level 2d image, whereas the multiSlice_pearsonCorrelationCoefficient2d wrapper must be used for more complex data (volume, sequence and/or color). In the second case, a coefficient is calculated for each 2d plan forming the input images.

This algorithm is equivalent to compute the sum on each 2d plan of the resulting image of Pearson colocalization mapping 2d.

See also
https://en.wikipedia.org/wiki/Pearson_correlation_coefficient

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLGlobalMeasure as glbmsr

Code Example

# Sample a single slice result
result = glbmsr.pearsonCorrelationCoefficient2d(inImg1, inImg2)
# Sample a multislice result
multislice_result = glbmsr.multiSlice_pearsonCorrelationCoefficient2d(inImg1, inImg2)

Example of C++ code :

Example informations

Header file

#include <IPSDKIPL/IPSDKIPLGlobalMeasure/Processor/PearsonCorrelationCoefficient2d/PearsonCorrelationCoefficient2d.h>

Code Example

// --------------------------------- Compute the Pearson colocalization a mono-slice grey level image ---------------------------------- //
const ipReal64 pearsonCorrCoeff = pearsonCorrelationCoefficient2d(pInImg1, pInImg2);
// ----------------------------------------------- Calculation on a multi-slice RGB image ---------------------------------------------- //
PlanIndexedPearsonCCResultPtr pPearsonCorrCoeff_MultiSlice = multiSlice_pearsonCorrelationCoefficient2d(pImg1_multiSlice, pImg2_multiSlice);