Introduction

Bovine mastitis has a serious impact on farm management, milk production, and dairy farmers’ income. In order to improve cow production and quality, reduce the cost of treating bovine mastitis, and prevent it from causing permanent damage to cows, bovine mastitis needs to be promptly diagnosed at an early stage. The gold standard for diagnosing bovine mastitis is a microbiological test [1, 2] that accurately identifies the causative agent. However, this test is demanding and costly and is not feasible as a routine screening for bovine mastitis on farms. Flow cytometry [3, 4] and direct fluorescence microscopy (DFM) [5, 6] are widely used to accurately diagnose bovine mastitis by detecting somatic cells in cow’s milk, but they are expensive and involve bulky equipment, and skilled personnel are often required for operating and maintaining the instruments. Other diagnostic methods such as detection of respiratory activity [7], viscosity [8], enzyme activity [9,10,11], cathelicidin [12], color changes [13, 14], and infrared thermography [15] are prone to inaccurate diagnosis in subclinical infections of bovine mastitis due to subjective interpretation, thus missing timely intervention and correct treatment of sick cows. High costs, or large equipment, or complex experimental operations make the mentioned diagnostic methods above available only under laboratory conditions, which is a huge problem for dairy farmers in resource-limited environments. Therefore, dairy farmers managing farms urgently need a miniaturized bovine mastitis diagnostic system with the real-time detection capability of “sample-in-answer-out” for immediate testing on the farm.

Point-of-care testing (POCT) refers to a new type of method that allows for immediate analysis at the sample site to rapidly obtain the results of sample testing. Facilitated by the miniaturization of experimental instruments, simplicity of operation, and immediate reporting of results, POCT devices capable of accurately detecting bovine mastitis are very popular on farms as well as in the dairy market. Current research on POCT devices for bovine mastitis diagnosis is based on two main tests: electrical conductivity (EC) and somatic cell counting (SCC). Dedicated EC meters can be easily integrated into automated milking systems or other sensors [16,17,18], but they have low detection accuracy and sensitivity, and can only be used as an aid to diagnosing mastitis in cows. For example, Lima et al. developed a portable device using gas sensor and EC, which was only 77% accurate in determining the occurrence of mastitis milk [19]. The diagnostic accuracy and sensitivity of SCC-based POCT devices are much higher than those of EC-based POCT devices. Most POCT devices based on SCC are miniaturized fluorescence microscopes combined with automatic micro-displacement platforms for the comprehensive acquisition of on-chamber images [20,21,22,23,24,25,26,27]. For example, Moon et al. developed the C-reader system that shows a high correlation coefficient with R2 = 0.935 ~ 0.964 with other commercial somatic cell counters [28]. There is also a smartphone [29] for the detection of bovine somatic cells, as it has been widely used in recent years for cell imaging and detection in various POCT devices [30, 31]. Although all of the above POCT instruments are capable of performing in situ sample analysis and providing fast and accurate results, they require sample-preparation procedures such as centrifugation to remove milk fat or fluorescent dye staining to be performed outside the chip, which can be a challenge for dairy farmers who are not professionally trained.

Herein, we report a designed simple portable POCT system for bovine mastitis detection on farms, containing a homemade cell-counting chamber and a miniature fluorescence microscope. The homemade cell-counting chamber is pre-stored with a dried acridine orange (AO) staining reagent that can be dissolved in loaded milk samples and stain somatic cells in situ, which eliminates the need for dairy farmers to pretreat the staining operation. This is followed by microscope imaging, which provides fast and accurate cell counting results directly from three trace raw milk samples in a single test, enabling real-time “sample-in-answer-out.” The performance of the POCT system was evaluated using bovine leukocyte suspensions mixed with whole milk to simulate raw cow’s milk samples. The concentration range of the assay was from 9.73 × 103 cells/mL to 4.98 × 106 cells/mL, which basically covered all clinical standards of cow’s milk samples. The minimum limitation of detection (LoD) of 2.12 × 104 cells/mL was achieved. Besides, four real bovine milk samples were tested on the POCT system with an average accuracy of 98.0% and a coefficient of variation (CV) of 10.56%, which was consistent with the results of manual microscopy. Compared to other point-of-care methods, the independent and user-friendly POCT system holds great promise for the diagnosis of bovine mastitis in a field setting.

Materials and methods

Materials and sample collection

Fresh raw milk samples were obtained from 4 mid-lactation (115 ± 13 days) Holstein cows from a farm in the Hulunbuir grassland of China. The cows were milked daily at 5:00 a.m., and milk samples were aseptically collected after discarding the first streams of milk. They were kept on ice during transport from the farm to the laboratory and brought to room temperature before testing. The experiments were completed within 4–6 h after milking to guarantee the freshness and somatic cell integrity of the milk. Blood samples from cows were obtained from the same farm, treated with erythrocyte lysate (Solarbio Life Sciences, China) for 10 min, and then centrifuged at 450 × g for 10 min at 4 °C. The above steps were repeated twice to obtain bovine leukocytes with  > 98% purity, and the bovine leukocytes were resuspended with whole milk (Mengniu Dairy, China). These cell suspensions were diluted threefold with whole milk to assess the counting performance of the proposed system. AO (Bosf, China) was used for fluorescent labeling of milk somatic cells and bovine leukocytes. It was diluted to different concentrations ranging from 20 to 160 μg/mL with phosphate-buffered saline (PBS) (Solarbio Life Sciences, China) to ascertain the optimum staining concentration and staining time. Anhydrous ethanol (Paini Chemical, China) was used to dissolve AO to facilitate its pre-embedding into the counting chamber. Ten-micron monodisperse fluorescent polystyrene particles (Rigor Science, China) were used to evaluate the cell-counting algorithm and the imaging performance of the miniaturized fluorescence microscope and to determine the optimum height of the homemade cell-counting chambers.

System design

The assembled view of the POCT system is shown in Fig. 1a. The device was designed in SolidWorks and can be quickly implemented in a 3D printer. The body of the whole system was assembled from three parts: the upper body part, the lower body part, and a baffle. The overall size of the instrument was only 115 mm × 77 mm × 170 mm, and the weight was only about 1.04 kg. The distribution of components inside the system is shown in Fig. 1b.

Fig. 1
figure 1

Overview of the point-of-care testing (POCT) system for bovine mastitis. a Schematic diagram of the assembled device. The entire platform is divided into three parts with a small footprint (115 × 77 × 170 mm3). b Schematic diagram of the functional components in the internal 3-dimensional view. The optical detection subsystem is on the left, and the electrical and communication subsystems are on the right. c Fabrication of the homemade somatic cell-counting chamber. Before assembly, the clean surface top and bottom plates are subjected to plasma surface cleaning. Optically clear adhesive (OCA) is bonded to the bottom plate, and then 4.8 μL of acridine orange (AO) is dropped into the unit. After drying, they are bonded together to the top plate

Optical subsystem

The miniature fluorescence microscope was inverted and consisted of a USB camera (RER-USB4K02AF-V100, Rervision, China), a tube lens (f = 25 mm, Blue Sky Technologies, China), an emission filter (LPF525 nm, Rayan Optics, China), a 10 × objective lens (NA = 0.25, Saga, China), an excitation filter (BPF485-10 nm, Rayan Optics, China), and a blue LED with a radiator (λ = 485 nm, Rubao, China). The USB camera with the tube lens could automatically focus within a depth-of-field range of approximately 100 μm. Therefore, only one manual correction of the objective lens was required for each experiment. This optical setup resulted in a field of view of 3 mm × 2.25 mm with a spatial resolution of 2.46 μm. The actual volume under the 33.99 ± 2.35 μm depth imaging area is essentially maintained at 229.5 nL, which will ensure accurate somatic cell counting.

Electrical subsystem

A Raspberry Pi Zero 2W (Waveshare, China) operated the whole system as a microcontroller and was powered by a 5 V/2A DC charger. The GPIO ports on it were used as the power supply for the LED, which was controlled by a switch. In addition, due to the lack of USB ports on the Raspberry Pi Zero 2W, an additional extended board ETH/USB HUB HAT was added to connect the HDMI Capacitive Touch Screen (Waveshare, China) and the USB camera.

Communication subsystem

The WLAN module easily facilitated data connectivity and data transfer between the Raspberry Pi Zero 2W and the server. The HDMI Capacitive Touch Screen provided a user-friendly interface for data display, which included the image captured by the USB camera as well as the processed image and the counting results from the server back to the Raspberry Pi Zero 2W.

Fabrication of homemade cell-counting chambers

The homemade cell-counting chamber is divided into three parts: top plate (0.5 mm, PMMA), bottom plate (1 mm, PMMA), and spacer layer (0.05 mm, Optically Clear Adhesive (OCA), 3 M, USA), designed in AutoCAD (size of 70 mm × 20 mm) and patterned by a CO2 laser cutter (Fig. 1c). The top plate was designed with a flat-surface inlet and outlet holes, and the spacer layer was designed with counting units. Before fabrication of homemade cell-counting chambers, the top and bottom plates were subjected to plasma surface treatment to further improve hydrophilicity and facilitate rapid sample entry and uniform distribution in the chamber. Both were directly bonded with the spacer layer to test the optimal conditions for the homemade cell-counting chamber, i.e., optimal chamber height, staining concentration, and staining time. For testing bovine milk samples, the spacer layer needed to be bonded to the bottom plate treated by hydrophilicity first, then 4.8 μL of AO dye solution (prepared in anhydrous ethanol) was applied evenly over the entire counting unit, left for 1 min at room temperature in the dark, and finally bonded to the top plate, which were hydrophilic treated. Each assembled cell-counting chamber accommodated three independent counting units. The inlets and outlets in the homemade cell-counting chamber were sealed by pressure-sensitive adhesive (PSA) tapes (3 M, USA). All assembly steps were carried out in an ultra-clean room environment.

Device operation

Figure 2a shows the operation of the POCT system from the raw milk sampling to the counting results display. The counting procedure includes the following seamlessly integrated steps: (1) using a capillary pipette to take 4 μL of freshly milked raw milk and (2) dropping it into a counting unit of the homemade cell-counting chamber from the inlet and letting it stand for 5 min to allow the AO to fully stain milk somatic cells; then (3) placing it on the chamber holder and pushing it into the system device, and turning on the LED switch to start sample testing operation; and (4) after entering the serial number of a test sample, clicking on “photograph” of the display page on HDMI Capacitive Touch Screen to see the current fluorescence image, and clicking on “count” to see the processed image and the counting results. Each testing result and image were shown on the HDMI Capacitive Touch Screen, and all diagnostic results were saved on the display page of “data logging” on it. An exemplary sequence for operating the POCT instrument is showing in Supplementary Video. The leaf spring on the chamber holder could keep the homemade cell-counting chamber still. Each counting unit could be imaged three times because of the grooves on the edge of the chamber holder, which were used with the spring plunger to fix the imaging position. The POCT system only takes less than 6 min to complete a whole “sample-in-answer-out” detection of bovine mastitis.

Fig. 2
figure 2

Workflow and working principle of the POCT system from sample to answer. a Device operation steps. Take 4 μL sample of fresh cow’s milk and drop it into the inlet of the homemade somatic cell-counting chamber. The milk sample enters the chamber with dried AO by gross suction and is stained for 5 min at room temperature. Then put it into the device to start counting. The image captured by the system and the test result can be presented by clicking on “photograph” and “count” in the screen. b Staining principle. AO stains the somatic cells in bovine milk, thus enabling the identification of somatic cells from a large number of milk fat globules. c Data processing principle. The POCT system is linked to the same LAN as the server, and the images captured by the device are transmitted to the server for processing and counting, and then the results are returned to the screen of the device for display. d Data logging. The results of each test are stored in the server on the one hand and can be searched and viewed through the “data logging” interface of the device on the other hand

Cell image acquisition and analysis

The image size captured by the USB camera was 3840 pixels × 2160 pixels, which was changed to 2880 pixels × 2160 pixels during image processing. The custom python-based image processing code also included accessing the target image for binarization, image thresholding segmentation to remove the background, counting the number of isolated objects, and calculating the signal-to-background ratio (SBR) of the captured image when characterizing the homemade cell-counting chambers.

Experimental setup

A benchtop fluorescence microscope with a 10 × objective lens (Olympus, Japan) had a similar field of view to the miniaturized fluorescence microscope and was used to evaluate the homemade cell-counting chambers and compare its imaging performance and counting results with that of the miniaturized fluorescence microscope. Fluorescence images were captured using a charge-coupled device (CCD) equipped with the benchtop microscope and their fluorescence intensities (FI) were measured using ImageJ software (National Institutes of Health, USA). In addition, the counting results of the miniaturized fluorescence microscope were compared with that of the fluorescence microscope in order to assess the counting accuracy of the POCT system.

Results and discussion

Working principle

AO fluorescent dye was allowed to transport across cell membranes passively and can permeate through cell membranes to stain nuclear acid. It emits green fluorescence (at 525 nm) when binding to dsDNA and yellow/red (at 650 nm) when binding to ssDNA or RNA. Such unique features enable on-chip cell staining without off-chip sample-preparation processes such as cell permeabilization and washing. AO fluorochrome staining has been shown to be valuable in histology, cytology, pathology, and clinics for detection of circulating tumor cells (CTC) [32,33,34], leukocytes [35,36,37], and lysosomal membrane stability [38]. Therefore, we use it to detect somatic cells in bovine milk (Fig. 2b). It is difficult to distinguish and identify somatic cells in the bright field because of the large number of fat globules of various sizes in bovine milk. When the fresh milk sample is fully mixed and stained with the AO in the counting unit, the milk somatic cells emit a distinct green fluorescence with a trace of yellow fluorescence after the blue LED excitation. Even though the fat globules and some other substances in the cow’s milk will diffusely reflect the fluorescence causing the background to be green instead of dark, the location of the somatic cells can still be quickly identified in the fluorescence field.

Since the slow processing of data by the Raspberry Pi Zero 2W can cause system lag, we decide to let the data process in the server and complete the data transfer between them via LAN to achieve fast bovine milk somatic cell counting and enable real-time “sample-in-answer-out.” As is shown in Fig. 2c, when uniform resource locator (URL) is opened on the Raspberry Pi Zero 2W, the video data stream from the USB camera is started and the counting program starts stakeout for the source file accessible to the image processing code and is ready to run in the server. Once the current data stream is captured, it is first converted into a picture, in order to present the original fluorescent image on the HDMI Capacitive Touch Screen on the one hand and to transmit the picture over the LAN and save it in a source file mentioned above on the other hand. When the counting program monitors that a new file has been deposited, it starts to run and returns the processed image and the counting results to the Raspberry Pi Zero 2W for display. The entire data transfer between the Raspberry Pi Zero 2W and the server can be completed within tens of seconds.

In addition, the inspection results of each test are saved on the display page of “data logging” in chronological order, including the test sample no., the number of isolated objects in the captured image, the concentration of bovine milk somatic cells, and the health assessment of the testing sample. According to Proposal P1022 reported in the food standards code in Australia, we divide the concentration of dairy cells into five categories, corresponding to the five health assessment conditions of health (< 200,000 cells/mL), sub-clinical (200,000 ~ 400,000 cells/mL), clinical (400,000 ~ 700,000 cells/mL), and severe (> 700,000 cells/mL). Each diagnosis of a cow can be found on the display page by searching for the sample number, which greatly facilitates the careful management and timely treatment of each bovine by dairy farmers (Fig. 2d). Nevertheless, we will continue to develop an Android application on the smartphone in the follow-up work to make the POCT system more user friendly.

Cell-counting algorithm

To count bovine milk somatic cells in the captured fluorescent images, a simple cell-counting algorithm is developed (see Supplementary Information Fig. S1). We use 10-µm monodisperse fluorescent polystyrene particles mixed 1:1 with whole milk to simulate somatic cells in the fresh milk sample, which is imaged within the POCT system. The original fluorescent image size captured by the USB camera needs to be cropped in order to perform image processing due to distortion at the image edges and inhomogeneous background brightness. After that, it is grayed out and the gray background is removed using the top-hat algorithm [39] because the background of the original fluorescent image is green instead of dark. Then, the OTSU method is used to binarize the image as well as to make isolated objects on the image more visible and remove background noise using the closure operation. We record the area size of each isolated object and use an area-allotting algorithm [40] to determine whether it is a single somatic cell, multiple somatic cells, or other material in bovine milk. In this way, the number of somatic cells in the imaging area can be effectively determined. Since the fresh milk sample is directly dripped into the homemade counting chamber, which also eliminates the need for sample dilution, the final number of somatic cells is calculated using the following formulation:

$$SCC(cells/mL)=\frac{N}{V}\times {10}^{6}$$

where N is the average number of somatic cells imaged three times within a counting unit and V is 229.5 nL, which is the analysis volume per image. In summary, this simple cell-counting algorithm ensures accurate somatic cell counting in bovine milk.

Optimization processing of the homemade cell-counting chambers

We first investigated the optimal parameters for the height of the cell-counting chamber. For this parameter study, we tested chamber heights from 25 to 100 μm and characterized them with monodisperse fluorescent polystyrene particles of 10 μm at a concentration of approximately 3.27 × 106 units/mL resuspended in whole milk at a ratio of 1:10. Fluorescence images were acquired by a benchtop fluorescence microscope, and their SBR was calculated and their FI was tested using ImageJ. As shown in Fig. 3a, all monodisperse fluorescent polystyrene particles could be uniformly dispersed on the chamber floor, and the number of fluorescent particles increased with the increase of the chamber height, the higher the intensity of their emitted green fluorescence after blue light excitation. However, since whole milk is an emulsion, it can produce the Tindal effect. The green fluorescence emitted by the fluorescent particles inside it would produce a phenomenon similar to diffuse scattering, making the background fluorescence gradually increased with the increase of the chamber height, while the FI of the fluorescent particles gradually decreased. Therefore, as the chamber height increased, the SBR increased and then decreased, thus determining 50 μm as the optimal height of the cell-counting chamber.

Fig. 3
figure 3

Optimal conditions for the homemade somatic cell-counting chambers. All fluorescence images were taken under a conventional fluorescence microscope. Scale bar: 100 μm. Error bars: s.d. (n = 3). a The optimal chamber height was 50 μm. As the chamber height was increased from 25 to 100 μm, the fluorescence intensities (FI) of 10-μm polystyrene fluorescent particles gradually decreased, but the signal-to-background ratio (SBR) reached a peak at 50 μm. b The optimal staining concentration was 26.7 μg/mL. Fluorescence images of bovine leukocytes within the clean chamber were captured after staining 5 min, and the concentration of the fluorescent staining reagent AO ranged from 6.7 to 53.3 μg/mL. As the concentration increased, the FI of the stained cells gradually increased, while the SBR gradually diminished. Both of them reached a stable value at 26.7 μg/mL. c The optimal staining time was 5 min. Fluorescence micrographs showing the temporal evolution of the FI of stained somatic cells in the chamber at 26.7 μg/mL. Over time, the FI and the SBR of the stained cells increased first, peaked at the 5th minute, and then weakened slightly. d Optimal conditions for the pre-embedding method. The cells FI and image SBR at a concentration of 26.7 μg/mL for staining 5 min were used as a comparison. The fluorescence image taken after pre-embedding 26.7 μg/mL AO and incubating in the chamber for 5 min had the largest SBR and higher FI of stained cells. Ud: uniform-dyeing; Pe: pre-embedding

After that, we performed the optimal conditions for the staining concentration and staining time of the fluorescent staining reagent AO. The bovine blood leukocyte resuspension purified by centrifugation was approximately 1.57 × 107 cells/mL, and it was mixed with different concentrations of AO reagent and whole milk in a ratio of 1:1:1 to prevent the concentration from being too high to massive cell aggregation. After thorough mixing, the samples were loaded into a clean, unstained cell-counting chamber with an optimal chamber height of 50 μm, incubated for 5 min at room temperature and protected from light, and then taken to a benchtop fluorescence microscope at 1-min intervals for photo observation. Fluorescence images of each counting unit on the cell-counting chamber were measured for only one set of concentrations at one moment. Figure 3b shows the fluorescence plots of the cells after 10 min of different concentrations of the staining reagent as well as their FI and SBR. The FI of the cells gradually increased when the concentration of AO was increased from 6.67 to 26.7 μg/mL, and the green fluorescence emitted by the cells basically reached the threshold when the concentration continued to increase again. Correspondingly, the increase in concentration made the background fluorescence gradually enhanced, and the SBR reached the threshold at the concentration of 26.7 μg/mL, although the decreasing trend of SBR gradually leveled off when the concentration was greater than 26.7 μg/mL. The reason for this is that the limited amount of fluorescent coupling between AO and intracellular nucleic acid material makes excess staining dye present in whole milk, which affects the SBR. Somatic cell fluorescence images at a concentration of 26.7 μg/mL and their FI and SBR changes over time are shown in Fig. 3c. After loading the samples, the FI of the cells gradually increased with time and reached a peak at the 5th minute, after which there was some decrease. This is due to the accumulation of AO (a cationic dye) in the acidic vesicles, and when it is protonated in a lower pH environment, the dye is “trapped by the acid”; thus, more red fluorescence is emitted [41]. Similarly, the SBR reached a plateau at the 5th minute, indicating saturation of intracellular fluorescent coupling formation. After that, the SBR slightly decreased still because of the background fluorescence. We likewise performed experiments to simultaneously measure the effect of staining concentration and staining time on somatic cell imaging (see Supplementary Information Fig. S2). The experimental results show that there was no interaction between these two experimental parameters. That was the reason we used a one-at-a-time procedure to optimize the two parameters. Taken together, there is an optimal AO reagent staining concentration of 26.7 μg/mL and an optimal staining time of 5 min that allows the relative maximization of both the somatic cells FI and the SBR of its fluorescence image.

For ease of use by dairy farmers who are not professionally trained, fluorescent staining reagents need to be pre-embedded into the cell-counting chamber. Here, we choose anhydrous ethanol as the solvent to configure different concentrations of AO reagent. There are three main reasons: (1) AO can be dissolved in anhydrous ethanol; (2) the AO solution prepared with anhydrous ethanol can be evenly spread across the chamber floor by simply dropping it inside the chamber, and (3) it can be dried quickly at room temperature without additional manual operations and ovens. We verified the stability of AO deposition on the substrate of the somatic cell-counting chamber (see Supplementary Information Fig. S3). The experiments led to the conclusion that the stability of depositing AO on the substrate could be maintained for more than 2 months, provided that it was kept sealed and protected from light. After that, we configured three concentrations of AO reagents, 26.7 μg/mL, 40 μg/mL, and 80 μg/mL, with anhydrous ethanol and pre-loaded them in the cell-counting chamber respectively. In order to test the comparison of the cell-staining effect of the pre-embedded method and the mixed staining method, it was necessary to ensure the consistency of each solvent. Therefore, we mixed the cell resuspension with whole milk as well as PBS in the ratio of 1:1:1 well before loading it into the cell-counting chamber and incubated and protected it from light for 5 min at room temperature before placing it under a benchtop fluorescence microscope for observation. As shown in Fig. 3d, the same staining within the chamber for 5 min, the higher the concentration of preincubated AO reagent, the stronger the FI, with the FI of the 40 μg/mL AO preincubation method being comparable to that of the 26.7 μg/mL AO mixing method. On the contrary, the higher the concentration of the pre-embedded reagent, the lower the SBR. The main reason for this is still the enhancement of background fluorescence caused by the high concentration and the inherent limitation of AO and intracellular nucleic acid fluorescence coupling. However, the image SBR of the same 26.7 μg/mL pre-embedded method was inferior to the SBR of the miscible method, which might be due to the different solvents used to configure the AO reagent. In addition, at the same concentration of 26.7 μg/mL, the SBR increased and then decreased with increasing incubation time, and the image FI gradually reached a peak. The cause of this result remains the background fluorescence. In conclusion, the AO reagent with pre-embedded 26.7 μg/mL anhydrous ethanol stained the bovine somatic cells for 5 min within the chamber to achieve the maximum SBR, which is consistent with the mixed staining.

Microscopic imaging analysis and comparison

After verifying that the homemade cell-counting chamber can stain bovine milk somatic cells with on-chip fluorescence, we investigated the ability of the POCT system to detect green fluorescence spots in milk. For comparison, 10-μm monodisperse polystyrene fluorescent particles were imaged using a miniaturized microscope within the POCT system and a conventional benchtop fluorescence microscope. Figure 4 shows the imaging performance of the miniaturized microscope, as well as a comparison of the size of individual fluorescent particles in different microscopic imaging maps. The full width at half maximum (FWHM) of the fluorescent particles under the miniaturized microscope occupied an average of 9.274 pixels, which was somewhat different from the 11.633 pixels under the conventional fluorescence microscope. Therefore, to ensure the actual size of somatic cells in bovine milk samples for subsequent detection, we performed the closure operation on the images taken by the miniaturized microscope to make isolated objects more visible for counting on the one hand. And on the other hand, the FWHM of fluorescent particles occupied an average of 11.986 pixels after image processing, which was comparable to that under fluorescence microscope (n = 9). These results indicate that our POCT system has comparable imaging performance to a conventional benchtop fluorescence microscope for the imaging and analysis of fluorescent particles in bovine milk.

Fig. 4
figure 4

Comparison of the imaging performance of the miniaturized microscope in the device with that of the benchtop fluorescence microscope. Fluorescence micrographs of 10-μm polystyrene particles taken by miniaturized microscope (left) and fluorescence microscope (right). Scale bars: 100 μm. Normalized calculation of cross-sectional fluorescence values for green fluorescent spots obtained by the miniaturized microscope and fluorescence microscope, and that after image processing

Sensitivity

In order to evaluate the performance of the proposed POCT system, a detection limit experiment was performed. Bovine leukocyte suspension at a concentration of 1.49 × 107 cells/mL was diluted threefold with whole milk and then diluted into 10 milk samples in equal ratio with concentrations ranging from 9.73 × 103 cells/mL to 4.98 × 106 cells/mL, which encompassed a variety of clinical criteria. Individual samples were added to the prepared cell-counting chamber and incubated for 5 min before being tested in the system for counting. Figure 5a shows the relationship between the number of bovine leukocytes in the samples determined by the POCT system and that determined by microscopy. Notably, there was an excellent linear relationship between the number of cells counted by the system and the fluorescence microscope (R2 = 0.9944). This agreement validates the ability of our proposed POCT system in counting somatic cells in real bovine milk samples. The lower left corner in Fig. 5a shows the detection capability of our system at the concentration of 9.73 × 103 cells/mL, however, with a relatively high CV value. To be rigorous, we consider that a minimum LoD of 2.12 × 104 cells/mL will be more reasonable with a CV of 13.3% at the higher level of concentration of 1.94 × 104 cells/mL. Better performance can be expected by improving the resolution of the USB camera.

Fig. 5
figure 5

Counting comparison between the POCT system and manual fluorescence microscopy. a Comparison of the counting performance of simulated raw bovine milk samples. Bovine leukocytes were added to whole milk to simulate raw cow’s milk samples. Sample concentrations ranged from 4.98 × 106 to 9.73 × 103 cells/mL by dilution in equivalent ratio. The gray dotted line represents the unity slope. The detection limit of the system was as low as 2.12 × 104 cells/mL. Error bars: s.d. (n = 4). b Comparison of count results from four real raw cow’s milk samples. The system achieved 98.0% counting accuracy. Error bars: s.d. (n = 6)

In addition, we used the proposed portable platform for real milk sample testing. The majority of somatic cells in milk are leukocytes, accounting for about 98 to 99% of the total, and the remaining 1 to 2% of somatic cells are epithelial cells shed from the breast tissue [42]. Therefore, we believe that not distinguishing between epithelial cells and leukocytes has little effect on the accuracy of SCC identification. Before starting imaging and cell counting, four fresh cow’s milk samples were shaken and dropped into each of the prepared cell-counting chambers and incubated away from light for 5 min in order to clearly distinguish the stained cells from the background. For comparison, images of the somatic cells were also taken using a conventional fluorescent microscope and the number of cells was counted manually. As shown in Fig. 5b, the POCT system gave higher counts than the actual sample concentration for both diseased and healthy cow’s milk samples. It was because some somatic cells in the raw bovine milk were encapsulated by some milk fat, which had a larger connectivity domain when the image was segmented, causing the counting code to determine them as multicellular and thus resulting in a higher somatic cell concentration. Nevertheless, the somatic cell concentrations calculated by the POCT system were in good agreement with the manual microscopy results, with an accuracy of 98.0%. On average, the CV for the cell counts obtained using the POCT system was 10.56% (range: 3.12–16.78%), which was comparable with that of 8.32% (range: 1.94–15.51%) obtained using the fluorescence microscope.

Cost analysis and devices comparison

Low cost is the most important feature when translating a technology into routine diagnostic practice. By making use of careful system design, consumer electronics, and low-cost prototyping such as laser cutting and 3D printing, we were able to assemble our prototype for about $ 450 at 6% of the cost of its commercial counterparts. Due to the ease of processing and cheap manufacturing materials, the fabrication cost of each cell-counting chamber is approximately $ 0.15, and it is expected that the cost per test will be further reduced for a mass-produced version, which will reduce the cost to dairy farmers for routine detection of bovine mastitis on farm. The detailed bills of materials for replicating our device and a somatic cell-counting chamber are listed in Supplementary Table S1 and Supplementary Table S2, respectively.

In addition, A comparative overview of existing POCT devices based on SCC for the diagnosis of bovine mastitis against our system is presented in Supplementary Table S3. Our proposed POCT system has an advantage in manufacturing cost as well as size and weight of the device, although the counting accuracy is lower comparing Lactoscan SCC [25] and DeLaval DCC [26] for commercial devices. The POCT system saves assay time by eliminating the sample pre-treatment process compared to devices proposed by other research groups such as i-scope [24] and C-reader [28]. the SeCy [21] and the device developed by Kim’s groups [23] also eliminated the sample pre-treatment process, but the former used centrifugation to obtain SCC with lower accuracy, and the latter device required an extra tablet computer support. In short, the POCT system we design combines excellent accuracy with low manufacturing cost and minimal cost per test compared with other POCT equipment of the same type, making it ideal for dairy farmers operating in resource-limited areas.

Conclusions

In summary, we designed and produced a low-cost, miniature POCT system for the rapid and portable detection of bovine mastitis. The integrated on-chip sample preparation eliminates the need for pre-processing steps such as dilution, making it easy for dairy farmers to handle and use; simple and accurate somatic cell counting facilitates on-farm monitoring of milk quality and management of mastitis in dairy cows. The whole process from sampling to quantification can be completed in less than 6 min and provides accurate somatic cell counts and screening for bovine mastitis with an accuracy of 98.0%, enabling real-time “sample-in and answer-out.” Based on the benefits we have demonstrated, the system is ideal for low-cost, resource-limited field applications and can be extended to other applications requiring fluorescent staining and target cell counting, such as live-dead cell detection and blood cell counting.