Measuring E. coli colony size

Dear all,

I have a taken series of photos, on a stereoscope, from plates with fluorescent E. coli. The colonies formed by E. coli vary markedly in size and often I can visually identify up to 3 different sizes. I have been trying to use cellprofiler to automatise this process and to get size distributions. I have attached the pipeline I have been using (Ramiro_09102013_Ecoli.cp), which is derived from the ExampleYeastColonies_BT.cp and have also attached the input files (test_input) and the OutlinedColonies image.

The main problem that I am encountering is that the program seems to be oversplitting the colonies. I can reduce oversplitting by changing two settings on the module IdentifyPrimaryObjects to: 1) “Method to distinguish clumped objects” to Shape and 2) “Method to draw dividing lines between clumped objects” to Intensity. However, while this reduces oversplitting, I still get it for some of the colonies. Would you know how I can reduce/eleminate overspliting?

Moreover, I have a few other questions:

  1. some of my colonies are at the edges of the image - is there a way to eliminate these from the analysis?
  2. is it possible to measure the intensity of white? (as this is related to how fluorescent my bacteria are)

thanks for any help,

Ricardo (306 KB)

Hi Ricardo,

First, I don’t see the raw images in your zip file. There is nothing named “test_input” or have “00000” in them. There are two images but both have outlines already. Would you post these (it looks like you have 3 channels)?

The size exclusion issue is sometimes hard, unfortunately. You can try turning off “declumping” altogether in IDPrim (“Method to distinguish… = None”), but of course the colonies might be too clumped then. One way to help this is to lightly smooth the image (using the module Smooth), so that any local image variances, and their associated oversplitting are minimized. But I can’t test this without the raw images.

[quote]1) some of my colonies are at the edges of the image - is there a way to eliminate these from the analysis?

In IdentifyPrimaryObjects you have “Discard objects touching the border of the image” checked, so that is good. Any colonies touching the border in this module should be colored yellow and will not be analyzed downstream. Is that not the case?

[quote]2) is it possible to measure the intensity of white? (as this is related to how fluorescent my bacteria are)

You are measuring object intensity already, but I guess you are concerned about measuring the “SubtractedRed” versus the combined RGB channels? Assuming that the RGB are channels have equal intensity (again, I can’t tell without the images), my suggestion is to avoid RGB altogether and try and have your scope export as grayscale. Then there is not issue and it would simplify your pipeline too. If you care about the color content, then I’ll take a look at the images.


hi David,

Thanks for the reply. Sorry that I made a mistake with the file I sent. I have now uploaded the correct one. If you could have a look, that would be great.

I tried to insert the smooth module before the IdentifyPrimaryObjects, but this lead to the program failing to identify the smaller colonies.

If this problem is not solvable, is it possible to either:

  1. manually edit the splitting (as i don’t have a huge number of images this would be doable for me)
  2. identify the measurements being taken from over-split or clumped colonies and remove this before analysis (5.93 MB)

I also now realise that CP is failing to identify some of the small colonies that are only faintly fluorescent. If someone would also have advice on how to improve this, that would be great.



Hi Ricardo,

A few things:
(1) Your images look blurry or pre-processed/smoothed in some way, to my eye at least. Is that the case? (Raw images may retain much more information.)
(2) The colonies all seem to have a “streak” toward the bottom-right of the image – is this an imaging artifact? You can see this more clearly by right-clicking the image in CP, then choose Image Contrast->Log Normalized. This just gives me pause that perhaps some settings on your CCD camera need to be optimized.
(3) Good news! About 2/3 of your pipeline looks extraneous to me. Your images are grayscale and so all the color-related info is not needed. Take a look at the modified pipeline I uploaded.
(4) You cannot manually change the splitting, per se, but you can remove extraneous objects using EditObjectsManually. You might also look at IdentifyObjectsManually, but that would require outlining every object manually.
(5) Which colonies are being missed with the pipeline I posted? I only modified the ThresholdCorrectionFactor a bit (besides removing about a dozen modules!), so you can play with this to get more or fewer colonies. But you would need to post a manually annotated image for us to try and improve upon the automatic segmentation here.

Ramiro_09102013_Ecoli_DL.cp (9.15 KB)

However, in our new (unreleased) version, you can edit objects in a much more flexible way. Please read the caveats here (I suggest the 2.0 version for now): … TrunkBuild

Good luck!

Hi David,

Thanks very much for your help. Just a brief reply to your points above:

1-2. the images are indeed the raw images. I have tried to correct for this while at the stereoscope, but haven’t managed to do so until now.
3. I had tried to eliminate the color modules, but must have been doing something wrong as I kept on getting errors. Thanks for sorting this out.
4. I have updated to the new version of cellprofiler and I can now use the EditObjectsManually to delete and do new outlines, which is great. However (and this replies to 5.), in some cases cellprofiler is still missing quite a few colonies. I have attached a .pdf of the outlined colonies and you can see that there are some small colonies, inside the red boxes, that are still missed. I have tried to play with the Threshold, however this seems to either lead to more oversplitting or to less colonies being identified. Thus if you think that this can still be improved in some way please let me know

I have attached the last version of my pipeline, which I have been using on cellprofiler 2.1.


outlines_editObjManually_edited.pdf (597 KB)
Ramiro_13112013_Ecoli.cp (11.5 KB)

Hi Ricardo,

The main issue that I see is that the spots are very dim! They have an intensity of ~0.0005 and the brighter spots have a value of >0.002. So you will need to really lower the threshold.
A few suggestions for your IdentifyPrimaryObjects:

  • The first setting to change is the “Lower and upper bounds on threshold” has a hard lower limit of 0.001. Given what I said above, this is too high. I would change them to [0,1] i.e. no limits.
  • I suggest MCT threshold method. Not a big issue, but we have chosen it as our new default.
  • Try “Adaptive” Threshold strategy rather than Global. This attempts to have a different threshold near the small, dim spots vs. the larger brighter spots.
  • Try a threshold correction factor of ~0.6.

I would like to enhance the spots with a morphological filter, but the huge size range makes that hard for the built in filters in CP. But I hope the settings above will work well enough.