Nuclei and cells segmentation

Prerequisites

Before starting this lesson, you should be familiar with:

Learning Objectives

After completing this lesson, learners should be able to:
  • Segment cells and nuclei, using nuclei as seeds for watershed segmentation of the cells.

Motivation

It is quite common to have fluorescence microscopy images with stainings for both nuclei and cytoplasm. While nuclei are typically separate and thus easy to segment, cells are often touching each other, which makes their segmentation much more challenging. The workflow presented in this module is a common approach to tackle this challenge and thus very useful to know.

Concept map

graph TD N("Nuclei") --> NM("Nuclei label mask") C("Cells") --> W("Watershed transform") NM -->|seeds| W W --> S("Cells label mask")



Figure


Workflow for nuclei and cell segmentation using marker-controlled watershed (magenta - H2B-mCherry; green - GFP-tubulin). The nuclei mask is used to define the seeds/markers, the tubulin-channel is used to define the overall cells boundaries, finally the inverted intensity image is used for the watershed transform (i.e. flooding).



Activities


Show activity for:  

ImageJ Macro

/*
 * Nuclei and cells segmentation in Fiji
 * 
 * Requirements: 
 * - IJPB-Plugins update site
 */

run("Close All");
setOption("BlackBackground", true);


// open the images
open("https://github.com/NEUBIAS/training-resources/raw/master/image_data/xyc_16bit__nuclei_tubulin_crop.tif");
run("Duplicate...", "duplicate title=input");
run("Split Channels", "keep");
run("Grays");
selectWindow("C1-input");
rename("cells");
run("Grays");
selectWindow("C2-input");
rename("nuclei");
run("Grays");

// segment nuclei
selectWindow("nuclei");
run("Duplicate...", "title=nuclei-binary");
run("Median...", "radius=5");
setThreshold(33089, 65535);
run("Convert to Mask");
run("Connected Components Labeling", "connectivity=4 type=[8 bits]");
run("glasbey_on_dark");
rename("nuclei-labels");

// smooth cells
selectWindow("cells");
run("Duplicate...", "title=cells-smooth");
run("Mean...", "radius=3");

// create cells binary mask
run("Duplicate...", "title=cells-binary");
setThreshold(33565, 65535);
run("Convert to Mask");

// perform seeded watershed on inverted and smoothed cell signal
selectWindow("cells-smooth");
run("Duplicate...", "title=cells-smooth-invert");
run("Invert");
run("Marker-controlled Watershed", "input=cells-smooth-invert marker=nuclei-binary mask=cells-binary compactness=0 binary use");
rename("watershed-segmentation");

// remove border cells and change LUT
run("Remove Border Labels", "left right top bottom");
rename("cell-labels")
run("glasbey_on_dark");

// overlay on input image
selectWindow("cells");
run("Enhance Contrast", "saturated=0.35");
run("Add Image...", "image=cell-labels x=0 y=0 opacity=40");;

run("Tile");



Assessment

Discuss with your neighbour

  1. For a marker controlled watershed what will happen if you remove seeds touching the boundary before the watershed transform?
  2. Can you use the cell-mask, instead of the intensity image, for the watershed transform?

Solution

  1. This is not a good idea as you may not be able to find all cells and properly separate those. For instance merged cells may still touch the boundary.
  2. Apply a distance transform to the cell-mask and apply the watershed transform on its inverse.

True or false?

  1. For cell segmentation with a watershed transform one always needs nuclei as seeds.
  2. Nuclei are less likely to touch each other than cells.
  3. For a watershed transform, it is very important to image the cytoplasmic signal at the highest resolution.

Solution

  1. False; if the cellular signal happens to, e.g., be very dim in the cell center and bright at the cell boundaries one may try directly using it as an input to a watershed transform.
  2. True; nuclei have the cytoplasm around them, which often creates a spatial gap between neighbouring nuclei, making them easier to segment
  3. False; in fact, typically, the blurrier this signal is the better it is suited for separating cells using the watershed transform.

Explanations




Follow-up material

Recommended follow-up modules:

Learn more: