Colocalization Analysis

View on GitHub

This program computes colocalization characteristics of two channels, optionally using a third channel to define a sub-region of interest. The binary image defining the colocalized image region is added to the input image. If the binary sub-region of interest isn't the whole image, it is added to the input image too. The channels are named "colocalization of channels A and B" and "ROI used with colocalization of channels A and B", where A and B are the original channel names. The specific SimpleITK expressions used to create these channels appear in the channel description. The output includes a single or multiple comma-separated-value file(s) with the values for each of the characteristics. Optionally, corresponding graphs are saved using output format(s) selected by the user.

Usage of channel names to identify the channels allows batch processing of images where corresponding channels do not have the same index. For example CD3 may be in channel 0 in one image and in channel 3 in another.

Note: Repeated channel names in a file are considered invalid and the file will not be analyzed (e.g. Nuclei is the name of channels 0 and 2).

For an overview of colocalization analysis in the context of fluorescence microscopy see:

The characteristics include (open the settings dialog to select which characteristics to compute, default is all):

  1. Percentage image colocalized, $\frac{N_{Colocalized}}{N_{Image}}$.
  2. Percentage of channel colocalized, $\frac{N_{Colocalized}}{N_{ChannelSelected}}$.
  3. Percentage colocalized in ROI, $\frac{N_{ROIColocalized}}{N_{ROI}}$.
  4. Percentage of material colocalized, $\frac{I_{ColocalizedChannelSelected}}{I_{ChannelSelected}}$.
  5. Percentage of material colocalized in ROI $\frac{I_{ROIColocalizedChannelSelected}}{I_{ROIChannelSelected}}$.
  6. Manders coefficient.
  7. Manders coefficient in ROI.
  8. Pearson correlation coefficient.
  9. Pearson correlation coefficient in colocalization.
  10. Pearson correlation coefficient in ROI.
  11. Spearman correlation coefficient.
  12. Spearman correlation coefficient in colocalization.
  13. Spearman correlation coefficient in ROI.

Where:

In addition to the above characteristics, the number and sizes of connected components (objects) that were colocalized is reported for the entire volume and those that are in the ROI. This information is useful to determine if colocalization is occurring in large structures or small ones and if the threshold selections are appropriate, based on the expected number of objects and their sizes.

SimpleITK expressions are used to define binary masks, regions of interest. These can be trivial expressions such as simple thresholding or complex expressions which take into account object sizes and possibly distances from the objects. If no expression is provided all of the voxels are used when computing the colocalization characteristics.

One can either type an expression in the "Mask expression" text box or use the "Preset mask expressions" to pre-populate the textbox and then edit it if needed (e.g. setting specific values for thresholds etc.).

The program enables batch colocalization and comparison. When analyzing images (2D or 3D) that have a single time-point the output is a single csv file with all of the computed characteristics and a corresponding bar graph. When analyzing images that have multiple time-points the output is a single csv file per input image and a line graph per variable.

Examples of useful expressions

To define the objects of interest in the two channels and the sub-region of interest we use SimpleITK expressions that yield binary masks. Below are various options for creating these binary masks ordered according to their complexity:

  1. Binary mask using a simple threshold:

    [i] > 150
  2. Binary mask using the Otsu thresholding filter. Additional thresholding filters available in SimpleITK include TriangleThreshold, HuangThreshold and MaximumEntropyThreshold (for details, see the SimpleITK documentation):

    sitk.OtsuThreshold([i], 0, 1)
  3. Binary mask, intensities inside a range of values:

    sitk.BinaryThreshold([i], lowerThreshold=50, upperThreshold=150)
  4. Rectangular binary mask, a 30x20x5 rectangular region of interest spanning indexes [5:35, 10:30, 0:5]:

    sitk.Paste([i]*0, sitk.Image([30,20,5],[i].GetPixelID())+1, sourceSize=[30,20,5], sourceIndex=[0,0,0], destinationIndex=[5,10,0])
  5. Binary mask via thresholding and only retaining the largest connected component. Threshold the channel, get all connected components, then sort the components according to size, discarding those smaller than a minimum size and create a binary mask corresponding to the largest component, which has a label value of 1 (second largest component label is 2 etc.):

    sitk.RelabelComponent(sitk.ConnectedComponent([i]>100), minimumObjectSize = 50)==1
  6. Binary mask via thresholding and only retaining connected components larger than a minimal object size in voxels. Threshold a specific channel, get all connected components, then sort the components according to size, discarding those smaller than a minimum size and create a binary mask from them (one can readily replace the single threshold with the expression denoting a range of values given above):

    sitk.RelabelComponent(sitk.ConnectedComponent([i]>100), minimumObjectSize = 50)!=0
  7. Binary mask via thresholding and then enlarging the mask to include all voxels that are less than 5nm from the original mask (dilation operation).

    sitk.Abs(sitk.SignedMaurerDistanceMap(sitk.BinaryThreshold([i], lowerThreshold=50, upperThreshold=150),
                                          insideIsPositive=False, squaredDistance=False,
                                          useImageSpacing=True)) <= 5.0