Microscopy Image Browser  1.233
All Classes Files Functions Variables Pages
calc_correlation.m File Reference

Calculate correlation coefficients for img, script to run from Correlation panel of im_browser. More...

Functions

function [
corr_coef , model ,

objMask ,
smooth_corr ,
granularity ,
roi_size ] = 
calc_correlation (img, img_mask, mode, type, slope_length, darkthres, dt, auto_thres, inv_sw, a_contrast, relative_to_frame, objMask)
 Calculate correlation coefficients for img, script to run from Correlation panel of im_browser. More...
 

Detailed Description

Calculate correlation coefficients for img, script to run from Correlation panel of im_browser.

Function Documentation

function [ corr_coef , model , objMask , smooth_corr , granularity , roi_size ] = calc_correlation (   img,
  img_mask,
  mode,
  type,
  slope_length,
  darkthres,
  dt,
  auto_thres,
  inv_sw,
  a_contrast,
  relative_to_frame,
  objMask 
)

Calculate correlation coefficients for img, script to run from Correlation panel of im_browser.

Parameters
img- stack of images (h,w,color_channel,frame)
img_mask- take only part of the original image into analysis. Mask(h,w) defines the area for analysis
mode- mode, Absolute, Relative (current-previous), Relative cummulative
type- type of correlation: Pearson, Overlap, Manders, Intersection...
slope_length- number of frames to be used for smoothing calculation
darkthres- object separation threshold, use 0 to analyse the whole image
dt- time between frames
auto_thres- [optional] automatic thresholding by Otsu's method switch: 0 - off, 1 - on
inv_sw- [optional] instead of correlation, return displacement, usually 1-minus-correlation
a_contrast- [optional] if not NaN, is used for adjust contrast individually for each roi box in each frame
relative_to_frame- [optional] frame number for absolute mode
objMask- [optional] provide object mask for analysis
Return values
corr_coef- vector with amplitudes of correlation coefficients
model- difference map, current_frame -minus- previous
objMask- object mask, generated with Otsu's method or with specified threshold value (darkthres)
smooth_corr- smoothed correlation coefficient with the window size=slope_length
granularity- granularity of the objMask
roi_size- size of the roi object in pixels

Types of coefficients:

  1. Pearson: Pearson colocalization coefficient, intensity based as
    figure;
    ax=gca;
    set(ax,'Visible','off');
    text(0.2,0.5,'$r_p = \frac{\sum((R_i-\bar{R})(G_i-\bar{G}))}{\sqrt{\sum{(R_i-\bar{R})^2\sum{(G_i-\bar{G})^2}}}}$','interpreter','latex','fontsize',14);
  2. Overlap, overlap, intensity based coefficient as
    figure;ax=gca;
    set(ax,'Visible','off');text(0.2,0.5,'$r_o = \frac{\sum{R_i \times
    G_i}}{\sqrt{\sum{R_i^2}\times\sum{G_i^2}}}$','interpreter','latex','fontsize',14);
  3. Manders, intensity based coefficient: M1 (current vs relative) and M2 (relative vs current) as
    figure;ax=gca;set(ax,'Visible','off');text(0.2,0.5,'$M_1 = \frac{\sum{G_{i,coloc}}}{\sum{G_i}}$','interpreter','latex','fontsize',14)
    figure;ax=gca;set(ax,'Visible','off');text(0.2,0.5,'$M_2 = \frac{\sum{R_{i,coloc}}}{\sum{R_i}}$','interpreter','latex','fontsize',14)
  4. Intersection coefficient, object based as
    figure;ax=gca;set(ax,'Visible','off');
    text(0.2,0.5,'$Rth_i =\Big\{ \frac{\mbox{0, if} R_i \le R_{bg}}{\mbox{1, if} R_i > R_{bg}} $','interpreter','latex','fontsize',14)
    text(0.2,0.3,'$I =\frac{\sum{Rth_i \cap Gth_i}}{\sum{Rth_i} + \sum{Gth_i} - \sum{Rth_i \cap Gth_i}} $','interpreter','latex','fontsize',14);
    ;
  5. Mask displacement, object based coefficient. Calculates displacement of the thresholded image as
    figure;ax=gca;set(ax,'Visible','off');
    text(0.02,0.5,'$Rth_i =\Big\{ \frac{\mbox{0, if} R_i \le R_{bg}}{\mbox{1, if} R_i > R_{bg}} $','interpreter','latex','fontsize',12)
    text(0.02,0.3,'$D_m =\frac{\sum{Rth_i \ominus Gth_i}}{\mbox{total number of pixels}}, \mbox{where }\ominus \mbox{is symmetric difference} $','interpreter','latex','fontsize',12);
  6. Image displacement, displacements of masks that are generated from the difference of compared images as
    • take difference between current and relative images
    • threshold the difference image with the provided parameter to generate two masks of displacement
    • take a union of both masks
    • calculate the coefficient as sum of mask's union / by total number of pixels in the area
      See Also
      ib_calcCorrelation, correlationAnalysis_script

Referenced by ib_calcCorrelation().

Here is the caller graph for this function: