Article | Open | Published:

# Motility-based label-free detection of parasites in bodily fluids using holographic speckle analysis and deep learning

## Abstract

Parasitic infections constitute a major global public health issue. Existing screening methods that are based on manual microscopic examination often struggle to provide sufficient volumetric throughput and sensitivity to facilitate early diagnosis. Here, we demonstrate a motility-based label-free computational imaging platform to rapidly detect motile parasites in optically dense bodily fluids by utilizing the locomotion of the parasites as a specific biomarker and endogenous contrast mechanism. Based on this principle, a cost-effective and mobile instrument, which rapidly screens ~3.2 mL of fluid sample in three dimensions, was built to automatically detect and count motile microorganisms using their holographic time-lapse speckle patterns. We demonstrate the capabilities of our platform by detecting trypanosomes, which are motile protozoan parasites, with various species that cause deadly diseases affecting millions of people worldwide. Using a holographic speckle analysis algorithm combined with deep learning-based classification, we demonstrate sensitive and label-free detection of trypanosomes within spiked whole blood and artificial cerebrospinal fluid (CSF) samples, achieving a limit of detection of ten trypanosomes per mL of whole blood (~five-fold better than the current state-of-the-art parasitological method) and three trypanosomes per mL of CSF. We further demonstrate that this platform can be applied to detect other motile parasites by imaging Trichomonas vaginalis, the causative agent of trichomoniasis, which affects 275 million people worldwide. With its cost-effective, portable design and rapid screening time, this unique platform has the potential to be applied for sensitive and timely diagnosis of neglected tropical diseases caused by motile parasites and other parasitic infections in resource-limited regions.

## Introduction

Parasitic infections affect billions of people globally and cause a massive socioeconomic burden1,2,3,4. Although they are usually associated with low-income countries, parasitic infections are becoming an increasing health concern in developed countries. In the United States, millions of people are affected by various parasites, which can cause severe illnesses and even death1. Motility is common among disease-causing organisms, from unicellular pathogenic bacteria and parasitic protozoa to multicellular parasitic worms and ectoparasites. The ability of an organism to move from one location to another location has distinct benefits for successful infection and transmission, and motility is often central to virulence5,6,7. Despite the importance of motility for a parasitic lifestyle, parasite motility remains an understudied area of research, and motility-based diagnostics are considerably underexplored.

Human African trypanosomiasis (HAT), which is also known as sleeping sickness, and Chagas disease (i.e., American trypanosomiasis) are examples of neglected tropical diseases caused by motile protozoan parasites. Neglected tropical diseases have historically been given little attention, disproportionately affect the world’s poorest people, and lack adequate medical interventions for diagnosis and treatment. Vaccines for these diseases do not exist, and existing chemotherapeutics suffer from high toxicity and drug resistance8,9,10,11. Two devastating diseases—HAT and Chagas disease—are caused by related trypanosome parasites12. Trypanosoma brucei (T. brucei gambiense and T. brucei rhodesiense subspecies) is responsible for HAT9,10, and related species cause animal diseases that present a substantial economic burden in some of the poorest areas of the world. The parasite is transmitted to humans by the tsetse fly and survives extracellularly in blood and tissues, with dramatic impacts on the central nervous system9,10. HAT is endemic in ~30 sub-Saharan Africa countries with ~65 million people who are at risk of infection4. The number of reported cases has decreased to historic lows but past declines in case numbers have been followed by major epidemics. Therefore, HAT remains an important human health risk13. Chagas disease is caused by Trypanosoma cruzi (T. cruzi), which invades and replicates inside host cells and causes severe pathology within host tissues14. Although Chagas disease is primarily transmitted by the bite of triatomine bugs, other transmission routes include blood transfusion and ingestion of contaminated food or drink15. The disease is endemic in Latin America, where it affects more than 6 million people11,15,16. More than 300,000 people in the United States are estimated to be infected17 with further increases expected as globalization and climate change impact the distribution of disease-transmitting vectors.

Both trypanosomiases can be classified into an initial stage during which trypanosomes circulate in the bloodstream and medical treatment is most effective (stage I HAT and acute Chagas disease) and a later stage that is exceedingly more difficult, if not impossible, to cure (stage II HAT and chronic Chagas disease). Therefore, early detection is crucial for both diseases. However, rapid and sensitive diagnosis remains challenging, particularly in resource-limited settings18. In the diagnosis of HAT, assessing the stage of the disease is essential to determine the appropriate therapeutic strategy. While trypanosomes remain in the blood and lymph in stage I HAT, stage II HAT is characterized by trypanosomes that cross the blood-brain barrier and invade the central nervous system, which causes neurological symptoms and eventually death if untreated. Because the drugs used to treat stage I and stage II are not interchangeable and the drugs for stage II may be more toxic, identification of the stage of the disease is critical to inform the selection of a treatment regimen. Stage determination is currently performed by collecting cerebrospinal fluid (CSF) via a lumbar puncture and examining the CSF under a microscope for the presence of white blood cells (WBCs) and trypanosomes.

The length and width of both trypanosome species are typically ~20 μm and ~3 μm, respectively, and both trypanosome species use flagellum-mediated motility for parasite propulsion9,19,20. Detection of these motile parasites in large-volume bodily fluids, such as blood and CSF, is an important clinical challenge. For decades, the standard screening test for T. b. gambiense HAT has been the card agglutination test for trypanosomiasis (CATT), which detects the presence of antibodies against a specific parasite antigen4. However, CATT suffers from practical limitations as well as low specificity and sensitivity in some areas4. Moreover, a positive CATT test must typically be confirmed with direct visual observation in blood samples. Several molecular and immunological detection methods, including polymerase chain reaction (PCR) and rapid diagnostic tests (RDTs), have been developed. However, these methods are limited by insufficient specificity or sensitivity, the need for sophisticated equipment and highly trained personnel, or high production costs4,21,22. Thus, microscopic evaluation remains extensively employed for primary or secondary diagnosis, and direct observation of CSF remains the sole method for HAT stage determination4,22. Each milliliter of whole blood typically contains billions of red blood cells (RBCs), millions of WBCs and hundreds of millions of platelets. Conversely, blood parasitemia fluctuates during the course of infection and often is less than 100 parasites/mL18,23,24, which renders microscopic identification of trypanosomes a needle-in-a-haystack problem. The low sensitivity of direct observation methods therefore requires analytical separation devices, such as centrifugation or ion exchange purification, which partially limit analysis in resource-limited settings25,26,27. Thus, the need for development of new methods with high sensitivity and throughput that can reduce costs and simplify diagnosis is urgent.

To address this important challenge, we demonstrate a cost-effective and field-portable optical device (Fig. 1), which is based on lensless time-resolved holographic speckle imaging, for label-free, high-throughput, and sensitive detection of motile parasites in various bodily fluids and turbid media. Instead of staining a target analyte or using molecular biomarkers, our technique utilizes the locomotion of self-propelling parasites (or other motile microorganisms) as a biomarker and endogenous contrast mechanism. As a result, the sample preparation is very simple and fast, and does not require any benchtop-scale sample processing device/equipment, refrigeration, centrifugation, or purification (Fig. 2). As shown in Fig. 1a, the fluid sample to be screened is illuminated by a coherent light source (e.g., a laser diode), and a complementary metal-oxide-semiconductor (CMOS) image sensor is placed below the sample to record the time-varying holographic speckle patterns of the sample. This image sequence is analyzed by a custom-written computational motion analysis (CMA) algorithm that is based on holography to generate a three-dimensional (3D) contrast map, which is specific to the locomotion of the parasites in the sample volume. A deep learning-based classifier is used to automatically detect and count the signal patterns of the parasites using the reconstructed 3D locomotion map (Fig. 3).

To increase the throughput and reduce the limit of detection (LoD) for rapid screening of large fluid volumes (~3.2 mL), we constructed a prototype that consists of three identical lensless speckle imaging modules mounted on a linear translation stage to screen three individual sample tubes in parallel (Fig. 1a and Supplementary Movie 1). Each imaging module is translated to different sections of the capillary tube that contains the liquid sample, where the CMOS image sensor captures high-frame-rate video sequences before advancing to the next section. Using this approach, ~3.2 mL of fluid sample is prepared, screened and analyzed within ~20 min using the setup shown in Fig. 1. Compared with standard benchtop optical microscopes, our design provides orders of magnitude increase in the screened sample volume (which is very important for the detection of parasites at low concentrations) and is significantly more compact and lightweight (1.69 kg). Furthermore, since a large sample volume is computationally screened in the axial direction, our imaging device does not need high precision in its opto-mechanical design, which also renders our platform highly cost-effective, where the total parts cost less than $1850 even in very low volume manufacturing. We employed trypanosomes to test our mobile platform and demonstrated its capability to detect parasites in spiked whole blood and CSF samples (Fig. 2), which are important for the diagnosis and stage determination of HAT and the diagnosis of acute Chagas disease. We performed spiking experiments for a series of concentrations using T. brucei brucei (a nonhuman infectious subspecies of Trypanosoma) as a model parasite for T.b. gambiense, T.b. rhodesiense and T. cruzi. Via deep learning-based classification, we showed that as few as 10 parasites per mL of whole blood and 3 parasites per mL of CSF can be reliably detected using our platform. Furthermore, we demonstrated the success of our platform to detect other motile parasites in bodily fluids by imaging Trichomonas vaginalis (T. vaginalis), the protozoan parasite responsible for trichomoniasis, which is the most common, nonviral sexually transmitted disease that affects 3.7 million people in the United States and 275 million worldwide28. We believe that this label-free, motility-based parasite detection platform can provide a cost-effective and portable approach for rapid and sensitive screening of trypanosomes and other motile parasites in resource-limited settings or as a high-throughput analytical research tool to study motile organisms in three dimensions. ## Results ### Detection of parasite locomotion in three dimensions using holographic speckle analysis To sustain a high frame rate (~26.6 fps), which is essential to our parasite detection technique, we chose to split the full field of view (FOV) of the image sensor in two halves, where each half ~14.7 mm2. Figure 4a-c shows the raw speckle patterns of a lysed, trypanosome-spiked whole blood sample captured by our image sensor. Even though this simple lysis process has significantly reduced the density of the blood sample, the interference patterns (e.g., Fig. 4b, c)) remain highly dense due to the random light scattering from the cell debris in the lysed blood. As a result, the diffraction patterns of the optically transparent and weakly scattering trypanosomes (Fig. 4c, yellow arrows) are buried under the speckle patterns, which renders their direct detection extremely challenging. To address this challenge, the spatial-temporal variations in the detected speckle patterns due to the rapid locomotion of motile trypanosomes within blood can be utilized. We took advantage of this approach and developed a CMA algorithm, which involves holographic back-propagation, differential imaging (with an optimally adjusted frame interval for trypanosome locomotion), and temporal averaging, conducted at each horizontal cross-section within the sample volume. Object function normalization (OFN) was introduced into each differential imaging step to suppress potential false positives due to unwanted, strongly scattering objects within the sample. The algorithm was followed by post-image processing and deep learning-based classification to identify the signals caused by trypanosomes (refer to the Materials and Methods section for details). Figure 4d, e exemplify the results of this computational process, where the “hotspots” in the processed images correspond to motile trypanosomes. To better illustrate this, based on the calculated 3D locations of the three hotspots in Fig. 4e (indicated by white arrows), we created in-focus movies of the amplitude and phase channels of the back-propagated diffraction patterns (refer to Supplementary Movie 2). Rapid locomotion of these trypanosomes can be observed in this video, although they are partially obscured by the interference patterns created by the other nonmotile objects (e.g., cell debris) in the sample. Similarly, the results of imaging trypanosomes within WBC-spiked artificial CSF samples are shown in Supplementary Fig. S1 and Supplementary Movie 3. Because CSF is predominantly a clear medium, the background noise level caused by quasi-static scatterers in the medium is significantly lower than the motile trypanosome signal level (i.e., the hotspots in Supplementary Fig. S1b). Digitally focused amplitude and phase movies also show lower-noise reconstructions of these motile trypanosomes, as shown in Supplementary Movie 3. As detailed in Table 1, >80% of the total image processing time to image and detect these trypanosomes is spent on the CMA algorithm, which involves thousands of fast Fourier transforms of ~6-megapixel images for each recorded image sequence (refer to the Materials and Methods section for details). Therefore, graphics processing unit (GPU)-based parallel computing is essential for the speed-up of the CMA algorithm. Using a single GPU, the entire image processing task for one experiment (a total of 216 image sequences for the three parallel image sensors) requires ~26 min and ~21 min for a blood sample and a CSF sample, respectively. When using two GPUs, because each GPU is given a separate image sequence to process at a given time, there is minimal interference between the GPUs and maximal parallelism can be achieved. Therefore, ~2-fold speed-up is observed when using two GPUs, which results in a total image processing time of ~13 min and ~11 min for a blood sample and a CSF sample, respectively. Combined with all the other sample preparation steps, the total detection time per test is ~20 min and ~17 min for a blood sample and a CSF sample, respectively (refer to Fig. 2 for details). ### Quantification of the LoD for trypanosomes We determined the LoD of our platform for detecting trypanosomes in lysed whole blood by performing serial dilution experiments; the results are shown in Fig. 5a, b. We spiked trypanosome-infected mouse blood into uninfected blood to generate a series of parasite concentrations, including 0 mL−1 (negative control), 10 mL−1, 100 mL−1, 1000 mL−1, 10,000 mL−1 and 100,000 mL−1, where N = 3 replicate experiments were performed at each concentration. As shown in Fig. 5a, false positives were not detected in the three negative control samples, while our detected concentration was 7.55 ± 3.70 mL−1 for the three 10 mL−1 experiments. Therefore, we conclude that our LoD is ~10 trypanosomes per mL of whole blood, which is 5× better than the best currently available parasitological detection method (i.e., the mini anion exchange centrifugation technique, mAECT25; refer to Table 2). Figure 5 also reveals that the recovery rate (detected trypanosome concentration divided by the spiked concentration) of our technique ranges from ~68–76% (at the lower end of our tested concentrations) to ~38–39% (at the higher end of our tested concentrations). This concentration-dependent recovery rate is possibly related to the proximity of the trypanosomes to each other at higher concentrations, which produces more than one trypanosome in a 64 × 64-pixel cropped image that may be misclassified as negative by the deep learning-based classifier (refer to the Materials and Methods section for details) and causes underestimation of the true number of trypanosomes in the sample. This reduction in the recovery rate observed at high concentrations can be potentially compensated by calibration. For T. brucei, stage determination is critical for determining the most appropriate treatment regimen, which is currently performed by collecting CSF via a lumbar puncture and examining the CSF under a microscope. Patients with ≤5 WBCs per μL and no trypanosomes in their CSF are classified as stage I; otherwise, if there are >5 WBCs per μL or if trypanosomes are found in the CSF, they are classified as stage II (ref. 4). To address this need for high-throughput CSF screening, we also quantified the LoD of our platform to detect trypanosomes in CSF. For this purpose, we employed an artificial CSF29 sample that is spiked with human WBCs, where cultured trypanosomes were spiked in the artificial CSF solution at concentrations of 3 mL−1, 10 mL−1, 100 mL−1, and 1000 mL−1, in addition to a negative control (N = 3 for each concentration). The concentration of spiked human WBCs was selected as 20 WBCs/μL to evaluate the performance of the device to detect trypanosomes in a scenario where the WBC concentration was four times higher than the 5 μL−1 threshold in the stage determination. Unlike the blood sample, the CSF solution is optically clear, and lysis was not needed, which helped us to further improve our LoD: as shown in Fig. 5c, d, our platform was able to detect trypanosomes spiked in CSF with a very low LoD of 3 trypanosomes per mL. ### Detection of T. vaginalis parasites Although we chose to validate our motility-based detection approach on T. brucei, we anticipate this approach to be broadly applicable for the detection of a variety of motile microorganisms. As a preliminary test of the performance of our device on a completely different motile parasite, we chose T. vaginalis, the protozoan parasite responsible for trichomoniasis, which is the most common nonviral sexually transmitted disease in the United States and worldwide28,30,31,32. T vaginalis infects the urogenital tract of both women and men. Although it is often asymptomatic, T. vaginalis infection has been associated with increased risk related to other health conditions, including human immunodeficiency virus infection, preterm labor, pelvic inflammatory disease, and prostate cancer2,31. For the diagnosis of trichomoniasis, cell culture followed by microscopy remains the gold standard, which is highly sensitive and can detect T. vaginalis from an inoculum that contains as few as three parasites per mL30. However, it is limited by high cost, inconvenience, and lengthy examination time, as well as susceptibility to sample contamination. The most common diagnostic method—wet-mount microscopy—suffers from poor sensitivity (51–65%)32,33. Thus, our highly sensitive lensless time-resolved holographic speckle imaging method can provide substantial benefit. With only minor adjustments to our algorithm (refer to the Materials and Methods section), we demonstrated that our platform can detect T. vaginalis in phosphate-buffered saline (PBS) solution and culture medium (refer to Supplementary Figs. S2 and S3 and Supplementary Movies 4 and 5). Based on these experiments, we observe that T. vaginalis creates significantly stronger signal intensities compared with trypanosomes in CSF (Supplementary Fig. S1), which is related to the intense locomotion and strong light scattering of T. vaginalis. This finding suggests that our platform can be potentially applied to achieve a similar, if not better, sensitivity level for T. vaginalis, e.g., attaining ≤ 3 parasites per mL. Additional testing is needed to establish the LoD of T. vaginalis from different environments, such as culture medium and urine, which corresponds to different clinical needs, such as the detection of T. vaginalis from diluted vaginal secretion or direct detection from urine. ## Discussion We presented a new method of motility-based parasite detection, which is based on lensless time-resolved holographic speckle imaging, and demonstrated that it is effective for rapid detection of trypanosomes within lysed blood and CSF, achieving an LoD that is better than the LoD of current parasitological methods (refer to Fig. 5 and Table 2)4,18,25,34,35,36,37,38,39,40,41,42,43. This automated technique has the potential to improve parasite screening efficiency while reducing the need for highly specialized and expensive equipment and expertise that are essential to PCR-based or microscopic detection methods. The total cost for all parts of our instrument, excluding the laptop, is less than$1850; this cost can be easily reduced to \$500–1000 in large-volume manufacturing. Our total analysis time, including all the sample preparation steps, is only ~20 min, which is comparable to or faster than most existing methods (Table 2). This motility-based method achieves high sensitivity without requiring specialized detection reagents, refrigeration, centrifugation, or purification, which renders it more versatile for the analysis of different types of samples (e.g., blood and CSF) and less susceptible to differences between parasite subspecies or isolates from different regions of the world. Therefore, the presented prototype can be readily adapted to any established or mobile clinic with access to electricity or battery power, which represents an advancement that can be a useful addition to existing diagnostic methods.

This diagnostic method can also be beneficial for improving the diagnosis of bloodstream HAT or Chagas infection or facilitating earlier identification of stage II HAT cases, when the parasitemia in the CSF is under the LoD of traditional methods and when the WBCs in the CSF remain scarce. This platform may also be useful for follow-up after disease treatment to screen patients for earlier and more sensitive detection of relapse. These advances can produce improved treatment outcomes for patients and increase the cure rate of disease. In addition to HAT, animal trypanosomiasis severely limits economic development. Therefore, applying motility-based detection to aid the screening of infected livestock and development of vector control options can help to reduce poverty in endemic areas44. In the case of Chagas disease, this technique can be adapted for screening blood donors or blood products, as well as sugarcane juice and acai juice products to help reduce various routes of transmission. Given the large populations at risk, the ability to rapidly analyze various types of samples/liquids in a simple and automated fashion will be particularly critical for developing a viable strategy to screen samples in regions where disease incidence declines due to eradication efforts.

While we employed three lensless imaging modules in our device to increase the throughput of our platform, our design can be easily modified to incorporate other numbers of parallel imaging channels for different applications and requirements, in which each additional channel offers ~1.06 mL of extra screening volume (or ~0.265 mL of whole blood volume). Depending on the application, these multiple imaging channels can be used to screen the bodily fluid sample of the same patient, which can increase the probability of detecting parasites at even lower concentrations. Or alternatively, the imaging channels can also be used to simultaneously screen samples of different patients to increase the throughput. Certainly, scaling up the number of lensless speckle imaging modules will increase the cost, dimensions and weight of the device. The cost will increase approximately linearly as a function of the number of imaging channels. This upscaling may also require modifying the linear motion system due to the increased weight of the scanning head, e.g., by arranging linear motion shafts/rails on both sides of the scanning head to balance the weight. With larger dimensions and heavier weights, the portability of the system will be compromised, which may be an important feature for users, especially for resource-limited settings. Additionally, a faster data interface and stronger computational power will also be needed for the controlling computer to timely transfer and process the increased amount of data.

Our device and label-free detection method takes advantage of the locomotion patterns of parasites to maximize the detection signal-to-noise ratio (SNR). Trypanosomes are known for their incessant motion, and motility is crucial to their survival and virulence in the host7. The swimming behavior of trypanosomes is highly complex19,45. Because the flagellum is laterally attached to the cell body, parasite translocation is accompanied by cell body rotation, which produces a “corkscrew” swimming pattern. In addition to cell translocation, the flagellum generates rapid, three-dimensional beating patterns. The average beating frequency of T. brucei is estimated to be 18.3 ± 2.5 Hz in forward-moving cells and 13.1 ± 0.8 Hz in backward-moving cells, whereas the rotational frequency of forward-moving cells is 2.8 ± 0.4 Hz46. The frame rate that matches the average beating frequency (forward-moving), according to the Nyquist sampling rate, is equal to 36.6 fps. In other words, a frame rate of at least 36.6 fps is able to record the speckle changes that correspond to each flagellar stroke. Even higher frame rates can record the speckle changes with finer time resolution, which corresponds to different time points during a flagellar stroke. Assuming an optimal subtraction time interval (Δt) and time window (T) (refer to Materials and Methods, Supplementary Methods and Supplementary Fig. S4), a higher frame rate generates richer time-resolved information about speckle changes induced by motile parasites and additional frames that can be used for averaging, which can improve the overall SNR. However, because our goal is to generate contrast based on locomotion rather than a high-fidelity recording of the beating patterns, frame rates that are less than 36.6 fps are also acceptable for detection purposes. Considering the scanning time and the amount of acquired data, we chose to use a frame rate of ~26.6 fps for our platform. For future versions of the platform, faster image sensors and data interfaces can be employed to achieve higher frame rates, which can improve the SNR without increasing the data acquisition time.

T.b. brucei is extensively employed as a model microorganism for the study of trypanosomes because it is nonpathogenic to humans and therefore safe to conduct experiments on. We anticipate that this approach will be readily applicable to T.b. gambiense, T.b. rhodesiense and T. cruzi since their movements are fundamentally similar; however, direct testing on human-infectious trypanosomes is needed. Mouse blood and an artificial CSF solution were utilized throughout our testing due to safety concerns but our lysis buffer also works with human blood. Future research will focus on testing patient samples from endemic regions to establish the sensitivity and specificity of our presented technique for the diagnosis of various trypanosomiases.

Numerous motile organisms can cause infections in humans5,6,47. The current state of our technique does not automatically differentiate different parasites. However, the amplitude and phase movie that is generated for each detected signal (Fig. 3m and Supplementary Movies 2-5) can potentially enable a trained clinician to distinguish different motile parasites based on the morphology, size, and motility pattern, which is analogous to observing each live parasite under a brightfield and phase-contrast microscope. The prevalence of particular pathogens in the region can also aid in this regard. Furthermore, a trained video classifier that is based on, e.g., a convolutional neural network (CNN) or a recursive neural network (RNN), can potentially distinguish and automatically identify various parasites, if sufficient training data are provided.

In this study, we utilized trypanosomes to demonstrate the feasibility of employing lensless time-resolved holographic speckle imaging in the detection of parasitic infection. While our approach capitalized on the motility of trypanosomes, this platform is broadly applicable to other motile parasites, including other eukaryotic parasites, such as T. vaginalis (refer to Supplementary Figs. S2 and S3; and Supplementary Movies 4 and 5) and other fluid samples beyond those tested in this study. In principle, this platform can also be used for the detection of Loa loa (L. loa) microfilariae in blood samples, which are significantly larger (~0.2–0.3 mm in length) than the parasites investigated in this paper. For these large motile parasites, as an alternative approach, D’Ambrosio et al. used a cellphone-based detection method by taking advantage of the displacement of the RBCs caused by the collision with L. loa microfilariae in an imaging chamber48. This design is compact and cost-effective; however, it suffers from a considerably smaller detection volume (~0.01 mL) than that in our method, which screens and automatically processes ~0.8 mL of whole blood or ~3.2 mL of CSF. Furthermore, it would be very challenging for this earlier cellphone-based design to be used for the detection of parasitic protozoa, such as trypanosomes, which have more than an order-of-magnitude smaller size and mass and lower parasitemia, as well as substantially weaker light scattering than that of L. loa.

Motile bacteria also cause numerous human diseases6. Although bacteria are typically considerably smaller than trypanosomes, the concept of motility-based detection combined with optical magnification can also be explored for label-free detection of bacterial pathogens. Potential uses of motility-based detection for screening of other bodily fluids, such as urine or diluted mucosal secretions and stool samples, may exist. Therefore, we believe that this presented approach has considerable potential to impact various global health challenges. Additionally, we believe that using motility as a biomarker and endogenous contrast can create new possibilities beyond clinical diagnostics. As a label-free 3D imaging modality that is robust to light scattering and optically dense media, this approach can potentially be employed to study motile microorganisms within various fluid environments in a high-throughput manner and benefit biomedical research. As another potential application, a speckle decorrelation approach that is similar to the approach demonstrated by Mandracchia et al.49, may be adopted for our platform to measure, e.g., viability of probiotic bacteria in different environments, which may be useful for, e.g., the food industry.

## Materials and methods

### Sample preparation

#### Lysis buffer preparation

A volume of 44 mM sodium chloride (product No. 71379, Sigma Aldrich (Missouri, USA)), 57 mM disodium phosphate (product No. 30412, Sigma Aldrich, (Missouri, USA)), 3 mM monopotassium phosphate (product No. 60220, Sigma Aldrich, (Missouri, USA)), 55 mM glucose (product No. G8270, Sigma Aldrich, (Missouri, USA)), and 0.24% (w/v) sodium dodecyl sulfate (product No. L4390, Sigma Aldrich, (Missouri, USA)) in reagent grade water (product No. 23-249-581, Fisher Scientific (New Hampshire, USA)) were mixed for 2 h using a magnetic stir bar on a magnetic mixer. The solution was filtered using a disposable filtration unit (product No. 09-740-65B, Fisher Scientific, (New Hampshire, USA)) for sterilization and was stored at room temperature. This buffer solution lyses all components of whole blood, including RBCs, and WBCs, but does not lyse the trypanosomes50.

#### Artificial CSF preparation

According to a previous method29, 1.25 M sodium chloride, 260 mM sodium bicarbonate (product No. SX0320-1, EMD Millipore, (Massachusetts, USA)), 12.5 mM sodium phosphate monobasic (product No. S6566, Sigma Aldrich), and 25 mM potassium chloride (product No. P5405, Sigma Aldrich, (Missouri, USA)) were well mixed, and 10 mM magnesium chloride (product No. 208337, Sigma Aldrich, (Missouri, USA)) was added to produce 10X artificial CSF. The solution was filtered using a disposable filtration unit for sterilization. The 10X stock solution was diluted ten-fold with reagent grade water to make 1X artificial CSF29.

#### Culturing trypanosomes

427-derived bloodstream single marker trypanosomes (T. b. brucei) were cultivated at 37 °C with 5% CO2 in HMI-9 medium with 10% heat-inactivated fetal bovine serum (product No. 10438026, Gibco (Massachusetts, USA)) as described in ref. 51.

#### Collection of trypanosome-infected mouse blood

All the experiments that involve mice were carried out in accordance with the guidelines and regulations of the UCLA Institutional Animal Care and Use Committee (IACUC), NIH Public Health Service Policy on Humane Care and Use of Animals, USDA Animal Welfare regulations, and AAALAC International accreditation standards under IACUC-approved protocol ARC# 2001-065. Mouse infections were performed as described in ref. 52 with the following modifications: female BALB/cJ mice (product No. 000651, Jackson Laboratory, age 11–24 weeks, (Maine, USA)) were intraperitoneally injected with 5×105-1×106 parasites in 0.1–0.2 mL ice-cold phosphate-buffered saline with 1% glucose (PBS-G). Parasitemia was monitored by counting in a hemocytometer, and infected blood samples were collected when parasitemia reached ~107–108 parasites/mL. Infected blood was collected from either the saphenous vein or by cardiac puncture after euthanasia into heparinized capillary tubes (product No. 22-260950, Fisher Scientific, (New Hampshire, USA)) or heparinized collection tubes (product No. 8881320256, Covidien (Dublin, Republic of Ireland)).

#### Separation of WBCs from human blood

We used Ficoll-Paque PREMIUM (product No. 45-001-751, Fisher Scientific, (New Hampshire, USA)) for in vitro isolation of mononuclear cells from blood using density gradient separation according to manufacturer’s instructions. Human blood samples were acquired from UCLA Blood and Platelet Center after deidentification of patients and related information and were utilized in the separation of WBCs from blood. We mixed 2 mL ethylenediaminetetraacetic acid (EDTA)-treated blood with 2 mL sterile PBS (product No. 10-010-049, Fisher Scientific, (New Hampshire, USA)) in a 5 mL centrifuge tube (product No. 14-282-300, Fisher Scientific, (New Hampshire, USA)) by drawing the mixture in and out of a pipette. We put 3 mL of Ficoll-Paque PREMIUM in a 15 mL conical centrifuge tube (product No. 14-959-53A, Fisher Scientific, (New Hampshire, USA)) and carefully layered the diluted blood sample on the Ficoll-Paque PREMIUM. The suspension was centrifuged at 400× g for 40 min at 19 °C using a centrifuge with swing-out rotors (Allegra X-22R, Beckman-Coulter (California, USA)). After centrifugation, the upper layer, which contains plasma and platelets, was removed and mononuclear cells were transferred to a sterile centrifuge tube. To wash the cell isolate, it was mixed in 6 mL PBS and centrifuged at 400× g at 19 °C for 13 min The washing step was repeated twice, and the pellet was suspended in 1 mL PBS. The concentration of WBC was determined by counting in a hemocytometer and diluted to a stock solution of 8 × 105 WBC/mL in PBS.

#### Protocol for calibration curve analysis for blood samples

Freshly collected trypanosome-infected mouse blood was diluted in uninfected mouse blood (Balb/C, female, pooled, sodium heparin, Charles River Inc. (Massachusetts, USA)) to a concentration of approximately 106 parasites/mL. A sample of this trypanosome-infected blood was lysed with 3 volumes of lysis buffer, and the trypanosome concentration was determined by counting in a hemocytometer. The trypanosome-infected blood was diluted with uninfected blood to achieve the desired concentrations for calibration curve analysis.

#### Protocol for calibration curve analysis for CSF samples

Cultured trypanosomes were freshly harvested for each measurement to ensure consistent parasite motility. Trypanosomes were grown to a concentration of ~1 × 106–1.5 × 106 cells/mL and harvested by centrifugation at 1200× g for 5 min. The cell pellet was resuspended in 1 mL of PBS-G and diluted ~10-fold to 105 cells/mL in PBS-G. The trypanosome concentration was determined by counting in a hemocytometer and the sample was diluted into 1X artificial CSF to achieve the desired concentrations for calibration curve analysis.

#### Sample preparation for imaging

We performed experiments using blood and artificial CSF samples. Borosilicate capillary tubes (inner dimensions: 1 mm height × 10 mm width × ~30 cm length; product No. LRT-1-10-67, Friedrich & Dimmock, Inc. (New Jersey, USA)) were prepared by dipping one end of the capillary tube into Vaseline jelly to plug the end. Plastic capillaries, e.g., capillaries constructed of acrylic, can also be utilized instead of glass. Excess jelly was removed using a Kimwipe (product No. 06-666, Fisher Scientific, (New Hampshire, USA)), and the tube end was sealed with parafilm (product No. 13-374-12, Fisher Scientific, (New Hampshire, USA)). For each tube, we prepared 4 mL samples. For blood samples, 3 mL of lysis buffer was mixed with 1 mL of uninfected or infected whole blood in a centrifuge tube. For CSF samples, we placed 100 μL WBC stock solution into trypanosome-infected artificial CSF to have 2 × 104 WBCs/mL (i.e., 20 WBCs/μL) in the final mixture. Each sample was well mixed by drawing the mixture in and out of a pipette before loading into the capillary tube. The open end of the capillary tube was sealed using the jelly and parafilm. The glass capillary was cleaned using a Kimwipe that was moistened with methanol (product No. A452SK-4, Fisher Scientific, (New Hampshire, USA)) and installed on the device.

#### Culturing T. vaginalis

T. vaginalis strain G3 (Beckenham, UK 1973, ATCC-PRA-98) was cultured in modified  Diamond's trypticase-yeast extract-maltose (TYM) media that was supplemented with 10% horse serum (Sigma Aldrich (Missouri, USA)), 10 U/ml penicillin–10 μg/ml streptomycin (Invitrogen (California, USA)), 180 μM ferrous ammonium sulfate, and 28 µM sulfosalicylic acid at 37 °C53. The culture was passaged daily and maintained at an approximate concentration of 1 × 106 cells/mL.

### Design of the high-throughput lensless time-resolved speckle imaging platform

As shown in Fig. 1a, the device consists of five main modules: (1) “scanning head” that consists of three lensless holographic speckle imagers, (2) linear translation stage, (3) housing, (4) circuit, and (5) control program. Each module is detailed in this section.

1. (1)

Scanning head: Three identical lensless imagers are built next to each other and housed by 3D-printed plastic using a 3D printer (Objet30 Pro, Stratasys (Minnesota, USA)). As shown in the inset of Fig. 1a, each lensless imager employs a 650-nm laser diode (product No. AML-N056-650001-01, Arima Lasers Corp. (Taoyuan, Taiwan, China)) as the illumination source, which has an output power of ~1 mW. The emitted light is passed through a 3D-printed aperture to limit its emission angle and avoid light leakage into the adjacent imagers. The sample, which is a glass capillary tube filled with the bodily fluid to be screened, is placed ~7 cm (z1 distance) below the laser diode. The sample’s diffraction pattern is imaged by a 10-megapixel CMOS image sensor (product No. acA3800-14um, Basler (Ahrensburg, Germany)) with a 1.67 μm pixel size and an active area of 6.4 mm × 4.6 mm (29.4 mm2), which is placed below the capillary tube. The air gap between the image sensor and the bottom surface of the glass capillary tube ranges from ~1–1.5 mm to reduce the heat transfer from the image sensor to the sample. Because each image sensor has multiple circuit boards that generate heat, custom-made aluminum heat sinks are inserted between the circuit boards and arranged on the sides of the scanning head to dissipate heat and prevent image sensor malfunction.

2. (2)

Linear translation stage: A linear translation stage is built from two linear motion shafts (product No. 85421, Makeblock Co., Ltd. (Shenzhen, China)), two linear motion sliders (product No. 86050, Makeblock Co., Ltd. (Shenzhen, China)), a timing belt (product No. B375-210XL, ServoCity (Kansas, USA)), two timing pulleys (product No. 615418, ServoCity (Kansas, USA)), and a stepper motor (product No. 324, Adafruit Industries LLC. (New York, USA)). The scanning head is mounted onto the sliders using screws.

3. (3)

Housing: The housing of the scanning head is constructed with 3D-printed plastic. The outer shell of the device is constructed with laser-cut ¼-inch acrylic sheets.

4. (4)

Circuit: A printed circuit board (PCB) is custom-built to automate the device, which contains a microcontroller (Teensy LC, PJRC (Oregon, USA)) connected to the laptop computer via USB 2.0, laser diode driver circuits built from constant current circuits (product No. LM317DCYR, Texas Instruments (Texas, USA)), and a stepper motor driver circuit (product No. TB6612, Adafruit). The laser diodes and the stepper motor are powered using a 12 V power adapter. Various digital switches built from metal-oxide-semiconductor field-effect transistors (MOSFETs) are controlled by the digital outputs from the microcontroller to cut the power to the laser diodes and the image sensors when they are unused. Specifically, to cut the power to the image sensor, the power wire of the USB 3.0 cable of the image sensor is cut and a MOSFET-based digital switch is inserted into the power line.

5. (5)

Control program: A Windows application written in C# with a graphical user interface (GUI) enables a user to initiate the screening of the current sample in addition to various other functionalities, such as customizing image acquisition parameters, performing a live view of the diffraction patterns, taking a snapshot, and stopping the acquisition.

### Image acquisition

After the sample is loaded onto the device and has settled for a waiting period of 3–4 min (4 min for lysed whole blood and 3 min for artificial CSF; refer to Fig. 2 for details), the user presses the “record” button on the GUI to start acquisition. During screening, our device is programmed to scan the capillary tubes at 36 discrete positions, with a distance of ~4.7 mm between spatially adjacent positions. This approach yields a total screening volume of 36 (discrete scanning positions) × 29.4 mm2 (FOV of the image sensor) × 1 mm (channel height of the capillary tube) ≈ 1.06 mL per lensless speckle imager, and ~3.18 mL for the three parallel imagers combined. At each of the 36 positions, to achieve a high frame rate (~26.6 fps), the image sensor’s FOV is split into two halves (i.e., the upper 1374 rows of the pixels and the lower 1374 rows of the pixels). Each half sequentially captures 61 frames (for lysed blood) or 41 frames (for CSF) (refer to Supplementary Methods and Supplementary Fig. S4).

The image sensor’s temperature rises when it is powered, leading to temperature gradient-induced convection flow of the liquid sample (refer to Supplementary Methods and Supplementary Fig. S5). To mitigate these problems, two measures are taken. First, instead of unidirectionally scanning the 36 positions, the device scans in a back-and-forth manner (refer to Supplementary Movie 1). Let the 36 positions be represented by positions #1, #2, …, #36, which are spatially ordered. Instead of scanning in the order #1, #2, …, #36, we programmed the device to scan with a larger step size of 9 positions. Whenever the scanning head cannot move forward with this step size, it returns to the unscanned position with the smallest position number. That is, the device first scans positions #1, #10, #19, and #28. The scanning head returns to position #2, followed by #11, #20, and #29, and so on. This scanning pattern largely prevents heat accumulation at a given section of the capillary tube, which has sufficient time to cool down before the scanning head returns to its vicinity. As a second measure, a 6 s “downtime” is added between scanning positions to enable the image sensor to cool down. After completing the acquisition at a given position, the power to the image sensor is cut by a MOSFET-based digital switch added to the USB 3.0 cable. After a 6 s wait time, the stepper moves the scanning head to the next position, where the power to the image sensor is restored to capture the next set of images.

During our testing, we save the acquired images to a hard drive for processing. All three image sensors, which capture uncompressed 8-bit images, generate a total data rate of ~421 MB/s, which slightly exceeds the average write-speed of our solid-state drive (SSD). Therefore, a queue is created in the random-access memory (RAM) for each image sensor to temporarily buffer the incoming image data, and another thread is created to constantly move the image data from the buffer into the SSD. Because all remaining image data can be fully saved to the SSD during the previously mentioned downtime between two positions, the total image acquisition time per test is not increased due to the limited write-speed. As a more time-efficient alternative, the acquired images can be temporarily stored in the RAM while they are constantly moved to the GPUs for processing in batches that correspond to each image sequence. In this way, the image processing can be concurrently performed with the image acquisition, which reduces the total time per test (refer to the Results section, Fig. 2, and Table 1).

### Image processing using CMA and deep learning-based identification

We developed CMA to generate 3D contrast from particle locomotion in noisy holograms and speckled interference patterns and applied deep learning-based classification to identify the signals that correspond to the parasite of interest. As an example, Fig. 3 depicts the procedure that we used to detect trypanosomes from lysed whole blood, whereas in other application settings (e.g., trypanosome detection in CSF), we applied minor changes to the procedure, as detailed in this section. The algorithm takes the raw holographic diffraction patterns acquired by each image sensor at each scanning position as input. We denote Ai (i = 1, …, NF) as the raw frames, where NF is the total number of recorded frames in each sequence. The algorithm consists of the following steps:

1. Hologram preprocessing to mitigate the variations and nonuniformity of the illumination

Every 8-bit raw image acquired by each image sensor (Fig. 3a) is divided by a “background” intensity pattern that represents the nonuniformity of the laser diode illumination source, which was previously computed from Gaussian-smoothed and averaged raw images in a negative control experiment and stored to be applied by other experiments. The hologram is further normalized (divided) by its own mean value, which yields the illumination-corrected holograms Ãi (i = 1, …, NF) (Fig. 3b).

2. Determining the range of axial-distances of the fluid sample under test

In the case of lysed blood, most of the cell debris tend to fully sediment within 4 min wait time (Fig. 2) and form a thin layer of particles at the bottom of the channel. We utilized this effect to our advantage by applying the “Tamura coefficient of the gradient” (ToG) autofocusing criterion54,55 to automatically determine the z-distance of the bottom of the fluid sample (Fig. 3c), which is denoted as zb. We defined our range of digital z-scanning as [zb − 200 μm, zb + 1200 μm] with a 50 μm step size. In addition to the 1 mm expected channel height, we employed an extra scanning range of ±200 μm to tolerate possible errors in the channel height, tilting of the channel, and errors in autofocusing. This approach renders our hardware much less complicated and inexpensive because we do not need tight tolerances in our scanner design and sample holder placement.

In the case of clear media, such as CSF where objects/particles are sparse, autofocusing to the bottom of the channel can be challenging. Therefore, we precalibrated the zb distance of each capillary tube (refer to Supplementary Methods), which only needs to be conducted once, and applied it throughout our experiments. Because zb is precalibrated, i.e., not adaptively calculated for each sample, we specify a larger range of digital z-scanning, [zb − 500 μm, zb + 1500 μm], also with a 50 μm step size. Note that zb slightly differs for each of the three channels of the device.

3. CMA algorithm to generate contrast from locomotion

We denote the z-distances to be scanned as zj (j = 1, …, Nz), as determined by the previous step. We digitally propagate each element of Ãi to each element of zj with a high-pass filtered coherent transfer function (Fig. 3d); refer to Supplementary Methods for details) to obtain

$${\bf{B}}_{i,j} = {\text{HP}}\;[{\text{P}}(\widetilde {\bf{A}}_i,z_j)]$$
(1)

where P represents the angular spectrum-based back-propagation56,57,58, HP represents high-pass filtering, and i = 1, …, NF, j = 1, …, Nz .

Next, a time-averaged differential analysis with OFN is applied (Fig. 3e):

$${\bf{C}}_j = \frac{1}{{N_{\text{F}} - \delta _{\text{F}}}}\mathop {\sum}\limits_{i = 1}^{N_{\text{F}} - \delta _{\text{F}}} {\frac{{\left| {{\bf{B}}_{i + \delta _{\text{F}},j} - {\bf{B}}_{i,j}} \right|}}{{\exp \left[ {\gamma \cdot \frac{1}{2}\left| {{\bf{B}}_{i + \delta _{\text{F}},j} + {\bf{B}}_{i,j}} \right|} \right]}}}$$
(2)

where δF is the subtraction frame interval, $$\exp \left[ {\gamma \cdot \frac{1}{2}\left| {{\bf{B}}_{i + \delta _{\text{F}},j} + {\bf{B}}_{i,j}} \right|} \right]$$ is the OFN factor, and γ is a parameter related to OFN that is respectively tuned for the lysed blood (γ = 2) and CSF experiments (γ = 3). Time-averaging significantly improves the SNR by smoothing out random image noise and random motion of unwanted particles/objects while preserving the true signals of motile microorganisms. OFN further suppresses potential false positive signals produced from, e.g., strongly scattering and unwanted particles/objects such as cell debris (refer to Supplementary Methods and Supplementary Figs. S6 and S7). The result of this step, Cj, is a three-dimensional image stack.

4. Post-image processing and segmentation

The z-stack Cj (j = 1, …, Nz) suffers from a low-spatial-frequency background that is primarily attributed to high-frequency noise in the raw images, which remains when performing high-pass filtered back-propagation and frame subtraction. As shown in Fig. 3f-h, the 3D z-stack Cj is high-pass filtered in the z-direction by a mean-subtracted Gaussian kernel (σz = 250 μm) and the negative pixels are clipped to zero, which yields Dj (j = 1, …, Nz). Dj is projected onto a 2D image E using maximum intensity projection (MIP) to simplify the subsequent segmentation and classification steps. High-pass filtering is applied in 2D (mean-subtracted Gaussian kernel, σx = σy = 25 μm) to remove the residual background, and the negative pixels are clipped to zero, which yields F.

Segmentation of candidate signal points within F is performed by 2D median filtering (3 × 3 pixel window, pixel size = 1.67 μm) and thresholding (threshold = 0.01 for detecting trypanosomes in lysed blood and 0.02 for detecting trypanosomes in CSF) followed by dilation (disk-shape structuring element, radius = 2 pixels, pixel size = 1.67 μm) and searching for connected pixel regions. Connected regions that are smaller than 5 pixels are discarded. 64-by-64 pixel image patches centered around the pixel-value-weighted centroids of these connected regions are cropped from F (without 2D median filtering) and are used for the downstream identification by a deep learning-based classifier.

5. Deep learning-based classifier for detection of motile trypanosomes

Because the motility of trypanosomes varies within a population and trypanosomes only weakly scatter light, the signal intensities of some of the less-motile trypanosomes may fall below the “false positive” signals due to unwanted particles, even when OFN is applied. However, the mode of motion fundamentally differs between a trypanosome and an unwanted particle. An unwanted particle usually has a drifting motion due to, e.g., convection or slight tilting of the capillary tube, whereas a trypanosome typically “wiggles” with high-frequency flagellar beating and low directional velocity. These differences in motion patterns also produce differences in the typical shape of their signal spots, which create useful features that can be learned by a machine learning model for improved detection results. To exploit this opportunity, a CNN that consists of three convolution blocks followed by two fully connected layers is built and trained to identify true signal spots created by motile trypanosomes. The detailed network structure is shown in Supplementary Fig. S8, which is separately trained for trypanosome detection from lysed blood and CSF samples (refer to the Supplementary Methods for details).

6. Generation of test results

The image processing steps (Fig. 3a–j) are repeated for each captured image sequence and each image sensor. The total detected number of trypanosomes from all positions are summed and divided by the total screened volume (~3.18 mL) to calculate the detected parasitemia. For lysed blood, the parasitemia is further multiplied by a factor of 4, i.e., the dilution factor introduced by lysis, to calculate the parasitemia in the original whole blood sample.

7. 3D localization of motile microorganisms and movie generation

Our technique also offers the capability to locate the motile microorganisms in 3D and generate in-focus amplitude and phase movies of them for a close-up observation using the following steps: for each signal spot that is classified as positive by the CNN classifier, we return to the corresponding z-stack Dj (j = 1, …, Nz) and only crop out a “column” that is 30 × 30 pixels in x–y, centered around this spot, while spanning the entire z-range (Nz layers). An autofocusing metric is used to evaluate each of the Nz layers, and the layer that corresponds to the maximum value of the autofocusing metric corresponds to its in-focus position. We tried ToG and Tamura coefficient-based criteria54,55,59; both work very well for this purpose. While the current z-localization accuracy is limited by the z-step size that we chose (Δz = 50 μm), it can be further improved by finer z-sectioning. Using the currently obtained z-localization distance as an initial guess, we perform high-pass filtered back-propagation and differential analysis (detailed in Step 3) over a z-range of ±100 μm around the initial guess with a finer z-step size of 5 μm. However, OFN is disabled this time; in other words, the exponential normalization factor in Eq. 2 is removed due to OFN’s side effect of slightly weakening the signal at the optimal focus distance, where the object function of the microorganism is the strongest. Autofocusing is performed again over the same 30 × 30-pixel region over different z-layers. The previously determined x–y centroid, in addition to the newly found z-distance, is used as the 3D location of this motile microorganism. Because the additional high-pass filtered back-propagation and differential analysis may be only performed on a smaller region of interest (ROI) around each given spot (e.g., in our case, an ROI of 512 × 512 pixels is used), the 3D localization is computationally efficient. The 3D localization capability can be applied to generate movies (detailed in this section) or study microorganism behaviors in biological or biomedical research settings.

Using the obtained 3D position of each motile microorganism, a movie of each detected microorganism can be generated by digitally back-propagating (without high-pass filtering) each frame of the recorded raw image sequence Ai (i = 1, …, NF) or the illumination-corrected version Ãi to the corresponding z-coordinate. The amplitude and phase channels of the back-propagated images are displayed side by side. The generated movies can potentially be employed as an additional way to confirm the detection results of this platform when trained medical personnel are available.

Although in Step 4 we projected the 3D contrast map (Fig. 3f) into a 2D contrast map (Fig. 3g) using MIP to simplify the segmentation and classification tasks. In principle, directly segmenting the 3D contrast map (Fig. 3f) is expected to be advantageous when the microorganisms are highly dense because it may mitigate underdetection issues related to microorganisms that overlap in x–y but are separated in z. Nevertheless, spatial overlap of microorganisms should not present a practical concern for the detection and counting of parasites because the probability of a spatial overlapping event is extremely low at low parasitemia (e.g., < 103 mL−1). At high parasitemia, the decrease in the recovery rate due to spatial overlap can be simply corrected by calibration. Furthermore, from a diagnostic standpoint, the main challenge is to improve reliable detection (positive vs. negative) at very low parasitemia, not necessarily to obtain an exact measurement of the parasitemia. In this regard, overlapping parasites in x–y will not impact the usefulness of our platform.

### Timing of image processing algorithm

In this study, we used a laptop equipped with an Intel Core i7-6700K central processing unit (CPU) @ 4.00 GHz, 64 GB of RAM, and two Nvidia GTX 1080 GPUs for image processing. Table 1 summarizes the time required for our image processing workflow, simultaneously using a single GPU or two GPUs. We assume that the images captured by the imaging device during image acquisition are temporarily stored in the CPU RAM and are constantly moved to the GPU memory in batches corresponding to the scanning positions, where it is processed by the GPU (or GPUs). In this way, image processing can be concurrently performed during image acquisition, which reduces the time requirement per test. We mimic this situation by preloading existing data from the hard drive into the RAM of the computer before starting the timer, which provides a reasonable estimation of the time cost of our processing. Because the number of acquired images and the image processing workflow for lysed blood and CSF differ (refer to previous subsections and Supplementary Methods), their timing results are individually calculated. In Table 1, the timing results for lysed blood and CSF are separated by “/”.

## References

1. 1.

CDC. Parasites—Neglected Parasitic Infections (NPIs) in the United States. https://www.cdc.gov/parasites/npi/index.html. Accessed 30 Dec 2017)

2. 2.

Poole, D. N. & McClelland, R. S. Global epidemiology of Trichomonas vaginalis. Sex. Transm. Infect. 89, 418–422 (2013).

3. 3.

Pérez-Molina, J. A. & Molina, I. Chagas disease. Lancet 391, 82–94 (2018).

4. 4.

Büscher, P., Cecchi, G., Jamonneau, V. & Priotto, G. Human African trypanosomiasis. Lancet 390, 2397–2409 (2017).

5. 5.

Krüger, T. & Engstler, M. Flagellar motility in eukaryotic human parasites. Semin. Cell. Dev. Biol. 46, 113–127 (2015).

6. 6.

Josenhans, C. & Suerbaum, S. The role of motility as a virulence factor in bacteria. Int. J. Med. Microbiol. 291, 605–614 (2002).

7. 7.

Shimogawa, M. M. et al. Parasite motility is critical for virulence of African trypanosomes. Sci. Rep. 8, 9122 (2018).

8. 8.

Field, M. C. et al. Anti-trypanosomatid drug discovery: an ongoing challenge and a continuing need. Nat. Rev. Microbiol. 15, 217–231 (2017).

9. 9.

Langousis, G. & Hill, K. L. Motility and more: the flagellum of Trypanosoma brucei. Nat. Rev. Microbiol. 12, 505–518 (2014).

10. 10.

Malvy, D. & Chappuis, F. Sleeping sickness. Clin. Microbiol. Infect. 17, 986–995 (2011).

11. 11.

Khare, S. et al. Proteasome inhibition for treatment of leishmaniasis, Chagas disease and sleeping sickness. Nature 537, 229–233 (2016).

12. 12.

Stuart, K. et al. Kinetoplastids: related protozoan pathogens, different diseases. J. Clin. Invest. 118, 1301–1310 (2008).

13. 13.

Fairlamb, A. H. & Horn, D. Melarsoprol resistance in African trypanosomiasis. Trends Parasitol. 34, 481–492 (2018).

14. 14.

Fernandes, M. C. & Andrews, N. W. Host cell invasion by Trypanosoma cruzi : a unique strategy that promotes persistence. FEMS Microbiol. Rev. 36, 734–747 (2012).

15. 15.

Dorn, P. L. et al. The diversity of the Chagas parasite, Trypanosoma cruzi, infecting the main Central American vector, Triatoma dimidiata, from Mexico to Colombia. PLoS Negl. Trop. Dis. 11, e0005878 (2017).

16. 16.

Vos, T. et al. Global, regional, and national incidence, prevalence, and years lived with disability for 310 diseases and injuries, 1990–2015: a systematic analysis for the Global Burden of Disease Study 2015. Lancet 388, 1545–1602 (2016).

17. 17.

CDC. Epidemiology & Risk Factors. https://www.cdc.gov/parasites/chagas/epi.html. Accessed 16 May 2018

18. 18.

Chappuis, F., Loutan, L., Simarro, P., Lejon, V. & Büscher, P. Options for field diagnosis of human African trypanosomiasis. Clin. Microbiol. Rev. 18, 133–146 (2005).

19. 19.

Bargul, J. L. et al. Species-specific adaptations of trypanosome morphology and motility to the mammalian host. PLoS. Pathog. 12, e1005448 (2016).

20. 20.

de Sousa, M. A. Morphobiological characterization of Trypanosoma cruzi Chagas, 1909 and its distinction from other Trypanosomes. Mem. Inst. Oswaldo. Cruz. 94(Suppl 1), 205–210 (1999).

21. 21.

Lumbala, C. et al. Prospective evaluation of a rapid diagnostic test for Trypanosoma brucei gambiense infection developed using recombinant antigens. PLoS Negl. Trop. Dis. 12, e0006386 (2018).

22. 22.

Santos, F. L. N. et al. Chronic Chagas disease diagnosis: a comparative performance of commercial enzyme immunoassay tests. Am. J. Trop. Med. Hyg. 94, 1034–1039 (2016).

23. 23.

Afonso, A. M., Ebell, M. H. & Tarleton, R. L. A systematic review of high quality diagnostic tests for Chagas disease. PLoS Negl. Trop. Dis. 6, e1881 (2012).

24. 24.

Hernández, C., Teherán, A., Flórez, C. & Ramírez, J. D. Comparison of parasite loads in serum and blood samples from patients in acute and chronic phases of Chagas disease. Parasitology 145, 1837–1843 (2018).

25. 25.

Büscher, P. et al. Improved Models of Mini Anion Exchange Centrifugation Technique (mAECT) and Modified Single Centrifugation (MSC) for sleeping sickness diagnosis and staging. PLoS Negl. Trop. Dis. 3, e471 (2009).

26. 26.

Storey, B. et al. Utilization of computer processed high definition video imaging for measuring motility of microscopic nematode stages on a quantitative scale: “The Worminator”. Int. J. Parasitol. Drugs Drug Resist 4, 233–243 (2014).

27. 27.

Kennedy, P. G. E. Human African trypanosomiasis of the CNS: current issues and challenges. J. Clin. Invest. 113, 496–504 (2004).

28. 28.

CDC. STD Facts—Trichomoniasis. https://www.cdc.gov/std/trichomonas/stdfact-trichomoniasis.htm. Accessed 20 April 2018

29. 29.

Artificial Cerebrospinal Fluid (ACSF) (10×). Cold Spring Harb. Protoc. 2017; https://doi.org/10.1101/pdb.rec094342.

30. 30.

Garber, G. E. The laboratory diagnosis of Trichomonas vaginalis. Can. J. Infect. Dis. Med. Microbiol. 16, 35–38 (2005).

31. 31.

Twu, O. et al. Trichomonas vaginalis homolog of macrophage migration inhibitory factor induces prostate cell growth, invasiveness, and inflammatory responses. Proc. Natl Acad. Sci. USA 111, 8179–8184 (2014).

32. 32.

Patil, M. J., Nagamoti, J. & Metgud, S. C. Diagnosis of Trichomonas vaginalis from vaginal specimens by wet mount microscopy, in pouch TV culture system, and PCR. J. Glob. Infect. Dis. 4, 22–25 (2012).

33. 33.

CDC. Trichomoniasis—2015 STD Treatment Guidelines. https://www.cdc.gov/std/tg2015/trichomoniasis.htm. Accessed 27 May 2018

34. 34.

Deborggraeve, S. et al. Diagnostic Accuracy of PCR in gambiense sleeping sickness diagnosis, staging and post-treatment follow-up: a 2-year longitudinal study. PLoS Negl. Trop. Dis. 5, e972 (2011).

35. 35.

Enyaru, J. C. K., Matovu, E., Nerima, B., Akol, M. & Sebikali, C. Detection of T.b. rhodesiense trypanosomes in humans and domestic animals in South East Uganda by amplification of serum resistance-associated gene. Ann. N. Y. Acad. Sci. 1081, 311–319 (2006).

36. 36.

Sabino, E. C. et al. Detection of Trypanosoma cruzi DNA in blood by PCR is associated with Chagas cardiomyopathy and disease severity. Eur. J. Heart Fail. 17, 416–423 (2015).

37. 37.

Rosenblatt, J. E., Reller, L. B. & Weinstein, M. P. Laboratory diagnosis of infections due to blood and tissue parasites. Clin. Infect. Dis. 49, 1103–1108 (2009).

38. 38.

Feilij, H., Muller, L. & Gonzalez Cappa, S. M. Direct micromethod for diagnosis of acute and congenital Chagas’ disease. J. Clin. Microbiol. 18, 327–330 (1983).

39. 39.

Cheesbrough M. District Laboratory Practice in Tropical Countries. 2nd edn. (Cambridge University Press, Cambridge, 2005).

40. 40.

Bisser, S. et al. Sensitivity and specificity of a prototype rapid diagnostic test for the detection of Trypanosoma brucei gambiense infection: a multi-centric prospective study. PLoS Negl. Trop. Dis. 10, e0004608 (2016).

41. 41.

Sánchez-Camargo, C. L. et al. Comparative evaluation of 11 commercialized rapid diagnostic tests for detecting Trypanosoma cruzi antibodies in serum banks in areas of endemicity and nonendemicity. J. Clin. Microbiol. 52, 2506–2512 (2014).

42. 42.

Büscher, P. et al. Sensitivity and specificity of HAT Sero-K-SeT, a rapid diagnostic test for serodiagnosis of sleeping sickness caused by Trypanosoma brucei gambiense: a case-control study. Lancet Glob. Health 2, e359–e363 (2014).

43. 43.

Camara, M. et al. Sleeping sickness diagnosis: use of buffy coats improves the sensitivity of the mini anion exchange centrifugation test. Trop. Med. Int. Health 15, 796–799 (2010).

44. 44.

Muhanguzi, D. et al. Cost analysis of options for management of African Animal Trypanosomiasis using interventions targeted at cattle in Tororo District; south-eastern Uganda. Parasit. Vectors 8, 387 (2015).

45. 45.

Rodríguez, J. A. et al. Propulsion of African trypanosomes is driven by bihelical waves with alternating chirality separated by kinks. Proc. Natl Acad. Sci. USA 106, 19322–19327 (2009).

46. 46.

Heddergott, N. et al. Trypanosome motion represents an adaptation to the crowded environment of the vertebrate bloodstream. PLoS Pathog. 8, e1003023 (2012).

47. 47.

Hotez, P. J. et al. Helminth infections: the great neglected tropical diseases. J. Clin. Invest. 118, 1311–1321 (2008).

48. 48.

D’Ambrosio, M. V. et al. Point-of-care quantification of blood-borne filarial parasites with a mobile phone microscope. Sci. Transl. Med 7, 286re4 (2015).

49. 49.

Mandracchia, B. et al. Biospeckle decorrelation quantifies the performance of alginate-encapsulated probiotic bacteria. IEEE J. Sel. Top. Quantum Electron 25, 7200206 (2019).

50. 50.

Uilenberg G. A field guide for the diagnosis, treatment and prevention of African animal trypanosomosis. (Food and Agriculture Organization of the United Nations, Rome, 1998).

51. 51.

Oberholzer, M., Lopez, M. A., Ralston, K. S. & Hill, K. L. Approaches for functional analysis of Flagellar proteins in African trypanosomes. Methods Cell Biol. 93, 21–57 (2009).

52. 52.

Kisalu, N. K., Langousis, G., Bentolila, L. A., Ralston, K. S. & Hill, K. L. Mouse infection and pathogenesis by Trypanosoma brucei motility mutants. Cell Microbiol. 16, 912–924 (2014).

53. 53.

Clark, C. G. & Diamond, L. S. Methods for cultivation of luminal parasitic protists of clinical importance. Clin. Microbiol. Rev. 15, 329–341 (2002).

54. 54.

Zhang, Y. B., Wang, H. D., Wu, Y. C., Tamamitsu, M. & Ozcan, A. Edge sparsity criterion for robust holographic autofocusing. Opt. Lett. 42, 3824–3827 (2017).

55. 55.

Tamamitsu M., Zhang Y. B., Wang H. D., Wu Y. C., Ozcan A. Comparison of Gini index and Tamura coefficient for holographic autofocusing based on the edge sparsity of the complex optical wavefront. arXiv preprint arXiv:1708.08055, 2017.

56. 56.

Goodman, J. W. Introduction to Fourier Optics.. 3rd edn, (Greenwood Village, Roberts & Co, 2005).

57. 57.

Greenbaum, A. et al. Wide-field computational imaging of pathology slides using lens-free on-chip microscopy. Sci. Transl. Med 6, 267ra175 (2014).

58. 58.

Mudanyali, O. et al. Compact, light-weight and cost-effective microscope based on lensless incoherent holography for telemedicine applications. Lab. Chip. 10, 1417 (2010).

59. 59.

Memmolo, P. et al. Automatic focusing in digital holography and its application to stretched holograms. Opt. Lett. 36, 1945–1947 (2011).

## Acknowledgements

The Ozcan Research Group at UCLA acknowledges the support of the NSF Engineering Research Center (ERC, PATHS-UP), the ARO Life Sciences Division and the Howard Hughes Medical Institute (HHMI). K.H. is supported by the US National Institutes of Health (NIH) grant AI052348. We are grateful to Dr. Sharon Baumel-Alterzon and Dr. Patricia J. Johnson at UCLA’s Molecular Biology and Genetics Department for providing T. vaginalis samples. We also thank Yichen Wu, Sabiha Tok, and Alborz Feizi for their help with our experiments.

## Author information

Y.Z., H.C.K., M.M.S., K.H., and A.O. designed and conceived the project; Y.Z. and S.Y. designed and built the prototype; M.M.S. cultured the trypanosome parasites; H.C.K. and M.M.S. prepared the samples; Y.Z. designed the image processing algorithm; Y.Z., A.G., I.O., Y.H., Y.L., V.B., and B.Z. implemented and accelerated the image processing code; Y.Z., H.C.K., M.M.S., T.L., B.B., and R.N. performed the experiments; Y.Z. and H.C.K. processed the data; Y.L. performed the COMSOL simulation; Y.Z., Z.W., and H.W. built the CNN-based classifier; Y.Z. and T.L. annotated the training data to train the CNN; A.O. initiated the project; and K.H. and A.O. supervised the project. All authors contributed to and commented on the manuscript.

### Conflict of interest

A.O., Y.Z., and H.C.K. have a pending patent application on the presented technique. The remaining authors declare that they have no conflict of interest

Correspondence to Aydogan Ozcan.

## Rights and permissions

Reprints and Permissions