Biofilm Viability Checker: Creating a tool to calculate biofilm viability from confocal microscopy images

For full details of our work, please read our Nature Biofilms and Microbiomes paper “Biofilm Viability Checker: An Open-Source Tool for Automated Biofilm Viability Analysis from Confocal Microscopy Images”.
Biofilm Viability Checker: Creating a tool to calculate biofilm viability from confocal microscopy images

The Challenge

Biofilms account for up to 80% of implant-related infections as, unintentionally, medical implants provide excellent surfaces for formation of these 3D bacterial communities.1 Compared with planktonic bacteria, those present in biofilms can survive harsher environments and demonstrate increased resistance to antimicrobials.2  Furthermore, there is a new concern regarding the presence and spread of antimicrobial-resistant strains in biofilms.3

Within the School of Dentistry Microbiology Group at the University of Birmingham, there is a wide range of research being conducted to tackle the issue of biofilm-related infection. Studies range from developing novel drug delivery systems using nanoparticle technology to modelling chronic wounds, and from investigating the antibacterial activity of blue light to creating novel environments for testing dental implant materials (see However, one challenge that several members of our group faced was the prospect of analysing the impact of their treatment or technology on relevant biofilms.

There are several approaches that can be taken. In microbiology, two common methods are counting colony-forming units (CFUs) and crystal violet staining along with spectrophotometry. Whilst these traditional methods have their applications and advantages, counting CFUs does not provide any information about the structure of the biofilm and crystal-violet staining is only a semi-quantitative method and does not provide any information on viability. We believed that a move towards direct, automated quantitative analyses of biofilms would be beneficial for the group. Our goal was to develop a simple, automated method to quantify the viability of biofilms stained with SYTO® 9 and propidium iodide (FilmTracer™ LIVE/DEAD® Biofilm Viability Kit, Invitrogen, USA).

The Idea

Confocal laser scanning microscopy (CLSM) selectively excites fluorescence signals from different planes within a sample, acquiring images point by point with localised laser excitation at specific wavelengths. CLSM is a useful technique as it enables 3D visualisation of biofilm structure by excluding signals from adjacent planes. A second benefit of CLSM is the versatility offered by fluorescent stains added to a sample, allowing further information to be obtained. Importantly for our work, CLSM combined with viability staining provides high sensitivity, specificity, and resolution.4 Most commonly, SYTO® 9 acts as the green-fluorescent nucleic acid stain, labelling bacteria with intact cell membranes, and propidium iodide forms the red-fluorescent nucleic acid stain, penetrating only bacteria with damaged membranes (Figure 1).

Figure 1: Representative confocal images of biofilm samples of Streptococcus sanguinis at 2, 5 and 7 days. Biofilms were stained using a live/dead viability kit (FilmTracer™ LIVE/DEAD® Biofilm Viability Kit, Invitrogen, USA). Green cells represent viable, live bacteria whilst red cells represent dead bacteria. Images obtained at 40x magnification with an oil immersion lens. Figure reproduced from Mountcastle et al. (2021).5

There are several publications that have quantified the viability of biofilms from CLSM images and indeed, bespoke software exists that enables the user to identify different properties from these images. However, we found within our group that these methods are not always accessible or reproducible if the reported approach lacks detail, and we also discovered that these methods appear to be particularly challenging to implement for non-experts. In addition to the question of navigating the range of segmentation methods and software available, a recent publication fuelled our drive to develop a simple, automated tool for the purpose of measuring viability from CLSM images. Rosenberg et al. (2019) reported that propidium iodide can stain extracellular DNA that is present in biofilms and this often results in an underestimation of viability.6 Therefore, qualitative observation of live/dead stained biofilms could lead to misleading conclusions since the contrast of each channel is manually adjusted by the user.

Ultimately, this led us to the conclusion that the current suite of image processing tools available for biofilm analysis is difficult to access and cumbersome for non-specialists with no significant programming experience, and we set out to develop a tool that would help our Microbiology Group and the wider community with image analysis of biofilm micrographs.

The Results

Written in the open-source software Fiji (ImageJ, U. S. National Institutes of Health, Bethesda, Maryland, USA), we developed a tool called “Biofilm Viability Checker” that can calculate the percentage of viable cells from a confocal image and output the results in a .csv file. Watch the video below to see how simple the tool is to use, and how quickly results can be obtained. Full details on the algorithm we used and how to implement the analysis is provided in the paper and accompanying supplementary information.


  • The macro can analyse multiple images at a time, making it easy to calculate and plot the results of a study.
  • It can produce images of the results, outlining the green and red cells so that users can check it is accurately identifying the area of fluorescently stained bacteria (Figure 2).
  • The time taken to run the image analysis on 25 CLSM micrographs is less than 10 minutes, making it considerably quicker than manually analysing the images.
  • Its successful use on a range of different bacterial cell morphologies has been demonstrated.
  • It ensures reproducibility across studies.


  • It is not possible to evaluate the entire biofilm at once. Averaging the results of images taken from across the biofilm sample and increasing the number of repeats can limit the impact of this.
  • The results may not be reliable if the tool is used on poorer quality micrographs (for example, if a sample is not completely flat when imaged). It is advisable to take appropriate steps to ensure optimal imaging of the samples.
  • The macro has been tailored specifically for bacterial biofilms and for fluorescent images stained with the FilmTracer™ LIVE/DEAD® Biofilm Viability Kit. Whilst there is potential for the macro to be applied to other confocal images, the workflow may need altering to be used in conjunction with alternative staining protocols.

Figure 2: Sample images of a variety of single-species biofilms demonstrating result of automated image analysis. The green outline indicates the total bacteria area, and the magenta outline indicates the dead bacteria area. (A) Streptococcus sanguinis, (B) Pseudomonas aeruginosa, (C) multi-species biofilm consisting of Fusobacterium nucleatum, Actinomyces naeslundii, Streptococcus gordonii and Porphyromonas gingivalis, and (D) Lactobacillus casei. Figure reproduced from Mountcastle et al. (2021).5

We felt it was important to contextualise our proposed tool by comparing the results with traditional techniques, so that researchers could see the advantages of the Biofilm Viability Checker. In our paper, we directly compared the results of the image analysis with those of counting CFUs and found that traditional techniques resulted in much larger errors than our tool. Our results suggested that automated image analysis is likely to be more accurate and therefore a better method to identify statistically significant variations between biofilm growth conditions when researching antimicrobial approaches.

A unique aspect of this work is our use of translationally relevant case studies to trial the automated image segmentation protocol, the results of which were also presented in our paper. The Biofilm Viability Checker was applied to three key areas that can benefit from automated CLSM micrograph analysis.

  1. The effect of antimicrobial compounds on biofilms is highly important. This is particularly crucial in the oral field, where broad-spectrum antibiotics are used in consumer products, such as toothpaste and mouthwash. We used the Biofilm Viability Checker on biofilms of Streptococcus sanguinis and Pseudomonas aeruginosa treated with a commercial mouthwash and demonstrated that P. aeruginosa showed resistance.
  2. A second area of research where preventing infection is paramount is implants and medical devices. A specific example comes in the form of additively manufactured (AM) devices. We applied the Biofilm Viability Checker to Staphylococcus epidermidis biofilms grown on AM discs of different surface roughness and showed that the roughness properties had no antimicrobial effects, however an increase in roughness resulted in an increase in the biomass of the biofilm.
  3. One of the advantages of CLSM imaging is that it can generate an understanding of the 3D structure of a biofilm using z-stacks. Applying the Biofilm Viability Checker to a z-stack can provide information of biofilm viability throughout its depth. In our paper, we compared the viability throughout 1-day and 7-day old sanguinis biofilms. For the younger biofilm, the percentage of live cells remained consistent and above 80% throughout its depth. However, in comparison the viability of the older biofilm was reduced significantly in the centre and increased towards the surface. This could have been due to limited nutrients reaching the centre of the biofilm, combined with an oxygen gradient that increased towards the surface, thus resulting in cell death.

The Impact

We’ve already seen the impact the Biofilm Viability Checker has had in our own research group, enabling our colleagues to increase the number of samples they test and enjoying the simplicity of the tool to support their research. It has been great for us to present researchers with a simple solution to what is often viewed as a very complex problem! We hope that it will ensure image analysis is an accessible option for those in the wider microbiology and biomaterials fields working on the problem of biofilm-related infection. Ultimately, we hope it will support the development of much needed novel strategies to prevent and treat costly infections.

Paper available at:

To access the Biofilm Viability Checker, visit:

We welcome feedback from users who apply the Biofilm Viability Checker in their own research. Please get in touch with Dr Sarah Kuehne (


  1. Khatoon, Z., McTiernan, C. D., Suuronen, E. J., Mah, T.-F. & Alarcon, E. I. Bacterial biofilm formation on implantable devices and approaches to its treatment and prevention. Heliyon 4, e01067 (2018).
  2. Mah, T. F. C. & O’Toole, G. A. Mechanisms of biofilm resistance to antimicrobial agents. Trends Microbiol. 9, 34–39 (2001).
  3. Høiby, N., Bjarnsholt, T., Givskov, M., Molin, S. & Ciofu, O. Antibiotic resistance of bacterial biofilms. Int. J. Antimicrob. Agents 35, 322–332 (2010).
  4. Drago, L. et al. How to study biofilms after microbial colonization of materials used in orthopaedic implants. Int. J. Mol. Sci. 17, (2016).
  5. Mountcastle et al. Biofilm viability checker: An open-source tool for automated biofilm viability analysis from confocal microscopy images, npj Biofilms Microbiomes 7, 44, (2021).
  6. Rosenberg, M., Azevedo, N. F. & Ivask, A. Propidium iodide staining underestimates viability of adherent bacterial cells. Sci. Rep. 9, 1–12 (2019).