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.
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.
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.
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).
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.
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.
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.
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.
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.
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 x–y 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 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−2−ti and those from ti +1−ti+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 x–y 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.
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).
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.
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.
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.
3D trajectory assembled for the bacterium tracked in Supplementary Movie 2, corresponding to a rotating view of Fig. 2d in the main text.
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 http://creativecommons.org/licenses/by/4.0/