Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Image processing, pt 2/3

The data

Tracking a kinase translocation reporter (KTR)

To assess the activity of kinases in single live cells, which can e.g. activate and deactivate proteins, researchers have developed kinase translocation reporters (KTRs). These are fluorescently tagged proteins (or protein domains) whose location inside the cell changes (translocates) depending on whether a specific kinase is active (see also figure 1 of Kudo et al.).

The paper Chavez-Abiega et al. presents an image analysis pipeline to analyze KTR signals from single cells (and uses it to study kinase behavior). We’ll use their data, and try to reproduce part of that analysis.

Diagram (left) and Fig 1b of Kudo et al. (right). When kinase activity is high, KTRs predominantly localize to the cytoplasm due to reduced nuclear localization signal and increased nuclear export signal, and vice versa.

Example of data analysis

Figure above. The data contain many timepoints. After observing the cells for some time, a stimulant was added (blue line) that activated a kinase was added. This is reflected by the fact that the ratio of cytoplasmic fluorescent intensity (C) over the nuclear fluorescent intensity (N) of the KTR sensor increases.

Loading KTR data

We do this the same way as before, but now we also load the intensity data from the KTR sensor, which is stored in the 3rd (i=2) channel.

<Figure size 640x480 with 1 Axes>

Now let’s also look at the data of the KTR sensor:

<Figure size 640x480 with 1 Axes>

Data analysis aims

We’re going to reproduce a small part of the analysis from the original paper.

Specifically, we want to be able to:

  • Identify the nuclei

  • Identify representative cytoplasm

  • Calculate intensity ratios

Background processing and correction

When calculating ratios, a background signal has an undesired contribution to the calculated ratio.

As this is the case, we want to correct for background artifacts in the intensity image.

Different approaches for different challenges

  • Globally uniform background

    • Subtract a constant estimate of the background

      • Common approaches:

        • use the mode

        • average of known background region

  • Spatially varying background

  • In case knowable/measurable background or shading effects (e.g. camera offset, uneven illumination)

    • Measure the artificial contribution

      • To counter camera offset ..

        • Dark image: image taken with no light, same exposure & camera settings

        • Alternative: blank image of an empty sample (e.g. slide + medium, no cells) → also captures glass/medium background

      • .. and uneven illumination

        • Flat image: image of a uniform sample (e.g. a dye solution), same optics/filters → captures location-dependent illumination

      • Combine as: corrected = (raw − dark) / (flat − dark) × mean(flat − dark)

Background subtraction using the mode

<Figure size 640x480 with 1 Axes>
(np.uint16(480), np.int64(480))
<Figure size 640x480 with 1 Axes>
<Figure size 640x480 with 1 Axes>
<Figure size 640x480 with 1 Axes>
<Figure size 640x480 with 1 Axes>

Obtaining a nuclear and cytoplasmic mask

To analyze the cytoplasm, we’ll take a small ring around the nucleus.

<Figure size 640x480 with 1 Axes>

What’s the ratio?

np.float64(0.5011731486917071)

But we want single object resolution!

Let’s look at how to analyze separate ROIs in an image.

Masks, labels and regions

Encode different ROIs: the labeled map

We’d like the computer to encode different ROIs. This can be done by using arrays of integer numbers, where 0 is the background and 1 .. N different ROIs of interest.

How to make such a map: connected components

A common way to create such a mask is to base it on the binary mask. Each foreground region (with a value of 1) that is surrounded by background (value 0), is given a unique number.

Let’s see this in action.

<Figure size 640x480 with 1 Axes>
[[ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0]
 [ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0]
 [ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0]
 [ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0]
 [ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0]
 [ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0]
 [ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0]
 [ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0]
 [ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0]
 [ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0]
 [ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0]
 [ 0  0  0  0  0  0  0  0  0 23  0  0  0  0  0  0  0  0  0  0]
 [ 0  0  0 23 23 23 23 23 23 23 23 23  0  0  0  0  0  0  0  0]
 [ 0 23 23 23 23 23 23 23 23 23 23 23  0  0  0  0  0  0  0  0]
 [23 23 23 23 23 23 23 23 23 23 23 23 23  0  0  0  0  0  0  0]
 [23 23 23 23 23 23 23 23 23 23 23 23 23 23 23  0  0  0  0  0]
 [23 23 23 23 23 23 23 23 23 23 23 23 23 23 23  0  0  0  0  0]
 [23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23  0  0  0  0]
 [23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23  0  0  0  0]
 [23 23 23 23 23 23 23 23 23 23 23 23 23 23 23  0  0  0  0  0]]
[[ 0  0  0  0  0  0  0  0  0  0  0 25 25 25 25 25 25 25 25 25]
 [ 0  0  0  0  0  0  0  0  0  0  0  0 25 25 25 25 25 25 25 25]
 [ 0  0  0  0  0  0  0  0  0  0  0  0 25 25 25 25 25 25 25 25]
 [ 0  0  0  0  0  0  0  0  0  0  0  0  0 25 25 25 25 25 25 25]
 [ 0  0  0  0  0  0  0  0  0  0  0  0  0 25 25 25 25 25 25 25]
 [ 0  0  0  0  0  0  0  0  0  0  0  0  0  0 25 25 25 25 25 25]
 [ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 25 25 25 25 25]
 [ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 25 25 25 25]
 [ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 25 25]
 [ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0]
 [ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 25]
 [ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 25]
 [ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0]
 [ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0]
 [ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0]
 [ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0]
 [ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0]
 [ 0  0  0  0  0 49 49 49 49  0  0  0  0  0  0  0  0  0  0  0]
 [ 0  0  0 49 49 49 49 49 49 49 49  0  0  0  0  0  0  0  0  0]
 [ 0 49 49 49 49 49 49 49 49 49 49 49  0  0  0  0  0  0  0  0]]

As you can see, different ROIs can now be easily identified by their unique number.

<Figure size 640x480 with 1 Axes>

This is great, we can now analyse single nuclei.

For our dataset however, we also want to have cytoplasm ROIs. We can use morphology operations on the labeled map to obtain these.

<Figure size 640x480 with 1 Axes>
Obtaining the C/N ratios

And we can use the labeled maps of the nuclei and cytoplasmic areas to access the corresponding KTR intensity values. This, in turn, allows us to calculate the ratio of KTR in cytoplasm versus the nuclei, which was what we’re interested in.

<Figure size 640x480 with 1 Axes>

Properties of regions (“connected components”)

Often, during an analysis, we’ll be interested in properties of the ROIs (e.g., what size are the nuclei?).

regionprops is a convenient function that gives access to a host of information based on labeled maps.

(0, 156, 22, 173)
270.0
<Figure size 640x480 with 1 Axes>

We can also map intensity data using the regionprops function. We can also calculate our ratios that way:

[np.float64(0.5376960963574011), np.float64(0.5567022853975222), np.float64(0.5620778235060323), np.float64(0.5349040191788493), np.float64(0.5941152087702692), np.float64(0.5287349711068803), np.float64(0.5271857178227263), np.float64(0.8759388038942976), np.float64(0.4086213144636655), np.float64(0.5080422794117647)]
[np.float64(0.5376960963574011), np.float64(0.5567022853975222), np.float64(0.5620778235060323), np.float64(0.5349040191788493), np.float64(0.5941152087702692), np.float64(0.5287349711068803), np.float64(0.5271857178227263), np.float64(0.8759388038942976), np.float64(0.4086213144636655), np.float64(0.5080422794117647)]

Exercise: Is there a relationship between nuclear size and C/N ratio?

Can you make a scatter plot to investigate this?

Optional exercise: Can you measure bacterial sizes?

<Figure size 640x480 with 1 Axes>

Can you think of ways to obtain one ROI (ie a labeled mask) for each of the bacteria? And then visualize the distribution of their sizes?

A labeled mask would e.g. look like the following image:

Note: this is probably rather challening. Don’t worry if you don’t manage.

References
  1. Kudo, T., Jeknić, S., Macklin, D. N., Akhter, S., Hughey, J. J., Regot, S., & Covert, M. W. (2017). Live-cell measurements of kinase activity in single cells using translocation reporters. Nature Protocols, 13(1), 155–169. 10.1038/nprot.2017.128
  2. Chavez-Abiega, S., Grönloh, M. L. B., Gadella, T. W. J., Bruggeman, F. J., & Goedhart, J. (2022). Single-cell imaging of ERK and Akt activation dynamics and heterogeneity induced by G-protein-coupled receptors. Journal of Cell Science, 135(6). 10.1242/jcs.259685