Skip to main content

Thank you for visiting You are using a browser version with limited support for CSS. To obtain the best experience, we recommend you use a more up to date browser (or turn off compatibility mode in Internet Explorer). In the meantime, to ensure continued support, we are displaying the site without styles and JavaScript.

High-throughput 3D tracking of bacteria on a standard phase contrast microscope


Bacteria employ diverse motility patterns in traversing complex three-dimensional (3D) natural habitats. 2D microscopy misses crucial features of 3D behaviour, but the applicability of existing 3D tracking techniques is constrained by their performance or ease of use. Here we present a simple, broadly applicable, high-throughput 3D bacterial tracking method for use in standard phase contrast microscopy. Bacteria are localized at micron-scale resolution over a range of 350 × 300 × 200 μm by maximizing image cross-correlations between their observed diffraction patterns and a reference library. We demonstrate the applicability of our technique to a range of bacterial species and exploit its high throughput to expose hidden contributions of bacterial individuality to population-level variability in motile behaviour. The simplicity of this powerful new tool for bacterial motility research renders 3D tracking accessible to a wider community and paves the way for investigations of bacterial motility in complex 3D environments.


Natural habitats of swimming bacteria include complex 3D environments such as oceans, soil and tissue. They navigate these terrains by 3D motility patterns often characterized by stochastically alternating periods of linear movement (‘runs’) and sudden reorientation (for example, ‘tumbles’ for Escherichia coli, or ‘flicks’ and ‘reversals’ for Vibrio alginolyticus). These stochastic patterns are only apparent from individual trajectory data and are not accessible from population-level measurements such as bacterial number densities. Bacterial trajectories can yield rich information, for instance on the mechanism of chemotaxis1, the underlying signal processing2, interspecies differences in motility patterns3,4 and behavioural individuality5,6, which may have important ecological ramifications7.

Observations of bacterial motility are generally undertaken in bulk fluid to avoid artefacts arising from surface interactions8,9,10,11. As conventional light microscopy techniques only allow for localization in 2D, they capture either a projection of the 3D trajectories12 or the small subset that lies within the microscope’s focal plane3,13. Projection implies a loss of information that can lead to ambiguities in the interpretation of trajectories (see Fig. 1). For instance, a stationary bacterium cannot be distinguished from one moving perpendicular to the plane of observation, and a right angle turn can appear as any magnitude from 0° to 180° in projection. Restricting observations to the focal plane (‘2D slicing’) prevents such ambiguities, but severely limits the numbers and lengths of trajectories to a biased subset. For example, a bacterium initially swimming in plane will remain in plane if it reverses, but most likely not after a right angle turn. Similarly, longer runs have a larger chance of exiting the focal plane than short ones, leading to biases in measured run length distributions. Some of these problems are summarized in Fig. 1, and Supplementary Discussion 1 provides an in-depth analysis. In short, neither 2D projection nor slicing allow for an accurate characterization of motility patterns. Moreover, 2D observations do not fully capture motility in complex 3D environments like those encountered in nature.

Figure 1: Comparison of 3D and 2D tracking methods.
figure 1

In 3D tracking (left column), full position information is obtained, and speed and angle measurements are correct aside from the effects of localization errors and acquisition frequency which we neglect here. 2D projection (centre column) of the same volume introduces systematic errors in speed and angle measurements. In 2D slicing (right column), observations are constrained to a thin focal plane of thickness d. If we assume that runs have to lie fully within the slice and are five times longer than d, corresponding to typical parameters in the observation of E. coli and many other bacteria, measurement errors are minimized. However, the vast majority of turning events within the focal plane are rejected, with a bias against angles near 90°. Supplementary Discussion 1 provides derivations for the data presented here.

Few techniques are available for tracking bacteria in 3D. Physical tracking, consisting of automatically moving the sample to keep one individual bacterium in focus14,15, has long been the gold standard of bacterial 3D tracking. This technically demanding method requires a specialized experimental set-up, and its limitation to observing only one cell at a time constrains its efficiency for characterizing the full repertoire of motile behaviours in a population. A higher throughput can be achieved by extracting 3D positions from 2D microscopy images that show multiple bacteria, but existing approaches, consisting of digital holographic microscopy and a number of defocussed imaging methods, exhibit a trade-off between performance and ease of use. Digital holographic microscopy, on the one hand, allows 3D imaging at high speed, but is not accessible to most microbiological laboratories because its application to bacteria is technically demanding and requires a customized experimental set-up16,17,18,19. Current defocussed imaging methods, on the other hand, offer technical simplicity by using the diameter of the largest observed diffraction ring as a linear measure of an object’s distance from the focal plane20. Implementations based on fluorescence microscopy, however, incur severe constraints in spatio-temporal resolution due to photon limitations21, while those using darkfield22 and phase contrast microscopy23 suffer from a significantly decreased z range.

Here we relieve the trade-off between performance and technical simplicity that governs existing 3D bacterial tracking methods. We increase the z range accessible to high-throughput tracking in defocussed phase contrast microscopy by an order of magnitude by exploiting the full complex diffraction patterns visible for objects at a given position z along the optical axis. Using image cross-correlations, we compare the observed patterns with a library of reference images, and assign a z position based on the identity of the best match. Our conceptually simple novel technique allows for the 3D tracking of any micron-sized bacteria on a standard biological phase contrast microscope at high throughput and micron-scale resolution over a z range of 200 μm, and at a temporal rate that is limited only by the detector readout speed.

We demonstrate the power of our approach by harnessing its throughput, range and precision to reveal substantial and hitherto unrecognized contributions of cell individuality to population-level variability in two canonical examples of bacterial motility: (i) the run-tumble behaviour of E. coli, and (ii) the run-reverse-flick behaviour of V. alginolyticus.


3D localization by cross-correlation to a reference library

To create a reference library showing how intensity patterns in phase contrast microscopy change with z position, we align and combine z stacks of many 1 μm silica beads (Fig. 2a). In the absence of aberrations, the intensity pattern is symmetric about the focal plane, leading to ambiguity in the sign of the z position23. We avoid such ambiguity by introducing spherical aberrations that break the symmetry and enable a unique mapping between observed pattern and z position.

Figure 2: Tracking bacteria in 3D by comparing their out-of-focus diffraction patterns to a reference library.
figure 2

(a) A vertical slice through a reference library created by combining 73 aligned image stacks obtained for 1 μm silica beads. (b) Horizontal slices from the reference library at positions marked in a. (c) Images of a swimming E. coli bacterium at the corresponding positions. (d) Reconstructed 3D trajectory for the bacterium in c (see Supplementary Movie 3 for a rotating view). The trajectory starting point is marked by a black dot.

Supplementary Movie 1 shows an example recording of swimming E. coli bacteria. We localize bacteria in z by computing the normalized image cross-correlation for the bacterial image (Fig. 2c) with images of the reference library and identifying the reference image with the highest correlation value (Fig. 2b and Supplementary Movie 2, see Methods for details). Its position in the reference library yields the corresponding z position. The (x, y) position is identified as the lateral shift between the two images that maximizes the cross-correlation value. Using always the last known position as a reference to constrain the search range, we repeat this procedure for each frame in a movie to assemble trajectories like the one shown in Fig. 2d, and for each of the tens of bacteria in the field-of-view.

Being based on phase contrast microscopy, our method is broadly applicable to any approximately micron-sized bacteria. We have tested the method on a range of enteric, soil and marine bacteria and recover their characteristic motility patterns (see Fig. 3a). Run-tumble motility is observed for the enteric species E. coli and Salmonella typhimurium, as well as the soil bacterium Bacillus subtilis, and we confirm the recently reported run-reverse-flick motility for the marine species V. alginolyticus and Pseudoalteromonas haloplanktis3. For the soil bacterium Pseudomonas putida, we observe reversals, pauses and two different run speeds, concurrent with previous reports24,25.

Figure 3: Performance of 3D tracking.
figure 3

(a) The spatial range and broadness of applicability are illustrated by a compilation of example trajectories obtained by 3D tracking of a selection of bacterial species, recorded at 15 Hz. Trajectory starting points are marked by black dots. The shown volume corresponds approximately to the tracking range. (b) Throughput analysis for E. coli tracking, showing the average number of motile bacteria (defined by a median speed above 17 μm s−1, see inset) per frame with a given minimum trajectory duration. Lines of different colour correspond to 100 s long recordings at 15 Hz on 6 samples with different densities (see colour map), black denotes their average. A total of 5,890 trajectories were recorded. For the run-tumble analysis in Fig. 4, we combine these data and consider only trajectories with a minimum duration of 3 s. (c) r.m.s. localization error in x, y and z across the tracking z range. Errors are determined by tracking z stacks of 48 bacteria immobilized at random positions in the sample. The average r.m.s. error is <0.7 μm in z and <0.2 μm in x, y.

Using a × 40 objective, we are able to track dozens of bacteria over a range of 200 μm in z and at least 350 × 300 μm in x and y. As research goals differ in the minimum trajectory durations needed, we characterize the throughput as a function of this requirement using the example of E. coli (Fig. 3b). We observe a bimodal distribution of median trajectory speeds (see Fig. 3b inset), and attribute the lower peak to diffusing immotile bacteria. At the densities of OD600nm=0.003–0.006, we typically employ, we observe an average of 24 motile bacteria per frame whose trajectories are longer than 3 s. For comparison, Berg and Brown’s1 benchmark study on physical 3D tracking of E. coli was based on 20 min of total trajectory time, which can be obtained in less than a minute using our technique.

Diffraction ring overlaps between bacteria can in principle lead to trajectory loss for one or both of the bacteria if no reference image matching the observed pattern can be identified. The typical length of trajectories is therefore constrained not only by the spatial tracking range, but also by the density of bacteria. In practice, however, our cross-correlation-based tracking technique is robust to most such encounters (see Supplementary Movie 2). For E. coli in the above density regime, we obtain average trajectory durations between 3 and 5 s, that is, long enough to contain several tumble events per individual, given tumble frequencies on the order of 1 s−1 (ref. 1).

We assess the spatial resolution of our technique by determining the root mean square (r.m.s.) localization error for tracked z stacks of immobilized glass beads and E. coli bacteria (Supplementary Figs 1 and 2, see Methods for details). For both, we obtain approximately micron-scale resolution in z (Fig. 3c), that is, smaller than the size of the bacteria. The lateral localization error is <0.5 μm (Fig. 3c). A frame rate of 10–30 Hz is adequate for determining key motility parameters for the species we have examined, but our technique is capable of a temporal resolution constrained only by the detector’s readout speed (in our case, 100 Hz).

Directional persistence in E. coli run-tumble motility

We validate our technique by applying it to the E. coli strain AW405, whose run-tumble motility was the first to be studied by 3D tracking in 1972 (ref. 1). Here we combine 6 data sets of 100 s each, obtained at 15 Hz, and identify runs and tumbles (Fig. 4a) in 14,188 s of total trajectory time from 2,551 motile bacteria with a minimum trajectory duration of 3 s. We employ a tumble detection algorithm based on ref. 26 but modified to master the broad range of swimming speeds (see Fig. 3b insert) found in the population (see Methods for details).

Figure 4: Analysis of E. coli run-tumble motility.
figure 4

The analysis is based on 6 recordings of 100 s each from 4 different days, in which 14,188 s of total trajectory time from 2,551 motile bacteria with a minimum trajectory duration of 3 s were considered. (a) Example trajectory with marked tumbles (red) and runs (alternating between dark and light blue). (b) Histogram of run (blue) and tumble (red) durations from 6,015 and 8,350 events, respectively, with exponential fit. (c) Turning angle distribution plotted for different ranges of median run speeds. Speed ranges are chosen to contain approximately equal total trajectory time. The total number of analysed tumbles is 8,058. (d) Mean turning angle (black, left axis) and directional persistence (mean cosine of the turning angle, grey, right axis) plotted against average run speed. All error bars denote the s.e.m.

We find approximately exponentially distributed run and tumble durations (Fig. 4b) with characteristic time scales 0.64 s and 0.19 s, respectively, that are similar to those observed previously1. For the turning angles, we find a population mean of 57°, smaller than the 68° previously reported1. We also observe a significantly higher average swimming speed of 40 μm s−1 than the previously reported 14 μm s−1 (ref. 1), which we attribute to differences in growth or motility media compositions (see Supplementary Discussion 3). Furthermore, we likely sample the population more broadly with respect to swimming speeds as physical tracking was only applied to a manually selected set of swimming bacteria and was incapable of following the fastest individuals in the population26. To determine whether the speed range of the bacterial population affects the observed turning angles, we exploit the high throughput of our method and split up our data set of 8,058 turning angles to create separate turning angle distributions for 5 different run speed ranges. Surprisingly, we find that the turning angle distribution varies with run speed (Fig. 4c). Both theoretical considerations27,28,29 and experimental evidence12,13 indicate that the average cosine of the turning angle, called directional persistence, is an important determinant of chemotactic performance. We show that the directional persistence increases approximately linearly by a factor of 3 over the speed range of 20–60 μm s−1 (Fig. 4d). As the tumble frequency we obtain is independent of run speed (Supplementary Fig. 3), we exclude detection bias as a source of this correlation. The increased persistence of faster swimming bacteria is also evident upon visual inspection of trajectories (Supplementary Fig. 4).

Directional persistence is expected to have opposite effects on the conflicting chemotactic requirements of drift velocity and accumulation at attractant concentration peaks27, hence its dependence on run speed could have non-trivial consequences for chemotactic behaviour. Elucidating how these opposing constraints are balanced in run-tumble motility could yield clues to the selection criteria relevant in the evolution of E. coli chemotaxis.

In addition, our observation may help shed light on the mechanisms underlying reorientation during a tumble. E. coli swimming is driven by the rotation of helical appendages called flagella. While during runs, all flagella rotate counterclockwise and form a bundle that pushes the cell forward, a tumble occurs when one or more flagella reverse direction and leave the bundle30. The resulting reorientation has been modelled as rotational diffusion, which implies a persistence that decreases exponentially with tumble duration31. In contrast, the modulation in turning angle we observe does not result from differences in tumble duration (Supplementary Fig. 3). Propulsion and reorientation with multiple flagella are challenging to model, and even the mechanical determinants of swimming speed remain unknown32. Further imaging studies of swimming cells with labelled flagella30 may be able to clarify this point. Our findings then provide strong constraints for possible hydrodynamic models of flagellar bundle mechanics.

Behavioural individuality in run-reverse-flick motility

Aside from the advantages shown in Fig. 1, 3D tracking is superior to 2D slicing with respect to the trajectory durations that can be measured before an individual is lost. Here we show how this feature can be harnessed to reveal phenotypic heterogeneity in motile behaviour using the example of the marine bacterium V. alginolyticus.

Our 3D trajectories confirm the run-reverse-flick behaviour recently reported by Xie et al.3 as composed of runs interrupted by turning events that alternate between reversals (180°) and ‘flicks’ of a smaller magnitude (Fig. 5a,b). Flicks were recently shown to result from buckling of the flagellar hook when bacteria resume forward motion after a reversal4 (see Fig. 5c). The broadness of the flick angle distribution obtained by Xie et al.3 in 2D at the population level leaves open the question whether the flick process is inherently random or whether individuals differ in their flick behaviour.

Figure 5: Individuality in run-reverse-flick motility.
figure 5

(a) An 8.3-s-long 3D trajectory of a V. alginolyticus bacterium displaying run-reverse-flick motility. Flicks (red) and reversals (cyan) are marked. (b) Turning angles alternate between reversals (180°) and smaller flicks. (c) The direction of rotation of the polar flagellum determines whether the bacterium is pushed or pulled by the flagellum. Reversals result from switching from pushing to pulling. Flicks result from buckling of the flagellar hook (red) on resuming forward movement. A smaller deflection corresponds to a larger measured flick angle. (d) Histograms showing the population distribution of all turning angles (2,180 events, dark blue), confirmed flicks (581 events, red) and confirmed reversals (771 events, cyan). (e) Body length and flick angles for 20 individuals that displayed at least 6 flicks in their trajectory. Black: mean±s.e.m., red: scatter plot of underlying data.

Our large z range enables us to obtain many trajectories that contain a sufficient number of flicks to test the hypothesis of inter-individual variability. While the broad population distribution of flick angles we extract (Fig. 5d) is similar to that observed previously in 2D slicing3, we show that individuals actually show very narrow flick angle distributions with different means (Fig. 5e). Moreover, we find that the flick angle, which is defined as the angle between the reverse and forward runs flanking the flick event (Fig. 5c), shows a pronounced dependence on body length (Fig. 5e). The observed dependence is consistent with longer bacteria experiencing an increased viscous drag that counteracts the angular reorientation during a flick4, leading to a flick angle closer to 180°. Comparing the flick angle s.d. of 32° on the population level and 15° for individuals, we conclude that differences between individuals account for 80% of the observed population variance.

Based on the previously measured population mean flick angle of 90 degrees (ref. 3), models of run-reverse-flick motility have thus far assumed a complete randomization of the swimming direction during flicks33,29. In contrast, our data reveal a significant level of determinism in the flicking behaviour of individuals that may have implications for the performance of run-reverse-flick motility in chemotaxis. In addition, the observed behavioural individuality implies a spread in motility patterns even within isogenic populations which may have important ecological consequences. Furthermore, our result suggests that individuals might undergo a systematic shift in motility patterns during their life cycle as they elongate between cell divisions.


We report a simple yet powerful method for high-throughput tracking of bacteria in 3D, which stands out among existing techniques in its ease of use and broad applicability. No components beyond a standard phase contrast microscope and a camera are required for the data acquisition, and any micron-sized bacteria can be tracked. In contrast to physical tracking methods that follow single cells14,15, dozens of trajectories can be acquired simultaneously. Relative to previous defocused imaging methods21,22,23, our enhanced tracking range in z enables acquisition of significantly longer 3D trajectories for unconfined cells. The micron-scale resolution we present in the current implementation is adequate for most bacterial tracking applications, but even higher resolution can be achieved by trading off tracking range in favour of resolution. For instance, over a range of 40 μm in z, a z error <250 nm is achievable by removing the deliberately introduced spherical aberrations (Supplementary Discussion 2 and Supplementary Fig. 5).

The advantages of 3D tracking extend beyond precise measurements of turning angles. Accurate determination of run length statistics requires both unambiguous detection of turning events (which is challenging in 2D projection) and the acquisition of trajectories significantly longer than typical run lengths (which rarely occur in 2D slicing) to avoid sampling biases. For example, assuming an underlying exponential run length distribution with parameters typical for E. coli, we estimate that 2D slicing incurs an error by a factor of at least 2 in the measurement of the average run length, whereas our 3D tracking underestimates the value by only 10–20% (Supplementary Discussion 1 and Supplementary Fig. 6). 3D tracking combines the ability to acquire longer trajectories with a high precision of turning angle determination, and both of these were essential for our discovery of individuality in V. alginolyticus flicking behaviour (Fig. 5). In 2D, long trajectories can only be achieved by either confining the bacteria to quasi-2D chambers34, where surface interactions perturb their behaviour8,10,11, or by observing unconfined bacteria in 2D projection, where the ability to detect individuality in turning angles is severely hampered by the increased measurement errors incurred in projection. We estimate that, to distinguish V. alginolyticus individuals with the same certainty in 2D projection as in 3D tracking, at least three times as many flick events per individual need to be observed, which, given the low frequency of long trajectories, would require orders of magnitude more data to be acquired (Supplementary Discussion 1). Thus the precise angle measurements obtained by 3D tracking reduce the number of events required to detect differences between individuals to routinely achievable values.

The high throughput of our method enables rapid and quantitative characterization of single-cell motility patterns across large populations. The applications demonstrated here highlight how the resulting large data sets can be used to analyse the contributions of stochasticity and individuality in bacterial behaviour, as well as gain insight into the underlying mechanisms. Such phenotypic heterogeneity in motile behaviour may represent a bet-hedging strategy with significant ecological implications5,7. To predict the consequences of single-cell behaviours over time and their combined effect at the population level, it is crucial to differentiate between systematic cell-to-cell variation and temporal randomness. In practice, it can be challenging to distinguish stochastic processes from deterministic ones governed by hidden variables, such as cell attributes that are not directly measured in the experiment35. With sufficiently large data sets, however, correlations between measured parameters can reveal the presence of such hidden variables. Our discovery of a correlation between run speed and directional persistence in E. coli motility exemplifies how our method’s high throughput can be exploited to reveal hidden deterministic factors and place limits on the magnitude of stochastic contributions to motile behaviour. More generally, our new method enables a data-driven approach towards a mechanistic understanding of randomness and diversity in bacterial motility behaviour.

Bacteria make up a significant fraction of the biomass on our planet36, and the impact of their motility on human health37,38, the environment39,40, agriculture41 and material processing42 is increasingly recognized in medicine, ecology and industry. Our method is ideally suited to service the growing interest in the study of bacterial motility across fields, as it enables accurate and efficient characterization of bacterial motility without specialized equipment. Because it does not require any labelling of bacteria, it is applicable to laboratory strains and natural/clinical isolates alike. Since the technique is compatible with any assay amenable to phase contrast microscopy, it opens the doors to fully capturing bacterial motility in a broad range of contexts from microfluidic platforms to complex 3D environments like those encountered in nature.


Bacterial culturing

Overnight cultures of bacteria were inoculated from glycerol stocks stored at −80 °C. Day cultures were inoculated with 40 μl overnight culture in 10 ml growth medium and grown in 100 ml culture flasks being shaken at 200 r.p.m. Table 1 lists the bacterial strains, culture media and temperatures, and Table 2 the media compositions. Bacteria were harvested from the day cultures in mid-exponential phase. For dissimilar growth and motility medium, bacteria were decanted into 50 ml plastic tubes and washed by three rounds of centrifugation (5 min at 5 k r.p.m. at 21° C in an Eppendorf 5804 R centrifuge), each followed by gentle resuspension in 10 ml motility medium. Bacteria were used for imaging within 2 h after washing.

Table 1 Strains and culturing conditions.
Table 2 Media used for growth and motility experiments.

Bacterial sample preparation

Sample chambers with a height of 300 μm were created by using three layers of parafilm as a spacer between a microscopy slide and an 18 × 18 mm #1 coverslip (Menzel Gläser, thickness 150±3 μm). The chamber was heated on a hotplate and pressed to seal. Bacteria were diluted to a target optical density of 0.003–0.006 at 600 nm in the appropriate motility medium and flowed into the chamber via capillary forces. The ends of the chamber were then sealed with hot valap (a mixture of vaseline, lanolin and paraffin).

Microscopy and data acquisition

The sample chamber was placed on a Nikon TE2000-U inverted optical microscope equipped with an air condenser (Nikon LWD, numerical aperture (NA) 0.52) and a × 40 phase contrast lens (Nikon, S Plan Fluor ELWD, × 40, Ph2, NA 0.6). We set the objective lens’s correction collar to 1.2 mm to introduce spherical aberrations, which introduce asymmetry about the focal plane in the point spread function and avoid localization problems near the focus. As an alternative to using the correction collar, spherical aberrations can also be introduced by imaging through a thicker substrate than the objective lens is optimized for, for example, a slide instead of a coverslip. We verified that the point spread function is robust to day-to-day changes in the optical set-up as may arise from temporary removal of components such as camera and objective lens, readjustments of movable parts such as field stops, small errors in the correction collar setting and the variation of coverslip thickness within one package, (± 3μm). For recordings, we moved the sample 100 μm towards the objective lens relative to the chamber’s inner bottom surface, corresponding to a focal position 133 μm inside the sample, given the refractive index of nMotM=1.334 of our motility medium. The illumination was adjusted to produce 20,000 counts per pixel. For each recording, 1,500 frames were acquired at a frame rate of 15 Hz and an exposure time of 5 ms using a PCO.edge sCMOS camera (pixel size 6.5 μm, 2,560 × 2,160 pixels). The data were saved as a series of 16-bit tiff files of 193 images each, corresponding to a maximum file size of 2 GB.

Background correction

To remove unwanted background features, we adopt a median-based correction technique. For each movie file, we compute the pixel-wise median of all contained images. We then divide each image by this median and multiply by 20,000 to approximately restore the original mean intensity. This procedure removes all stationary objects and creates a flat background.

Image cross-correlation

The normalized cross-correlation of two image matrices I1 and I2 is given by

Here and σ(...) denote the mean and s.d. across all pixels. In practice, images are subject to noise:

where Ni refers to the noise and Fi to the feature of interest. What is generally of interest is a measure of the similarity of the noisefree features of two images, C(F1, F2). Inserting equation (2) into equation (1), and assuming that the noise has zero mean and is uncorrelated with features or between different images, we find

which allows a conversion from the readily computed C(I1, I2) to the desired C(F1, F2) via the correction factors

which can be computed if the variance of the noise, σ2(Ni), is known. For motility movies, we estimate a fixed value for the noise variance based on the variance of the background by measuring the inter-pixel intensity variance in areas of the sample that show no features, but only background. For the reference library, the noise varies between images as they differ in the amount of data contributing to them. We therefore estimate the noise separately for each image of the reference library.

Image cross-correlations are computed via fast Fourier transforms on regions of interest of 256 × 256 pixels. The output is a matrix whose indices give the cross-correlation values for each possible lateral shift of the images against each other.

Reference stack generation

Reference stacks were created from images of spherical beads rather than bacteria, which are generally elongated and oriented in random directions. The symmetry of the beads eases alignment of different stacks for averaging, and prevents a bacterium’s orientation in the xy plane from affecting its cross-correlation to the reference image. Glass beads with a nominal diameter of 1 μm (PSi-1.0, Kisker Biotech, Germany) were empirically determined to produce contrast similar to bacteria in phase contrast microscopy. To facilitate image acquisition at defined positions relative to the focus with a surrounding medium of refractive index similar to media used in motility assays, the beads were immobilized in a 3% polyacrylamide (PAC) gel. The refractive index of the gel at this concentration is nPAC3=1.338, comparable to nMotM=1.334 measured for motility medium. Refractive index measurements were performed with a hand-held refractometer calibrated against sucrose solutions of known concentrations. Lower concentrations of acrylamide were found not to solidify. From a 50 μg ml−1 stock solution, the beads were diluted 1:100 into an acrylamide solution (375 μl 40% acrylamide, 4.57 ml H2O, 50 μl 10% ammonium persulfate in H2O, 5 μl N,N,N′,N′-tetramethylethane-1,2-diamine) which was then flowed into a sample chamber as described above and sealed with nail polish. Once the PAC solution had solidified, image stacks were acquired of the now immobilized glass beads. Focal plane and imaging conditions were as for live bacteria. Using a piezo stage with a range of 200 μm, the sample was moved in 1,000 steps of Δx=100 nm, centred about the focal plane, and one image acquired at each position. These steps correspond to steps in focal plane by nΔx=134 nm inside the sample.

For each bead localized inside the scanned volume, a substack of 512 × 512 pixels in x and y approximately centred laterally about the bead was extracted. The substacks were background-corrected based on the median across the entire substack.

As beads were located at unknown random positions in x, y and z, their image stacks need to be aligned relative to each other before being combined. 3D cross-correlations can be employed to determine their 3D positions relative to each other. For each bead k, a 3D array Bk consisting of the inner 256 × 256 pixel region of its image stack is created. For one arbitrary, but fixed bead i and each other bead j, the normalized 3D cross-correlation, Cij, of Bi and Bj is computed. Cij is another 3D array, with each entry representing the cross-correlation value of the arrays Bi and Bj at one particular 3D shift relative to each other. The position of the entry with the maximum value in Cij then reflects the 3D relative shift of the beads i and j to each other.

With known relative 3D alignment, the full 512 × 512 stacks could be combined into one reference library. Because the initial placement of the beads was random across z, the substacks cover different ranges relative to the bead’s focus. Conversely, not every bead stack covers every possible z position relative to the bead’s focus. For each z position relative to the focus, an image was obtained as the pixel-wise median across the respective images from those substacks covering this z position. Only those positions with at least 15 contributing substacks were retained. The resulting image stack covered 220 μm and was constructed from image stacks of 73 different beads.

Tracking algorithm

Tracking was implemented using a custom-written Matlab (The MathWorks) programme. Briefly, once a bacterium is identified, it is tracked both forwards and backwards in time, always using the last known position to constrain the search radius in all three spatial dimensions.

Positions are determined in a multistep procedure. A 256 × 256 pixel region-of-interest around the last known position is cross-correlated against a substack of the reference library centred about the last known z position. For each reference image in the substack, the maximum cross-correlation value across a range of lateral shifts is determined. The search range is set to cover the maximal displacement possible at the maximum plausible bacterial swimming speed, which we estimate as 150 μm s−1 for the marine bacteria and 100 μm s−1 for the other species.

A 13-point neighbourhood around the maximum cross-correlation value is fitted with a second order polynomial to extract the z position of the maximum. The position of the parabola’s maximum is rounded to the z position of the nearest reference image, which is taken as the object’s z position. The new lateral position is determined from the lateral shift at which the cross-correlation with the chosen reference image is maximal. If the cross-correlation value at the determined position is lower than a retention threshold (typically set to 0.35), the trajectory ends. This can occur when the diffraction pattern of the tracked bacterium overlaps with another one with higher contrast. Positions are also rejected if they lie at the edge of the search range. This typically occurs when bacteria leave the tracking range.

For each frame, putative new bacteria are identified using a thresholding procedure. Briefly, the absolute difference to the image median is computed, and a threshold applied to create a binary image. Typical threshold values used are 0.03–0.1 times the image median. The binary image is eroded to avoid spurious noise, followed by dilation to fill in gaps between diffraction rings. Disks with radii of 3 pixels and 30 pixels are used as structuring elements for erosion and dilation, respectively. The resulting image is segmented, and the centroids of segments are taken as putative lateral bacterial locations. Locations within a threshold lateral distance of 60 pixels to known bacteria or 130 pixels to the image border are rejected. These distances are set deliberately large so as to accommodate the uncertainty of the putative locations.

For each remaining putative location, the reference library is searched for a matching image. The detection procedure is not sensitive enough to identify bacteria throughout the entire tracking range, therefore we constrain the search to approximately the inner 60% of the reference library and thus miss trajectories that never enter this range. If a correlation with a reference image above an acceptance threshold (typically set at 0.6) is found, a new trajectory is created if the position does not lie within a joining distance to a known bacterium. We typically use a joining distance of 10 pixels in x and y and 30 reference library slices with a spacing of 134 nm in z. Upon creation, the bacterium is tracked backwards in time. If its position at a frame in the past lies within the joining distance of the position at which another trajectory ended at the same frame, the trajectories are joined.

Our custom Matlab-based implementation of the tracking algorithm is available on request. A user-friendly version is under development for release at a later date.

Determination of localization precision

To determine the localization precision of our technique for bacteria, we prepared stacks for immobilized E. coli as for glass beads above, but with either 100 or 200 nm steps between frames. The tracking procedure was then applied to stacks of glass beads and bacteria. For glass beads, a rotated version of the reference library (180° about the z axis) is used to avoid artefacts from spurious correlations due to the fact that the reference library was created from these same stacks of 73 glass beads. For x and y, localization errors were determined as s.d. of the lateral position. For z, localization errors are determined as the residuals of a linear fit to the extracted z position against the known z position. As the magnitude of these errors depends on the z position, we compute the r.m.s. error across 48 different bacteria for bins with a width of 2 μm in z (Fig. 3c).

E. coli run-tumble analysis

From the trajectories obtained from our tracking procedure, velocities are computed as the fourth order central difference26,

where T=1/15 s is the time between frames, and direction changes as the angles between subsequent velocity vectors.

We only consider trajectories that span at least 3 s and show a median speed larger than 17 μm s−1. Our run-tumble calling algorithm follows the procedure laid out by ref. 26 in that a run ends at time point ti if either or if and the angle between the sum of the velocities from ti−2ti and those from ti +1ti+3 also exceed αc. A new run begins at ti if . A run hence has a minimal duration of four time points, while a tumble can have zero length.

To cope with the large range of swimming speeds present in the bacterial population, the threshold αc is determined relative to the median direction change, , each individual displays during runs: , as opposed to using a fixed absolute value as previously26. To arrive at a self-consistent definition of runs, we iterate this procedure 20 times. The number of tumbles found typically stabilizes by about 10 iterations. The factor cE was chosen so as to balance the rate of missed tumbles and erroneously called tumbles based on visual inspection of trajectories. At the chosen value of cE=3, we observe 5% false negatives and 5% false positives.

Turning angles are measured as the angle between the sum of the last three velocity vectors of the run preceding the tumble and the first three of the subsequent run.

V. alginolyticus run-reverse-flick analysis

For V. alginolyticus, we only consider trajectories that span at least 3 s and show a median speed larger than 40 μm s−1 as flicks are rare at low speeds4. The average speed of motile bacteria is 48 μm s−1. To detect turning events, we employ a similar strategy as for the tumble detection for E. coli, with several modifications. First, rather than the iterative method used for E. coli, we fix the detection threshold at with cV=4. Second, a new run begins at ti if , hence runs can be as short as three time points. And third, we measure turning angles between sums of two rather than three velocity vectors.

Among these, we then identify flicks and reversals in a two-step procedure. First, if all even turning events within a trajectory with at least six events are at least 2 s.d away from the mean of the odd turns, and vice versa, then the set with the smaller mean is considered flicks and the other one reversals. If the odd and even turns are not well-separated, then if a turn has a magnitude below a threshold and both adjacent turns are above it, the middle turn is considered a flick and the adjacent ones reversals. Using a threshold of 155°, we identify 581 flicks and 771 reversals out of 2,180 turns detected in more than 30 min of total trajectory time.

For a set of 20 trajectories that contained at least 6 flicks, body length was measured from frames where the bacterium was swimming approximately in the xy plane. Due to the spherical aberrations present, the bacterium’s body is visible for a range of z positions. We estimate an error of 2 pixels for the length measurement.

Additional information

How to cite this article: Taute, K. M. et al. High-throughput 3D tracking of bacteria on a standard phase contrast microscope. Nat. Commun. 6:8776 doi: 10.1038/ncomms9776 (2015).


  1. Berg, H. & Brown, D. Chemotaxis in Escherichia coli analysed by three-dimensional tracking. Nature 239, 500–504 (1972).

    ADS  CAS  Article  Google Scholar 

  2. Ahmed, T. & Stocker, R. Experimental verification of the behavioral foundation of bacterial transport parameters using microfluidics. Biophys. J. 95, 4481–4493 (2008).

    ADS  CAS  Article  Google Scholar 

  3. Xie, L., Altindal, T., Chattopadhyay, S. & Wu, X.-L. Bacterial flagellum as a propeller and as a rudder for efficient chemotaxis. Proc. Natl Acad. Sci. USA 108, 2246–2251 (2011).

    ADS  CAS  Article  Google Scholar 

  4. Son, K., Guasto, J. S. & Stocker, R. Bacteria can exploit a flagellar buckling instability to change direction. Nat. Phys. 9, 494–498 (2013).

    CAS  Article  Google Scholar 

  5. Spudich, J. & Koshland, D. Non-genetic individuality: chance in the single cell. Nature 262, 467–471 (1976).

    ADS  CAS  Article  Google Scholar 

  6. Masson, J.-B., Voisinne, G., Wong-Ng, J., Celani, A. & Vergassola, M. Noninvasive inference of the molecular chemotactic response using bacterial trajectories. Proc. Natl Acad. Sci. USA 109, 1802–1807 (2012).

    ADS  CAS  Article  Google Scholar 

  7. Frankel, N. W. et al. Adaptability of non-genetic diversity in bacterial chemotaxis. eLife 3, e03526 (2014).

    Article  Google Scholar 

  8. Frymier, P. & Ford, R. Three-dimensional tracking of motile bacteria near a solid planar surface. Proc. Natl Acad. Sci. USA 92, 6195–6199 (1995).

    ADS  CAS  Article  Google Scholar 

  9. Berke, A., Turner, L., Berg, H. & Lauga, E. Hydrodynamic attraction of swimming microorganisms by surfaces. Phys. Rev. Lett. 101, 038102 (2008).

    ADS  Article  Google Scholar 

  10. Li, G., Tam, L.-K. & Tang, J. X. Amplified effect of Brownian motion in bacterial near-surface swimming. Proc. Natl Acad. Sci. USA 105, 18355–18359 (2008).

    ADS  CAS  Article  Google Scholar 

  11. Molaei, M., Barry, M., Stocker, R. & Sheng, J. Failed escape: solid surfaces prevent tumbling of Escherichia coli. Phys. Rev. Lett. 113, 068103 (2014).

    ADS  Article  Google Scholar 

  12. Saragosti, J. et al. Directional persistence of chemotactic bacteria in a traveling concentration wave. Proc. Natl Acad. Sci. USA 108, 16235–16240 (2011).

    ADS  CAS  Article  Google Scholar 

  13. Bubendorfer, S., Koltai, M., Rossmann, F., Sourjik, V. & Thormann, K. M. Secondary bacterial flagellar system improves bacterial spreading by increasing the directional persistence of swimming. Proc. Natl Acad. Sci. USA 111, 11485–11490 (2014).

    ADS  CAS  Article  Google Scholar 

  14. Berg, H. How to track bacteria. Rev. Sci. Instrum. 42, 868–871 (1971).

    ADS  CAS  Article  Google Scholar 

  15. Liu, B. et al. Helical motion of the cell body enhances Caulobacter crescentus motility. Proc. Natl Acad. Sci. USA 111, 1–5 (2014).

    CAS  Article  Google Scholar 

  16. Garcia-Sucerquia, J. et al. Digital in-line holographic microscopy. Appl. Opt. 45, 836–850 (2006).

    ADS  Article  Google Scholar 

  17. Vater, S. M. et al. Swimming behavior of Pseudomonas aeruginosa studied by holographic 3D tracking. PLoS ONE 9, e87765 (2014).

    ADS  Article  Google Scholar 

  18. Molaei, M. & Sheng, J. Imaging bacterial 3D motion using digital in-line holographic microscopy and correlation-based de-noising algorithm. Opt. Express 22, 3232–3238 (2014).

    Article  Google Scholar 

  19. Cheong, F. et al. Rapid, high-throughput tracking of bacterial motility in 3D via phase-contrast holographic video microscopy. Biophys. J. 108, 1248–1256 (2015).

    ADS  CAS  Article  Google Scholar 

  20. Speidel, M., Jonás, A. & Florin, E.-L. Three-dimensional tracking of fluorescent nanoparticles with subnanometer precision by use of off-focus imaging. Opt. Lett. 28, 69–71 (2003).

    ADS  CAS  Article  Google Scholar 

  21. Wu, M., Roberts, J. W., Kim, S., Koch, D. L. & DeLisa, M. P. Collective bacterial dynamics revealed using a three-dimensional population-scale defocused particle tracking technique. Appl. Environ. Microbiol. 72, 4987–4994 (2006).

    CAS  Article  Google Scholar 

  22. Li, G. & Tang, J. Accumulation of microswimmers near a surface mediated by collision and rotational brownian motion. Phys. Rev. Lett. 103, 078101 (2009).

    ADS  Article  Google Scholar 

  23. Edwards, M. R., Carlsen, R. W., Zhuang, J. & Sitti, M. Swimming characterization of Serratia marcescens for bio-hybrid micro-robotics. J. Micro-Bio Robot. 9, 47–60 (2014).

    Article  Google Scholar 

  24. Duffy, K. & Ford, R. Turn angle and run time distributions characterize swimming behavior for Pseudomonas putida. J. Bacteriol. 179, 1428–1430 (1997).

    CAS  Article  Google Scholar 

  25. Theves, M., Taktikos, J., Zaburdaev, V., Stark, H. & Beta, C. A bacterial swimmer with two alternating speeds of propagation. Biophys. J. 105, 1915–1924 (2013).

    ADS  CAS  Article  Google Scholar 

  26. Berg, H. & Brown, D. Chemotaxis in Escherichia coli analysed by three-dimensional tracking. Antibiot. Chemother. 19, 55–78 (1974).

    CAS  Article  Google Scholar 

  27. Locsei, J. T. Persistence of direction increases the drift velocity of run and tumble chemotaxis. J. Math. Biol. 55, 41–60 (2007).

    MathSciNet  CAS  Article  Google Scholar 

  28. Vladimirov, N., Lebiedz, D. & Sourjik, V. Predicted auxiliary navigation mechanism of peritrichously flagellated chemotactic bacteria. PLoS Comput. Biol. 6, e1000717 (2010).

    ADS  MathSciNet  Article  Google Scholar 

  29. Taktikos, J., Stark, H. & Zaburdaev, V. How the motility pattern of bacteria affects their dispersal and chemotaxis. PLoS ONE 8, e81936 (2013).

    ADS  Article  Google Scholar 

  30. Turner, L., Ryu, W. & Berg, H. Real-time imaging of fluorescent flagellar filaments. J. Bacteriol. 182, 2793–2801 (2000).

    CAS  Article  Google Scholar 

  31. Saragosti, J., Silberzan, P., Buguin, A. & Modeling, E. coli tumbles by rotational diffusion. Implications for chemotaxis. PLoS ONE 7, e35412 (2012).

    ADS  CAS  Article  Google Scholar 

  32. Darnton, N. C., Turner, L., Rojevsky, S. & Berg, H. C. On torque and tumbling in swimming Escherichia coli. J. Bacteriol. 189, 1756–1764 (2007).

    CAS  Article  Google Scholar 

  33. Altindal, T., Xie, L. & Wu, X.-L. Implications of three-step swimming patterns in bacterial chemotaxis. Biophys. J. 100, 32–41 (2011).

    ADS  CAS  Article  Google Scholar 

  34. Sager, B. M., Sekelsky, J. J., Matsumura, P. & Adler, J. Use of a computer to assay motility in bacteria. Anal. Biochem. 173, 271–277 (1988).

    CAS  Article  Google Scholar 

  35. Sandler, O. et al. Lineage correlations of single cell division time as a probe of cell-cycle dynamics. Nature 519, 468–471 (2015).

    ADS  CAS  Article  Google Scholar 

  36. Whitman, W. B., Coleman, D. C. & Wiebe, W. J. Prokaryotes: the unseen majority. Proc. Natl Acad. Sci. USA 95, 6578–6583 (1998).

    ADS  CAS  Article  Google Scholar 

  37. Terry, K., Williams, S. M., Connolly, L. & Ottemann, K. M. Chemotaxis plays multiple roles during Helicobacter pylori animal infection. Infect. Immun. 73, 803–811 (2005).

    CAS  Article  Google Scholar 

  38. Lane, M. C., Alteri, C. J., Smith, S. N. & Mobley, H. L. T. Expression of flagella is coincident with uropathogenic Escherichia coli ascension to the upper urinary tract. Proc. Natl Acad. Sci. USA 104, 16669–16674 (2007).

    ADS  CAS  Article  Google Scholar 

  39. Mitchell, J. G. & Kogure, K. Bacterial motility: links to the environment and a driving force for microbial physics. FEMS Microbiol. Ecol. 55, 3–16 (2006).

    CAS  Article  Google Scholar 

  40. Berendsen, R. L., Pieterse, C. M. J. & Bakker, P. A. H. M. The rhizosphere microbiome and plant health. Trends Plant Sci. 17, 478–486 (2012).

    CAS  Article  Google Scholar 

  41. López-Garca, S. L. et al. In-furrow inoculation and selection for higher motility enhances the efficacy of Bradyrhizobium japonicum nodulation. Agron. J. 101, 357–363 (2009).

    Article  Google Scholar 

  42. Van Houdt, R. & Michiels, C. W. Biofilm formation and the food industry, a focus on the bacterial outer surface. J. Appl. Microbiol. 109, 1117–1131 (2010).

    CAS  Article  Google Scholar 

Download references


We would like to thank Howard Berg (Harvard University), Kelly Hughes (the University of Utah), Roman Stocker (MIT) and Carsten Beta (the University of Potsdam) for kindly sharing bacterial strains. This work is part of the research programme of the Foundation for Fundamental Research on Matter (FOM), which is part of the Netherlands Organisation for Scientific Research (NWO). T.S.S. acknowledges support by the Paul G. Allen Family Foundation.

Author information

Authors and Affiliations



K.M.T., S.G., S.J.T. and T.S.S. conceived the method and devised the research; K.M.T. performed the experiments, wrote the tracking software and analysed the data; K.M.T. and S.G. performed the theoretical analyses in Supplementary Discussion 1; K.M.T. and T.S.S. wrote the manuscript with inputs from S.G. and S.J.T.

Corresponding author

Correspondence to T.S. Shimizu.

Ethics declarations

Competing interests

The authors declare no competing financial interests.

Supplementary information

Supplementary Information

Supplementary Figures 1-6, Supplementary Discussion 1-3 and Supplementary References (PDF 2859 kb)

Supplementary Movie 1

A 21.5 s long segment of a recording of swimming E. coli bacteria, showing 37.5% of the full field of view. Playback is real time. The video has been binned 5x5 times spatially. Scale bar: 50 μm. (AVI 2064 kb)

Supplementary Movie 2

Tracking one bacterium from Supplementary Movie 1, corresponding to the individual depicted in Fig. 2c,d in the main text. The left panel is centred on the last known x-y position of the bacterium. The right panel shows the best-matching reference image. The black cross in the left panel marks the current x-y position of the bacterium as determined by the 3D tracking algorithm. Scale bar: 10 μm. (AVI 2799 kb)

Supplementary Movie 3

3D trajectory assembled for the bacterium tracked in Supplementary Movie 2, corresponding to a rotating view of Fig. 2d in the main text. (AVI 6763 kb)

Rights and permissions

This work is licensed under a Creative Commons Attribution 4.0 International License. The images or other third party material in this article are included in the article’s Creative Commons license, unless indicated otherwise in the credit line; if the material is not included under the Creative Commons license, users will need to obtain permission from the license holder to reproduce the material. To view a copy of this license, visit

Reprints and Permissions

About this article

Verify currency and authenticity via CrossMark

Cite this article

Taute, K., Gude, S., Tans, S. et al. High-throughput 3D tracking of bacteria on a standard phase contrast microscope. Nat Commun 6, 8776 (2015).

Download citation

  • Received:

  • Accepted:

  • Published:

  • DOI:

Further reading


By submitting a comment you agree to abide by our Terms and Community Guidelines. If you find something abusive or that does not comply with our terms or guidelines please flag it as inappropriate.


Quick links

Nature Briefing

Sign up for the Nature Briefing newsletter — what matters in science, free to your inbox daily.

Get the most important science stories of the day, free in your inbox. Sign up for Nature Briefing