Manual counting of bacterial colony forming units (CFUs) on agar plates is laborious and error-prone. We therefore implemented a colony counting system with a novel segmentation algorithm to discriminate bacterial colonies from blood and other agar plates.
A colony counter hardware was designed and a novel segmentation algorithm was written in MATLAB. In brief, pre-processing with Top-Hat-filtering to obtain a uniform background was followed by the segmentation step, during which the colony images were extracted from the blood agar and individual colonies were separated. A Bayes classifier was then applied to count the final number of bacterial colonies as some of the colonies could still be concatenated to form larger groups.
To assess accuracy and performance of the colony counter, we tested automated colony counting of different agar plates with known CFU numbers of S. pneumoniae, P. aeruginosa and M. catarrhalis and showed excellent performance.
Citation: Brugger SD, Baumberger C, Jost M, Jenni W, Brugger U, Mühlemann K (2012) Automated Counting of Bacterial Colony Forming Units on Agar Plates. PLoS ONE 7(3): e33695. doi:10.1371/journal.pone.0033695
Editor: Stefan Bereswill, Charité-University Medicine Berlin, Germany
Received: February 9, 2012; Accepted: February 20, 2012; Published: March 20, 2012
Copyright: © 2012 Brugger et al. This is an open-access article distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited.
Funding: This study was supported by the Swiss National Science Foundation (research grant 320000-113912 to KM and MD-PhD scholarship 323500-119214 to SDB, www.snf.ch). The funders had no role in study design, data collection and analysis, decision to publish, or preparation of the manuscript.
Competing interests: The authors have declared that no competing interests exist.
Microbiological research techniques often rely on accurate determination of colony forming units (CFUs). Routinely, this is done by aliquoting a small amount of a liquid culture and plating out several serial dilutions onto culture plates (Petri dishes containing semisolid medium). After incubation in appropriate conditions for the microorganism of choice, the colonies are counted to determine the number of CFU. This is done by manually counting of colonies on plates illuminated by transmitted light. The concentration of bacteria in the original culture can then be calculated based on the assumption that each colony has raised from one single bacterium (colony forming unit, CFU). This process is time-consuming, tedious and error prone. There is a tendency to analyse only high dilutions of the initial culture as these have fewer colonies to count. Unfortunately, in low count assays minor counting errors have significant effects on the calculated concentration in the primary liquid medium.
On the other hand, accurate counting of plates with high numbers of CFUs is error prone since it requires a high level of attention by the performer. Therefore, often only parts of a plate are analyzed and used to estimate the whole plate count after extrapolation . Furthermore high numbers of CFUs on a plate can lead to false redults due to overcrowding of bacteria .
This study aimed to design an automated colony counter which reliably detects, bacterial counts and colony size on semisolid agar plates of 85 mm diameter. The system should be suitable for the study of important human pathogens, such as Streptococcus pneumoniae, Moraxella catarrhalis and Pseudomonas aeruginosa. These bacteria are grown on diverse agar plates including Columbia blood sheep agar (CSBA), chocolate agar and brain heart infusion (BHI) agar plates. The system should also be user-friendly and cost-effective with an algorithm that is adaptable to other culture media and microorganisms.
Bacterial strains and growth conditions
A total of 7 clinical isolates of S. pneumoniae were selected from two nationwide surveillance programs collecting nasopharyngeal and invasive isolates , . Additionally, a clinical isolate of Pseudomonas aeruginosa and ATCC strain 25238 of Moraxella catarrhalis were used for validation of the automated colony counter (one isolate for each species). For liquid culture all isolates were grown in brain heart infusion (BHI) broth, supplemented with 5% fetal calf serum (FCS) for S. pneumoniae. For culture on solid media, S. pneumoniae and Pseudomonas aeruginosa were grown on CSBA plates and Moraxella catarrhalis on BHI plates. All agar plates were produced in house. Strains were grown at 37°C in a 5% CO2 atmosphere. For counting experiments strains were grown in liquid medium to an OD 600 nm 0.3–0.4. Ten-fold serial dilutions of culture were made in phosphate buffered saline (PBS, pH 7.4) and 100 µl of dilutions (usually of 10−4 to 10−7) were plated out on agar plates using glass inoculators and a small rotating disk. Plates were incubated at 37°C overnight in a 5% CO2 atmosphere before counting of colonies.
Colony Counter Hardware Configuration
The completely installed system is shown in Figure 1. An aluminium rack with a drawer to insert and remove Petri dishes into the machine was constructed. This drawer is eloxadised to minimize light scattering. Attached on the back is a power supply unit combined with a dimmer. This bottom assembly is linked to the camera holding arm with a column. The circular dark field illumination is also attached to the column. Construction plans are added as supplementary information: base plate (Figure S1), drawer (Figure S2) and retaining device for the electronics (Figure S3).
Colony Counter Illumination and Imaging
Petri dishes were illuminated with a circular dark field illuminator and an IDS uEye UI-1640-C camera with a resolution of 3.3 megapixel (2048×1536 pixel) and a C1614-M lens with 16 mm focal length (both Stemmer Imaging, Pfäffikon, Switzerland). The assembly height of the camera was about 300 mm over the dish. The camera is connected to the computer via a USB interface and the dark field illumination is feeded by the power supply unit.
Colony Counter Software Algorithms
The software was written in MATLAB 7.9 (The Mathworks, Natick, MA) and a stand-alone application was created, so the software can be used without a complete installation of MATLAB. Indeed, it requires the MATLAB component runtime (MCR) installed on the target computer. Our software was compiled and tested with uEye driver version 184.108.40.206 (www.ids-imaging.de) on Windows XP SP2 (Microsoft, Bern, Switzerland). It is recommended to use this system setup. The application is able to store generated results in xls-files which can be read and edited with MS Excel (Microsoft, Bern, Switzerland).
Software and algorithms are available online (File S1).
This toolbox was created to enable the communication between MATLAB and the uEye driver, as the driver cannot be accessed by MATLAB directly. This toolbox was written in C++. There is a relatively simple way to include C/C++ code into MATLAB scripts. The uEye toolbox provides the functionality to set the colour settings of the camera to RGB24 (red, green and blue and 8 bit resolution per colour channel).
Counting of bacterial colonies
To assess accuracy and performance of the automated colony counter we compared automated colony counting with routine manual counting and both methods were compared to the gold standard of manual counting performed on high resolution images of plates.
Routine manual counting was performed by 2 independent persons with the help of a transmission light array with magnifier and a handcounter (Tamaco LTD., Taichung, Taiwan). Counted CFU were marked with a pen on the plate cover to discriminate counted from uncounted colonies. Plates with over 200 colonies were usually counted by dividing the plates into equal sectors (from 1/2 up to 1/8). After counting one sector, the count was multiplied with the total number of sectors to estimate whole plate CFU count.
After routine manual counting high resolution images (4.2*106 pixels) of each plate were taken with a FluorChem SP Megapixel Superior Performance Chemiluminescence, Fluorescence and Visible Image System (AlphaInnotec, SanLeandro, CA, USA). Colonies on images displayed on the screen were counted independently by two persons with marking CFUs on the screen as counted.
After routine and high resolution image manual counting automated colony counting was performed once and results were stored in an xls-file generated by the colony counter standalone application.
Automated colony counting and routine manual counting were compared to the gold standard (manual counting on high performance images) by linear regression analysis using Prism 5 software (GraphPad, La Jolla, CA).
GUI showing a typical result obtained after counting a blood agar plate with pneumococcal colonies. Red: counted as a single bacterial colony. Green: counted as double colonies.
A key component of our colony counting system is the choice of illumination. Different illumination techniques like front and back lighting were tested. Since the surface of the blood agar reflects most of the light, images where illuminated with a direct front light were heavily deranged. Transmitted lighting illumination gave good object background discrimination but due to the inhomogeneity of the agar thickness the discrimination was only possible for a limited area of the plate. As bacterial colonies are usually slightly elevated from the agar surface dark field illumination was evaluated. In contrast to front lighting illumination, the light beam of the dark field illuminator is projected from the side onto the target object. With white light dark field illumination the background of the blood agar became prominent, which impaired colony discrimination, but this problem was solved by using a blue dark field light source. Blue dark field illumination gave the best discrimination of colonies and medium background especially in the blue part of collected RGB images (Figure 3). Therefore only the blue part of the image was used for further image processing. A disadvantage of dark field illumination is the influence of dust on the medium. Such undesirable distracters had to be removed from the green colour channel in the image purification steps (see below).
Blue channel of RGB images showing different colony morphologies of three different S. pneumoniae strains grown on blood agar plates.
A flowchart describing the segmentation algorithm is shown in Figure 4. After an image of an agar plate has been taken, it has to be pre-processed with Top-Hat-filtering  in order to obtain a uniform background by removing inhomogeneity of the semisolid agar layer. This is followed by the segmentation step, during which the colony images are extracted from the blood agar and individual colonies are separated. A Bayes classifier is then applied to count the final number of bacterial colonies. This step is necessary as some of the colonies are still concatenated to form larger groups. A Bayes classifier is a simple probabilistic classifier based on applying Bayes theorem. Geometric properties such as ratio between major and minor axis of the group are used to verify the number of colonies contained in the group. In subsequent sections, the novel segmentation algorithm is described in more detail.
First binary conversion
First, the pre-processed image is binarized using a dynamic, global threshold, calculated based on the method of Otsu . Binarizing can be understood to set all the pixels with a greyscale value greater than a threshold to one and zero otherwise.
Search for perfect circles
Perfect circles are searched based on the binary image by analyzing the ratio of major to minor axis length (circle has a ratio of one) and the ratio of object area to the smallest possible surrounding rectangle, the so-called bounding box: of each found object. Both used properties are well known in the pattern recognition literature and commonly used , . When a real world image is discretized to a pixel matrix, no object matches the perfect circle criterion. Therefore, “perfect” circles have to lie within a tolerance of ±20 percent. If by this definition no circles are found, a black binary image is the output.
Second binarization by adaptive thresholding
Before performing a second binarization, the area outside the Petri dish is removed and pixel values are set to zero. Since the abrupt change from black area to the red blood agar causes a thick rim after binarization, the pixel values are changed to the value of the mean chrominance of the outer 10 pixels within the agar. The background of the image is set to black (adjacent corners of a square image on round plate).
One of the challenges comes from the fact that bacterial strains from the same species may exhibit different colony phenotypes (as shown in Figure 3), which makes it impossible to define a common threshold for colony size. One way to solve this problem is to apply an adaptive threshold where a threshold for each pixel is calculated based on its neighbouring pixels . The assumption behind this method is that smaller image regions are more likely to have approximately uniform illumination, thus being more suitable for setting a threshold. The used method statistically examines the mean intensity values of the local neighbourhood of each pixel. To avoid noise and ensure that a big homogeneous area is segmented as a continuous object, a global threshold is subtracted from the local threshold. The target pixel is defined as where is the grey scale value of the input image pixel and is a local threshold, calculated individually for each pixel and defined as follows: , where n is the number of neighbouring pixels.
First image purification
As a consequence of the binarization process, large connected areas arise on the border of the blood agar. The colonies that touch these boundary parts and the areas are removed.
Errors, such as scratches, dust or air bubbles in the agar are best visible in the green channel of the colour image. Based on the mean brightness of the perfect circles a filter for the image's green part is estimated and error objects are removed.
Separate groups of colonies
The adaptive binarization process results in concatenating several colonies to groups of to four or five individual colonies (confluent colonies on plates). The algorithm performs a distance transformation on the binarized image and segmentation is then done with a watershed transformation , .
Second image purification
The application of morphological opening rounds all the sharp corners produced by the watershed transformation . Furthermore, objects smaller than a certain threshold and larger than a second threshold are removed. Both thresholds are computed from the size of the perfect circles.
After the segmentation algorithm is completed, the Bayes classifier distinguishes the remaining concatenated groups into classes of one, two, three or four containing colonies and the final colony counting is proceeded. One important geometric property of different classes is the abrupt change of the angle around an object boundary. If a group contains for example two colonies, then two such abrupt changes can be observed at the borders where the colonies touch each other. Visual inspection showed that the segmentation algorithm discriminated almost all individual bacteria colonies from the agar and separated most of the concatenated groups.
Performance of colony counting algorithm
Counting of S. pneumoniae colonies was done with all three methods for a total of 7 pneumococcal strains grown on a total of 22 plates with CFU counts ranging from 16 to 749 (mean 133.5 colonies, median 55.5 colonies). Linear regression analysis of manual and automated colony count versus the gold standard showed a significant difference of the two slopes (Figure 5A, p<0.0001) with a slope of 1.01(SD ±0.016; 95% confidence interval (CI) 0.98–1.04) for the automated colony counter and a slope of 0.67(SD±0.03; CI 0.61–0.73) for routine manual counting.
A. Performance of automated colony counting (dots) of S. pneumoniae CFUs and routine manual counting (squares) versus the gold standard of manual counting on high performance images (X-axis). A total of 22 plates of 7 different pneumococcal strains were analyzed (CFU range 16–749; mean 133.5, median 55.5). Linear regression analysis of manual and automated colony count versus the gold standard showed a significant difference of the two slopes (p<0.0001) with a slope of 1.01(SD ±0.016; 95% confidence interval (CI) 0.98–1.04) for the automated colony counter and a slope of 0.67(SD±0.03; CI 0.61–0.73) for routine manual counting (95% confidence interval is indicated with dotted lines). B. Performance of automated colony counting (dots) of S. pneumoniae CFUs on blood agar plates versus the gold standard of manual counting on high performance images (X-axis). A total of 26 plates of 7 different pneumococcal strains (CFU range 36–853; mean 176, median 101.5) were analyzed. Linear regression showed a slope of 1.02 (SD±0.01; CI 1–1.03) (95% confidence interval is indicated with dotted lines). C. Performance of automated colony counting (dots) of M. catarrhalis CFUs on BHI plates versus the gold standard of manual counting on high performance images (X-axis). 25 plates of M. catarrhalis strain 25238 were used (CFU range 20–70, mean 43.9, median 42). Linear regression analysis of automated colony count versus the gold standard showed a slope of 1 (SD ±0.008; CI 0.981–1.033) for the automated colony counter. D. Performance of automated colony counting (dots) of P. aeruginosa CFUs on blood agar plates versus the gold standard of manual counting on high performance images (X-axis). 8 plates of P. aeruginosa clinical isolate (strain 460229) were analyzed (CFU range 1–386, mean 142.3, median 37). Linear regression analysis of automated colony count versus the gold standard showed a slope of 0.89 (SD ±0.033; CI 0.81–0.97) for the automated colony counter.
In a second independent experiment using 7 strains grown on 26 plates with CFU counts ranging from 36 to 853 (mean 176, median 101.5) automated colony counting was compared with the gold standard only. Linear regression showed a slope of 1.02 (SD±0.01; CI 1–1.03) (Figure 5B).
Counting of M. catarrhalis was done with ATCC isolate (strain 25238) comparing automated colony counting with the gold standard of manual counting performed on high resolution images of plates. 25 plates with CFU counts ranging from 20 to 70 were used (mean 43.9, median 42). Linear regression analysis of automated colony count versus the gold standard of 26 plates showed a slope of 1 (SD ±0.008; CI 0.981–1.003) for the automated colony counter (Figure 5C).
Counting of P. aeruginosa was done with a clinical isolate (strain 460229) comparing automated colony counting with the gold standard of manual counting performed on high resolution images of plates. 8 plates with CFU counts ranging from 1 to 386 were used (mean 142.3, median 37). Linear regression analysis of automated colony count versus the gold standard showed a slope of 0.89 (SD ±0.033; CI 0.81–0.97) for the automated colony counter (Figure 5D).
In this study, we present an automated system for accurate counting of bacterial colonies of the human pathogens S. pneumonia, M. catarrhalis and P. aeruginosa. The system works well on different solid growth media including those with a dark background colour such as sheep blood agar. Performance was superior to routine manually counting of plates especially in the presence of higher numbers of colonies. Comparison with the gold standard of counting single colonies on high resolution images showed excellent correlation.
Several automated colony counting systems are commercially available such as the ProtoCOL automated counters or the Whitley aCOLyte (Synbiosis, Cambridge, UK) and the AID BacSpot (AID, Strassberg, Germany) , . These systems have been designed for quality control in food production industry and can therefore handle large number of samples with many different bacterial species. They are not widely used in research laboratories due to their relative high price. Also, to our knowledge, there has been no evaluation of commercially available systems for counting bacterial strains such as S. pneumoniae grown on blood agar plates.
The system presented in this study is a low priced alternative to the high-throughput systems with an open source software code. Therefore, the software can be adapted by users to their individual needs (other organisms, other growth media, etc.). The hardware is easy to assemble and total price is less than 8'000 USD.
The performance of applications for automated bacterial colony counting has been reported before. Whereas some authors describe the performance of commercial counters , others describe novel algorithms for colony counting and their performance , , ). Cordiki and colleagues presented a complete colony counting system and showed excellent performance with yeast and different non-pneumococcal bacterial species grown on (not further specified agar plates with a bright background colour. An epi-illumination system with a light source at an angle between 30–40° from the vertical axes was used. In our study we used a ring shaped homogenous light source to ensure equal illumination. Cordiki et al. used commercial image analysis software for image processing and the standard software was improved by integrating a multilevel threshold algorithm showing a regression equation of y = 0.9753 for tested species . However, the authors did not test this system with S. pneumoniae and not with bacteria grown on blood agar plates.
Putman and colleagues presented a counting method using the ProtoCol software . But this method required staining of colonies with dyes such as 2,3,5-triphenyl tetrazolium chloride (TTC) to increase the contrast between bacterial colonies , . They showed that the ProtoCOL counter counts were about 10–15% lower than true counts and this deviation was noticeable when the numbers of colonies exceeded fifty. The authors were able to improve the performance of the ProtoCOL by supplying images generated by scanning Petri dishes with a common document scanner. Since source codes for the commercial systems are not available a comparison of our system to those algorithms was not possible.
An advantage of the automated colony counter system described here is that CFUs can be counted without prior staining. After counting, colonies can therefore be used for further experiments. Despite the excellent performance, a remaining difficulty is the recognition of dust or scratches especially on blood agar plates where they exhibit high diversity of shapes and appearances.
In summary, the main contribution of this work is a novel segmentation algorithm, which allows for cutting the background from the foreground (i.e. from the colonies) and is robust to colony size as well as to different textures and appearances of the colonies. Included in this algorithm is an efficient way to separate connected groups of colonies. Performance of this system was shown to be equal the gold standard of hand counting high resolution images but in much less time.
Construction plan for the colony counter ground plate.
Construction plan for the colony counter drawer.
Construction plan for the colony counter retaining device.
Colony counter software files: stand-alone application (cc.exe) and supporting files. Please note that the MATLAB component runtime (MCR) has to be installed on the target computer to use the software. MCR can be downloaded from the mathworks website (http://www.mathworks.com).
We thank Brigitte Morand, Rolf Troller and Suzanne Aebi, Institute for Infectious Diseases, University of Bern for technical support and Walter Hersperger, Bern University of Applied Sciences, Engineering and Information Technology for constructing the hardware assembly.
Conceived and designed the experiments: SDB WJ UWB KM. Performed the experiments: SDB CB MJ. Analyzed the data: SDB CB MJ WJ UWB KM. Contributed reagents/materials/analysis tools: WJ UWB KM. Wrote the paper: SDB CB WJ UWB KM.
- 1. Blodgett RJ (2008) Mathematical treatment of plates with colony counts outside the acceptable range. Food Microbiol 25: 92–98.
- 2. Breed RS, Dotterrer WD (1916) The Number of Colonies Allowable on Satisfactory Agar Plates. J Bacteriol 1: 321–331.
- 3. Muhlemann K, Matter HC, Tauber MG, Bodmer T (2003) Nationwide surveillance of nasopharyngeal Streptococcus pneumoniae isolates from children with respiratory infection, Switzerland, 1998–1999. J Infect Dis 187: 589–596.
- 4. Kronenberg A, Zucs P, Droz S, Muhlemann K (2006) Distribution and invasiveness of Streptococcus pneumoniae serotypes in Switzerland, a country with low antibiotic selection pressure, from 2001 to 2004. J Clin Microbiol 44: 2032–2038.
- 5. Gonzalez RC (2008) Digital Image Processing. New Jersey: Pearson Prentice Hall.
- 6. Otsu N (1979) Threshold Selection Method from Gray-Level Histograms. Ieee Transactions on Systems Man and Cybernetics 9: 62–66.
- 7. Biston MC, Corde S, Camus E, Marti-Battle R, Esteve F, et al. (2003) An objective method to measure cell survival by computer-assisted image processing of numeric images of Petri dishes. Phys Med Biol 48: 1551–1563.
- 8. Marotz J, Lubbert C, Eisenbeiss W (2001) Effective object recognition for automated counting of colonies in Petri dishes (automated colony counting). Comput Methods Programs Biomed 66: 183–198.
- 9. Fisher R, Perkins S, Walker A, Wolfart E (2003) Adaptive Thresholding.
- 10. Maurer CR Jr, Rensheng Q, Raghavan V (2003) A linear time algorithm for computing exact Euclidean distance transforms of binary images in arbitrary dimensions. Pattern Analysis and Machine Intelligence, IEEE Transactions on 25: 265–270.
- 11. Meyer F (1994) Topographic distance and watershed lines. Signal Processing 38: 113–125.
- 12. Wilson IG (1995) Use of the IUL Countermat Automatic Colony Counter for Spiral Plated Total Viable Counts. Appl Environ Microbiol 61: 3158–3160.
- 13. Putman M, Burton R, Nahm MH (2005) Simplified method to automatically count bacterial colony forming unit. J Immunol Methods 302: 99–102.
- 14. Bewes JM, Suchowerska N, McKenzie DR (2008) Automated cell colony counting and analysis using the circular Hough image transform algorithm (CHiTA). Phys Med Biol 53: 5991–6008.
- 15. Corkidi G, Diaz-Uribe R, Folch-Mallol JL, Nieto-Sotelo J (1998) COVASIAM: an image analysis method that allows detection of confluent microbial colonies and colonies of various sizes for automated counting. Appl Environ Microbiol 64: 1400–1404.
- 16. Kim KH, Yu J, Nahm MH (2003) Efficiency of a pneumococcal opsonophagocytic killing assay improved by multiplexing and by coloring colonies. Clin Diagn Lab Immunol 10: 616–621.