# Colocalization and Distance Measurements of Objects in Fluorescence Microscopy

Summary:

1. SimpleITK provides a large number of filters that enable segmentation and quantification of the segmented objects characteristics and spatial relationships between the objects.

This notebook will illustrate the construction of a SimpleITK based analysis workflow in which we quantify the colocalization of two markers (FITC and Cy3) and the distance between the protein blobs these define to the nucleus blob(s) defined by a third marker (DAPI).

The image we work with was obtained by 3D Structured Illumination Microscopy (3D-SIM) and is provided courtesy of the Etienne Leygue lab at CancerCare Manitoba and The Genomic Centre for Cancer Research and Diagnosis.

In [1]:
import SimpleITK as sitk
import numpy as np
import pandas as pd

%matplotlib notebook
import gui

from IPython.core.display import display, HTML

# Always write output to a separate directory, we don't want to pollute the source directory.
import os
OUTPUT_DIR = 'Output'


Load the 3D multi channel structured illumination microscopy image, split it into the separate channels and display them.

In [2]:
sim_image = sitk.ReadImage(fdata('microscopy_colocalization.nrrd'))

#Our original image was saved using mm as the unit size, but in microscopy the more common unit is um.
#We modify the size so that it is in um. If your image is in um you won't have to perform this modification.
sim_image.SetSpacing([spc*1000 for spc in sim_image.GetSpacing()])
sim_image.SetOrigin([org*1000 for org in sim_image.GetOrigin()])

# The channel name appears in the image's meta-data dictionary with key: channel_i_name
channel_titles = [sim_image.GetMetaData('channel_{0}_name'.format(i)) for i in range(sim_image.GetNumberOfComponentsPerPixel())]
channels = [sitk.VectorIndexSelectionCast(sim_image,i)
for i in range(sim_image.GetNumberOfComponentsPerPixel())]
fitc_image = channels[channel_titles.index('FITC')]
cy3_image = channels[channel_titles.index('Cy3')]
dapi_image = channels[channel_titles.index('DAPI')]

gui.MultiImageDisplay(image_list=channels, title_list=channel_titles, shared_slider=True,
intensity_slider_range_percentile=[0,100],
figure_size=(20,10));

Fetching microscopy_colocalization.nrrd