Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs/images move move docs to the tutorial folder May 25, 2017
images add 3d tutorial May 10, 2017
3d_monolayer_final.cppipe Update 3D tutorial to 3.0 rc7 Oct 3, 2017 First pass updates to final pipeline Dec 8, 2017
metadata.csv add 3d tutorial May 10, 2017

CellProfiler Tutorial: 3d monolayer

Organizing and importing images

Z-stacks as TIFFs

  • CellProfiler 3D currently only works with TIFF files. TIFF files can be rather complicated, having hyper-stack structures with all channels and z-planes in a single file. The acceptable CellProfiler format for storing z-stacks is to have a separate TIFF file for each channel.
  • ImageJ or FIJI can be used to create TIFF stacks. Scripting can be used to create TIFF stacks.

Importing data in CellProfiler

  1. Highlight the Images module.
  2. Drag-and-drop the images you will analyze into the Images module window.
  3. Highlight the Metadata module.
  4. Enter the following regular expression ^(?P<Plate>.*)_xy(?P<Site>[0-9])_ch(?P<ChannelNumber>[0-9]). This regular expression will parse the filenames and organize the data.
  5. Highlight the NamesAndTypes module.
  6. Choose “Process as 3D”
  7. Populate the fields for voxel size.
  • Fiji > Image > Show Info… (Ctrl + I)
  • Search for something like “Voxel size” or record this metadata when collecting own images
  • The actual units do not matter, rather their relative proportion. The numbers are unitless and therefore the decimal place does not matter.
  1. Add three images to NamesAndTypes and give them "variable names" that describe the contents in the image. For example, use the name dna or dapi to describe an image stained with DAPI.

Find objects: nuclei

Image preparation

Before attempting to segement the cells in the images, conditioning the images with filters and various image processing methods will improve the results.

  1. Add a RescaleIntensity module for each channel. It is a good practice to rescale images when processing them in CellProfiler. This standardizes the input in a way that makes processing images more reproducible and suppresses experimental variation and batch effects in cases where those are significant. A RescaleIntensity module is needed for each channel, so there should be three of them.


  2. Add a Resize module. Processing 3D images requires much more computation time than 2D images. Often, downsampling an image can yield large performance gains and at the same time smoothen an image to remove noise. If the objects of interest are relatively large compared to the pixel size, then segmentation results will be minimally affected the final segmentation. Choose a value of 0.5.


  3. Add a MedianFilter module. A median filter will homogenize the signal within the nucleus and reduce noise in the background. DNA is not uniformly distributed throughout the nucleus, which can lead to holes forming in the downstream object identification. A median filter will preserve boundaries better than other smoothing filters such as the Gaussian filter. Choose a filter size of 5. This number was chosen empirically: it is smaller than the diameter of a typical nucleus; it is small enough that nuclei aren't merged together, yet large enough to suppress over-segmentation of the nuclei.



  1. Add an Threshold module. This will separate the foreground (nuclei) from the background.


  2. Add a RemoveHoles module. This module implements an algorithm that will remove small holes within the nucleus. Any remaining holes will contribute to over-segmentation of the nuclei. Choose a size of 20.


  3. Add a Watershed module. This module implements the watershed algorithm, which will segment the nuclei. For more information on the watershed algorithm refer to this helpful MATLAB blog post.


  4. Add a ResizeObjects module to return the segmented nuclei to the size of the original image. Since the original image was scaled down by 0.5, it must be scaled up by 2. The output of this module is the nuclei we are seeking, so name these objects accordingly, e.g. Nuclei.


Find objects: cells

Now that we've segmented the nuclei we want to segment the cytoplasm for each nuclei whose boundaries are defined by the membrane channel. The membrane channel presents more of a challenge, because unlike the nuclei, the membrane signal is variable and the boundaries are connected together in a sort of mesh. This challenge is mitigated by the fact that the location of the nuclei can be used to help identify regions with cells.

Transform nuclei into markers

  1. Add a ConvertObjectsToImage module and convert the output from the Watershed module.


  2. Shrink the nuclei to make them more seed-like by adding an Erosion module. Use the disk structuring element with a size of 5. The output of this module will be referred to as Erosion.


Transform the membrane channel into cytoplasm signal

The Watershed module finds objects that have bright signal, so the cytoplasm that will define the cell volume should have bright signal. However, this is not the case in the membrane channel; it must be transformed into an image where the cytoplasm is bright and the boundaries between the cells are dark. Therefore, we will invert the membrane channel to achieve this effect.

  1. Add an Threshold module Threshold the rescaled membrane image.


  2. Add an ImageMath module. Within the ImageMath module choose the Invert operation, and invert the tresholded membrane.


  3. Add a RemoveHoles module, again. Choose a size of 20. This result will be referred to as the Inverted Membrane.


    We cannot use the inverted membrane image as the cytoplasm just yet. The space above and the below the monolayer is also of high signal. The Watershed module cannot distinguish that this is not cytoplasm, so it will have to be removed. To do this we will take advantage of the signal across all channels to define the boundaries of the monolayer.

  4. Add another ImageMath module. Add all of the rescaled images together. This image will be referred to as the Monolayer


  5. Add a Closing module. Choose a size of 17 to blend the signal together. The result should look like a cloud of signal where the monolayer resides.


  6. Add an ApplyThreshold module and threshold the smoothened monolayer image. This will define what is and is not monolayer. Note that the space above and below the monolayer is primarily black.


    Now we will combine the information from the membrane channel with what we identified as the monolayer. We will do this by subtracting the NOT-monolayer region, i.e. the background above and below the monolayer, from the image that defines the cytoplasm of the cells.

  7. Add an ImageMath module and invert the thresholded monolayer. This image will be referred to as the background.


  8. Add another ImageMath module and subtract the background image from the inverted membrane image which was created earlier in the pipeline, the output of the second Remove holes module. The result of the image subtraction will be referred to as the Cytoplasm.


  9. Add a Watershed module. The input is the result of the previous ImageMath module or the Cytoplasm. Change the Generate from option to Markers. The Markers will be the Seeds image, which is the output of the Erosion module. Finally, set the Mask to also be the Cytoplasm. This will help preserve the cell boundaries.


Creating visuals

Congratulations! The nuclei and cells have been segmented in this monolayer. Visuals that reveal the details of the segmentation can be also be created within CellProfiler. The following steps will produce an image where the nuclei are pseudo-colored according to the segmentation and look like jelly beans.

  1. Add a OverlayObjects module to the pipeline. The input will be the rescaled DNA image. Choose the Nuclei as the objects.


  2. Add a SaveImages module. Save the output from the previous module.

After running these last two modules an output image will be created and saved to the output directory. Use FIJI to inspect the this image.

Thank you for completing the 3d monolayer tutorial!

You can’t perform that action at this time.