Using Cellprofiler to count viral particles (I)

Another way to count particles is to use Cellprofiler. This is a better option if you want to save a workflow and apply it to 10s or 100s of images. It more or less does the same thing that ImageJ does, but the philosophy behind using Cellprofiler is slightly different. It was built to perform repetitive tasks on many thousands of images for high content image based screening. The idea is to develop and save an image analysis workflow (pipeline in cellprofiler parlance) using one or a few representative images and then apply this pipeline to the many thousands of images you have. Cellprofiler is highly modular. To develop a pipeline, you select from a set of modules each of which does one step of the pipeline. For example, the pipeline I developed starts with a “ColorToGrey” module that splits a color image into its respective colour channels. I have an RGB tiff file that contains DAPI staining in the blue channel, viral particle staining in the green channel and staining for viral replication factories in the red channel. So the first thing I have to do after loading the image is to split the colour information into individual channels. I’ll go through the details step by step below.

I developed a pipeline to count viral particles in images to demonstrate the ideas and concepts of using cellprofiler to process images, but it can do much much more.

Here’s my starting image:


Input Image

The blue channel shows DNA stained with DAPI, the green channel depicts the viral particles and the red channel is specific for a viral protein that is found in  the viral replication factories. The basic question is – How many green viral particles are in this image? This is a similar but distinct problem to counting nuclei in a field of cells. Because the fluorescence of the viral particles is different than nuclei, we’ll have to approach this problem similarly, but we should be prepared to change values to make the pipeline specifically detect the signal in the green channel that are viruses. Let’s see how we can solve this problem using Cellprofiler. These problems are often iterative. We’ll use this image to develop a pipeline by trying out various operations until we come up with a robust sequence that is successful for this image. Then we an apply the same pipeline to many other images we have where we want to extract the same information.





The Complete Analysis Pipeline

Cellprofiler creates a pipeline from its various submodules, each of which does one thing. The end result is that you get out the information you want from the series of individual operations applied sequentially to your image. You can see from the overview image to the left that the piprline I’ve created must take a colour image as an input because the first task I asked Cellprofiler to complete was to extract greyscale images from a colour image using the  “ColorToGray” module. After that, I added the two modules that calculate and then apply an illumination correction. Illumination correction is crucial for quantitative image analysis to correct for illumination inconsistencies across the field of view that are always present in fluorescence microscope images. These steps are ideally corrected using a technique called “flat fielding” that uses measured images from the same microscope system you use to take your images to correct the non-uniform illumination – but this is not often done, so Cellprofiler provides a means to correct for these non uniformities using data within the image. Finally all of the magic in this pipeline happens using the next module, “IdentifyPrimaryObjects”, which is the module that identifies viral particles using the pixel intensity values present in my green channel. Following this module are several modules that measure object intensity information (“MeasureObjectIntensity”, e.g. what is the summed intensity value for each object), measure morphological features about the objects (“MeasureObjectSizeShape”, e.g. what is the area of each object) and then uses this data to generate some example histograms for a couple of these features (“DisplayHistogram”). The output images are saved using the “SaveImages” module and finally, the measurement data from the measurement modules from each of the 3638 viral particles identified in this image are exported to a relational database manager (MySQL) locally running on my computer to allow subsequent interrogation of the data using Cellprofiler Analyst, a complementary product of Cellprofiler also developed and distributed by the Broad Institute that takes over from Cellprofiler after the image analysis is complete. It’s really designed for interactive data interrogation and exploration from high-throughput image based data.