This is the third post in this series of how to count viral particles with Cellprofiler. With the “ColorToGray” analysis module selected, the options in the image to the left are available for me to use to properly configure this module. I first select “StartingImage” from the popup menu that allows me to select the input image for this module. This popup menu will be present in every module that requires an input image and will autopopulate with the names that you assign from each module. In this case you can see that this module takes it’s input from the “NamesAndTypes” output. In the previous post I described how I used “StartingImage” as the assigned name for my image. Other settings described below:
- Conversion Method – either Split or Combine. Split is appropriate when your images are fluorescence images where each channel is a separate image representing a different fluor. Combine is appropriate when your images are, for example, images of colored yeast or bacterial colonies on a plate.
- Image Type – My image is an RGB image, so I chose that colour type.
- Convert red/green/blue to gray? – I only want to anaylyse the green channel, because that’s the colour that contains the image of the viral particles, so that’s the only one I chose to convert.
- Name the output image – I set the name of the output image to “OrigGreen” this will become the input image of the next module to calculate the illumination correction.
Importantly, when you’re developing your pipeline, Cellprofiler gives you the results from each module so you can see if your configuration settings led to the correct output. I’ll show you how to enable this feature later, but for now, here are the results after the pipeline has run the first analysis module. It shows the original colour input image on top and the green channel converted to gray on the bottom.
The next two modules in my pipeline calculate and then apply an illumination correction function to the virus containing image. For most fluorescence images this is a crucial step and should be done at acquisition using flat-fielding techniques to correct for illumination variability. The Cellprofiler website has some example pipelines and tutorials for common workflows. You can download a detailed pdf file describing the “Correct Illumination-Calculation” and “Correct Illumination – Apply” modules here. One thing to note is that upon import, Cellprofiler converts pixel intensity values to a scale from 0 to 1. So if you import an 8-bit image, each 1 of the 256 different possible gray levels will correspond to 1/256 or 0.0039 in the 0 to 1 scale. You’ll notice in the image below, the output from the “Correct Illumination-Calculation” module, that the summary statistics in the bottom right corner of the output indicate that the minimum value is 0.0 and the max value is 0.01. In the original 8-bit scale, 0.01 corresponds to 2.56 gray values. I know from completing the analysis that my virus particles have a mean intensity of 0.305 (78 on the 8-bit scale). I need to keep this in mind when I am calculating the illumination function. I don’t want to subtract, for example, more than 0.305 because then my viral particles would have intensity values near 0. I spent quite some time making adjustments to the different configuration settings before I was happy with my final illumination correction function. I’ll try to provide some insight into making these choices below.
Again, the “Select Input Image” is set to take the output from the previous module, in this case, an image I assigned a name of “OrigGreen”. The CorrectIllumination – Calculate module outputs an illumination function as an image that can be applied to images. This is a bit confusing, but essentially, you’re going to be using the OrigGreen image to both (i) calculate the illumination correction function in this module and (ii) be the input image for the function’s application in the next module – “CorrectIllumination -Apply”. Other settings are listed below.
- Select how the illumination function is calculated- This can be either “Background” or “Regular”. The use cases for each of these are described in the online help, accessed by clicking on the question mark button next to this field.
- Block Size – Break the image up into blocks this size and then calculate either the minimum in this block (when “Background” is selected) or the average (when “Regular” is selected)
- Rescale? – almost always yes when using the “Regular” method and no when using the “Background” method
- Calculate for each image, or as an average of all images?- depends on whether you have multiple images that should be more or less the same, or each image will yield a completely different background fucntion
- Smoothing method – can be helpful when “Each” is selected in the field above.
- Retain either of the intermediate images? – obvious what this does. Otherwise it doesn’t actually save the image after it has been used during the “CorrectIlluminationApply” module.
Here’s the output from my “CorrectIlluminationCalculate” module with the settings shown above.
The averaged and dilated images are shown (but not retained) as is the final illumination function and some statistical information about the output. Although it looks like a lot of background is subtracted when you look at the “Final Illumination Function” image, the max value subtracted is 0.01 as can be seen from the statistical summary. Given that my particles have a mean value of 0.305, a 0.01 background subtraction seems appropriate. The image gives you a general idea of the amount of subtraction that will happen at various points across the image.
And finally, here’s the result of subtracting, on a pixel by pixel basis, the illumination function from the original green image, using the settings shown in the final image of this post, detailing the settings I used in my “CorrectIlluminationApply” module. Because I had used the “Background” method for calculating my illumination correction function, I used the “subtraction” method to apply it. Notice that internally, the corrected image is now referred to as “CorrGreen”. This will become the input for the next module, “IdentifyPrimaryObjects”. You can read about how this works in the next post – Using Cellprofiler to Count Viral Particles (IV).