Introduction

Counting Nematodes. This relatively simple task forms the basis of almost every analysis in nematology, especially those evaluating biological control of insects using entomopathogenic nematodes. Surveys of indigenous nematode populations, monitoring of entomopathogenic nematode populations applied for biological control, bioassays of entomopathogenic nematode behavior evaluating control potential, and monitoring of nematode culture densities for eventual application all rely on accurate counts (Barker and Campbell 1981; Glazer and Lewis 2000; Kaya and Stock 1997). Counting of nematodes has traditionally been accomplished manually by placing samples in a gridded counting dish, examining individuals through a microscope, and tallying results (Hooper et al. 2005). While this method of manual counting is indeed feasible, it can be time consuming and error prone.

Time spent on manual nematode counting is roughly linear with respect to both sample size and number of individuals. The more samples collected, or bioassays run, the longer it takes to count. Similarly, large numbers of nematodes require longer counting time. The nature of this roughly linear increase in human effort with increasing sample size and nematode number precludes high throughput analysis: large scale multifaceted trials consume inordinate resources in terms of time and labor spent counting nematodes.

Given the ability of running many multifaceted trials simultaneously to speed the research process and provide unique insights, the temptation is to reduce processing time by subsampling (Glazer and Lewis 2000; Schomaker and Been 1998). While this is a feasible way to increase throughput, and can usually resolve large statistical differences, subsampling increases error and reduces statistical power (Schomaker and Been 1998). Small samples of nematodes are easier to count, but inaccurate subsampling, either through inhomogeneous sampling or human counting error, combined with subsequent compensation can inflate errors and make resolving statistical differences impossible (Glazer and Lewis 2000; Schomaker and Been 1998).

While manual counting of nematodes is an established method, previous work has also explored the possibility of automated counting. Image processing techniques were developed for population monitoring of collembola (Krogh et al. 1998). For nematodes, image analysis has been applied to counting of plant parasitic nematode larvae and nematode recognition (Been et al. 1996; Fernández-Valdivia 1988). Widespread adoption of these methods has been slow, however, due to the nature of the equipment and processing used. Hardware and software were specialized, costly, proprietary, or difficult to implement (Been et al. 1996; Fernández-Valdivia 1988).

Here, we develop a broadly applicable automated alternative to manual counting of nematodes that enables high throughput counts with decreasing marginal labor costs. The technique yields a consistently low error rate relying on simple, low-cost image processing. We describe implementation of the technique in detail for other users.

Materials and methods

Nematodes were prepared, dyed, and photographed, as described below, for subsequent automated counting. Images of samples containing dyed nematodes were then processed using ImageJ, an open source and freely available software package developed by the National Institutes of Health. The results of image processing were used to develop standard curves, described in detail below, and thereafter to quantify nematodes within samples.

Nematode culture

While the automated counting methods described here are applicable to a wide range of nematode species, we specifically focused on counting the infective juvenile stage of two species of entomopathogenic nematodes: Steinernema diaprepesi and Heterorhabditis indica. Both species are attacking weevil larvae with biological control potential. Members of these two species were originally isolated from Diaprepes abbreviatus larvae in Florida citrus groves, USA and subsequently cultured on late instar Galleria mellonela larvae (Kaya and Stock 1997). Emerging infective juveniles were collected on white traps and then transferred to tissue culture flasks for storage at 14 °C (White 1927).

Nematode preparation for standard curve development

Clean samples of infective juveniles (IJs) of the entomopathogenic nematodes S. diaprepesi and H. indica were obtained from culture after emergence from G. mellonela larvae. Each sample contained approximately 2500 IJs in 30 ml of water. One milliliter of 10 mg ml−1 methylene blue dye (Fisher Chemical; CAS: 7220-79-3) was added to each sample. Samples containing nematodes and dye were brought to a boil to fix the dye. Dyed nematodes were then washed with water on 325 mesh sieves. Subsamples of clean dyed nematodes were then placed into 17 mm glass Petri dishes in preparation for photography and standard curve development.

Photography

Petri dishes were placed atop a 34 × 34 cm light box constructed from plywood and frosted Plexiglas to provide uniform bottom lighting. Photographs of entire Petri dishes containing nematode samples were taken with a Dino-Lite Edge AM4815ZT digital microscope (Dino-Lite Digital Microscopes, Torrance, CA, USA) using Dino-Capture 2.0 Version 1.5.12.B at 30× magnification and 10.5 cm working distance. Images were saved at 2560 × 2048 pixels, which was the highest resolution possible.

Image processing

Once captured, images were processed with ImageJ version 1.48 (Abràmoff et al. 2004). Images were converted to 8-bit grayscale, then to black and white using the ImageJ auto-threshold function, then finally cropped to contain only nematodes. Once cropped, the total black area in pixels (representing nematodes) was sampled. Each individual processing step listed above was then incorporated into a macro, which is an internal program that automates iterative processes, using ImageJ’s native record function. This macro, containing instructions on the exact steps needed to process an image, can then automatically process a folder containing large numbers of images of nematode samples.

Standard curve development

The results of image processing (total black area in pixels representing total nematode area) for samples of known numbers of nematodes ranging from 0 to approximately 1000 were used to construct a standard curve. Due to size differences in nematode species, standard curves were developed independently for each species. Nematode area data were exported from ImageJ into Microsoft Excel for Mac 2011 Version 14.4.7 and formatted. Standard curves were developed in R using linear models fit with ten fold, ten repeated cross validation. Cross validation is a technique used to estimate and minimize prediction error that in this case used linear model standard curves fit on ten randomly chosen subsamples of data to predict out of sample values with ten replications (Efron and Gong 1983). The root mean square error, RMSE, and standardized coefficient of variation of the root mean square error, CV(RMSE), of those predictions were calculated:

$$RMSE = \sqrt {\frac{{\mathop \sum \nolimits_{i}^{n} \left( {\hat{y}_{i} - y_{i} } \right)^{2} }}{n}}$$
$$CV\left( {RMSE} \right) = \frac{RMSE}{{\bar{y}}}$$

The coefficient of variation of the root mean square error is an equivalent of the coefficient of variation of the standard deviation and was calculated to facilitate error comparison between manual and automated counting methods.

Validation

Manual counting of large numbers of live S. diaprepesi on a gridded Petri dish under a 20× Leica M165C dissecting microscope was used to estimate error inherent in manual counting for comparison to automated counting using a standard curve. Five milliliters of water containing approximately either 523 (manually counted) live S. diaprepesi or 505 (manually counted) live H. indica were shaken, subsampled six times in 100 μl aliquots, and counted manually. From these data, the coefficient of variation of the standard deviation (CV) was calculated for comparison to the CV(RMSE) from the automated counting standard curves. The non-parametric bootstrap, a statistical subsampling technique for estimating variation in parameters such as the coefficient of variation, was used to calculate ninety-five percent confidence intervals for manual counting error (Efron and Gong 1983).

Processing time

Processing time curves for manual counting under the microscope were calculated from previous experience of quantifying large numbers (>200) of live entomopathogenic nematodes responding in bioassays on a gridded Petri dish under a 20× magnification dissecting microscope. Time spent on manual counting equates to approximately 5 min per sample for large (>200) numbers of live nematodes and is roughly linear with increasing number of samples:

$$T_{Manual} = 5 \;minutes \times\# \;of \;Samples$$

Time spent on automated counting requires a modicum of initial setup time (~35 min) to prepare the digital microscope, adjust settings, and prepare samples. While automated counting does require a few additional steps, many of them, such as boiling, can be batch processed and do not require increasing investments of time with increasing sample sizes. After initial setup, processing is simply a matter of swapping samples under the microscope and is independent of the number of nematodes per sample. Photography is fast and post-imaging processing can be automated. In accordance with initial setup time and additional processing, time spent on automated counting initially resembles an increasing exponential decay function then increases linearly (but with a much smaller marginal increase than manual counting) with respect to number of samples:

$$T_{Automated} = 35 \;minutes \times \left( {1 - e^{ - \# \;of \;Samples} } \right) + \# \; of \;Samples$$

Time-savings between manual and automated counting were calculated as the difference between the manual and automated processing curves.

Analytical environment

All analyses were conducted in R version 3.1.3 ‘Smooth Sidewalk’ (R Core Team 2015) and were facilitated with the following packages: xlsx (Dragulescu 2014) for reading in excel files, dplyr (Wickham and Francois 2015) and tidyr (Wickham 2014) for data tidying, ggplot2 (Wickham 2009) for graphics, caret (Kuhn 2015) for linear model cross validation.

Results

Automated image analysis using the methods described above accurately and rapidly quantified nematodes (Fig. 1). Nematode pixel area from ImageJ analysis was an excellent linear predictor (P < 0.0001 for both species; R2 = 0.993, 0.996 for S. diaprepesi and H. indica, respectively) of total number of nematodes in a sample (Fig. 2). Manual counting using subsampling (with counts of 12, 9, 8, 9, 9, 10 S. diaprepesi infective juveniles and 12, 7, 11, 9, 9, 6 H. indica infective juveniles in each 100 μl aliquot) produced a coefficient of variation of 14.5 (95 % CI 4.5 %, 19.3 %) and 25.3 % (10.7 %, 32.8 %) for S. diaprepesi and H. indica respectively. In comparison, automated counting of H. indica achieved a CV(RMSE) of 7.0 % (6.4 %, 7.6 %), and automated counting of S. diaprepesi a CV(RMSE) of 7.8 % (7.2 %, 8.7 %) (Fig. 3). Automated image analysis using the methods described above was also a much faster alternative for processing large numbers of samples (Fig. 4) with time-savings of automated as compared to manual counting increasing with number of samples (Fig. 5).

Fig. 1
figure 1

Image processing steps incorporated into macros for automated processing in ImageJ. a Original raw image of S. diaprepesi dyed with methylene blue dye taken with Dino-Lite camera at 20× zoom from a distance of 24.5 cm. b The same image converted to 8-bit gray scale. c Image in b converted to black and white pixels using the ImageJ auto-threshold function. d Circular cropped section of image in c isolated for pixel counting

Fig. 2
figure 2

Standard curves for a Heterorhabditis indica and b Steinernema diaprepesi relating pixel area to number of nematodes for automated processing

Fig. 3
figure 3

Error from automated counting using image processing techniques and manual counting using subsampling. Error from automated counting is the coefficient of variation of the root mean square error, CV(RMSE). Error from manual counting using subsampling is the coefficient of variation of the standard deviation. Points and error bars denote mean and bootstrapped ninety-five percent confidence intervals, respectively

Fig. 4
figure 4

Processing time for both manual and automated processing calculated from experience counting large (>200) numbers of entomopathogenic nematodes

Fig. 5
figure 5

Time-savings between manual and automated processing. Time-savings between manual and automated counting were calculated as the difference between the manual and automated processing curves in Fig. 4

Discussion

Accurate and rapid counting of nematodes with automated image processing facilitates high throughput nematode assays. Accuracy—low CV(RMSE)—is high and can be greater than that obtained through manual processing of large numbers of nematodes. Depending on the underlying distribution and sample size, errors from manual subsampling can reach over 30 % (Schomaker and Been 1998). Our brief quantification of subsampling error yielded coefficients of variation of 14.5 % and 25.3 %. In comparison, errors from automated counting using image processing with standard curve comparison can be much lower (Fig. 3). As an added benefit, automated counting via comparison to standard curves gives a prediction error estimate that is typically not accounted for in manual counting processes.

In addition to being accurate, automated nematode counting using image processing techniques engenders large time-savings. Although total time spent using automated image processing does increase as the number of samples increases, this increase in time spent per sample is marginal compared to traditional manual counting (Fig. 4) and consists of simply taking a photo. After an initial investment in creating a standard curve, time-savings only increase with additional samples. Such time-savings naturally facilitate high-throughput bioassays with rapid experimental turnaround. Also, the needed equipment to transfer from manual to automated counting is inexpensive. The software (ImageJ) is readily available free of charge for download from the internet and the Dino-Lite USB camera requires a modest investment of 869 USD as of this writing. As an added benefit, after photography, images of samples can be saved for later reference. If changes or more information are needed, photographs can be consulted for further investigation.

These automated methods facilitate high-throughput experimental designs that require quantification of significant numbers of nematodes. However, at this point, the technique is only useful for samples containing a single species of similarly sized nematodes. There are additional limitations: this automated counting technique cannot differentiate between living and dead nematodes, or between batches of different average sizes. With advancements in image processing, however, and the increasing ability of computer software to recognize shapes, nematode movement (Kurtulmuş and Ulu 2014), and nematode phenotypes (Jung et al. 2014), it seems likely that differentiation of nematode species should become possible, eventually enabling automated processing and high-throughput quantification of multi-species samples. This technique should be easy to apply for rapid quantification of entomopathogenic nematodes used in biological control and indeed for rapid quantification of most microscopic terrestrial and aquatic invertebrates.