Open Access

Automatic Cryptosporidium and Giardia viability detection in treated water

  • Shahriar Badsha1,
  • Norrima Mokhtar1Email author,
  • Hamzah Arof1,
  • Yvonne Ai Lian Lim2,
  • Marizan Mubin1 and
  • Zuwairie Ibrahim3
EURASIP Journal on Image and Video Processing20132013:56

Received: 17 May 2013

Accepted: 10 October 2013

Published: 31 October 2013


In the automatic detection of Cryptosporidium and Giardia (oo)cysts in water samples, low contrast and noise in the microscopic images can adversely affect the accuracy of the segmentation results. An improved partial differential equation (PDE) filtering that achieves a better trade-off between noise removal and edge preservation is introduced where the compass operator is utilized to attenuate noise while retaining edge information at the cytoplasm wall and around the nuclei of the (oo)cysts. Then the anatomically important information is separated from the unwanted background noise using the Otsu method to improve the detection accuracy. Once the (oo)cysts are located, a simple technique to classify the two types of protozoans using area, roundness metric and eccentricity is implemented. Finally, the number of nuclei in the cytoplasm of each (oo)cyst is counted to check the viability of individual parasite. The proposed system is tested on 40 microscopic images obtained from treated water samples, and it gives excellent detection and viability rates of 97% and 98%, respectively.


Parasite calculation Parasite differentiation Nucleus calculation Automatic viability confirmation

1. Introduction

Cryptosporidium parvum and Giardia lamblia are two common waterborne parasites infecting humans worldwide [1]. In infected humans, the organisms normally attack the small intestine after being ingested [2, 3]. They are found mostly in surface waters, where their concentration is related to the level of faecal pollution or human use of the water [46]. Cryptosporidium and Giardia parasites can also be found in infected sheep, cattle and many other animal species such as cat, beaver, deer and flies. Besides diarrhoea, other symptoms of giardiasis and cryptosporidiosis are slight fever, fatigue and myalgia. In rare cases, these parasites may infect the lungs and trachea, resulting in cough, dehydration and extreme weight loss [79].

The impact of epidemic Cryptosporidium and Giardia outbreaks has motivated many researchers to find measures to prevent them from recurring worldwide. As a result, studies related to the transmission, detection and life cycle of the parasites have proliferated. The process of detecting the presence of Cryptosporidium and Giardia (oo)cysts in water and wastewater samples involves filtration, isolation, staining and microscopy. In microscopy, direct visual inspection under a microscope is performed by an expert to detect the presence of Cryptosporidium and Giardia (oo)cysts. This manual inspection is tedious and time-consuming. Attempts have been made to implement automatic detection of (oo)cysts in microscopic images to increase the efficiency of the process. Widmer et al. used an artificial neural network (ANN) algorithm to accurately identify Cryptosporidium and Giardia (oo)cyst images. Back-propagation technique was employed in the training process, and adjustment of weights was made within the neuron layers. The aim was to minimize the error between the predicted and the correct solution [10]. Fernandez-Canque et al. implemented an algorithm that detected Cryptosporidium oocysts using shape and colour features in fluorescein isothiocyanate (FITC)-stained images [11].

In this paper, an automation detection system is developed to detect the presence of Cryptosporidium and Giardia (oo)cysts in samples of treated water concentrate. The system employs a modified partial differential equation (PDE) filter to denoise FITC- and 4′,6-diamidino-2-phenylindole (DAPI)-stained images. The modified fourth-order PDE filter uses the compass operator instead of the common Laplacian operator so that more edge information is preserved. In addition, roundness metric, nucleus counting and viability measure are also incorporated as additional features. This paper is organized as follows. Section 2 contains details of the steps involved in the system, and Section 3 describes the experimental results of implementing it on 40 stained images. Finally, conclusion is presented in Section 4.

2. Proposed system

The proposed system has three major parts which are pre-processing, identification and post-processing. Figure 1 shows the flow chart of the proposed algorithm. In the pre-processing part, greyscale conversion, filtering and thresholding are implemented. In the identification part, Cryptosporidium and Giardia (oo)cysts are identified using roundness metric and eccentricity. The post-processing part consists of viability checking and nucleus counting.
Figure 1

Flow chart of the proposed methodology.

2.1 Pre-processing

After greyscale conversion, it is observed that the greyscale images contain significant noise. As a result, small nuclei appear almost similar to background noise in the image. Therefore, the noise in the DAPI images needs to be filtered while important edge information must be preserved. Preserving the orientation of anatomically significant edges while detecting the nuclei is a challenging task. For this purpose, a modified fourth-order PDE diffusion filter is used.

The formulation of the fourth-order PDE starts with the definition of the energy function to be minimized as follows [12]:
E I = Ω f 2 I Ω

where E(I) is the energy function, |2 I| is the absolute value of the Laplacian of I and Ω is the support domain in the image (I). Since f(|2 I|) is an increasing function of |2 I|, its global minimum is at |2 I| = 0. The Laplacian of an image at a pixel is zero if the image is planar in its neighbourhood. Therefore, the minimization of the functional is equivalent to smoothing the image to piecewise planar.

Through functional analysis, the corresponding Euler equation for the energy function is
2 c 2 I 2 I = 0
and the Euler equation can be solved through gradient descent procedure as
I t = 2 c 2 I 2 I
where the diffusion coefficient is
c 2 I = f ' 2 I 2 I
Preserving the orientation and directions of all anatomically significant edges while detecting the nuclei is very important for our case study. For this purpose, the compass operator is used to replace the Laplacian operator in the PDE filter to better preserve the edges from eight different angles. For each pixel, the local edge gradient magnitude is estimated by convolving the eight kernels of the compass operator with the 3 × 3 neighbourhood centred at the pixel. The eight kernels should capture the edge information at 0°, 45°, 90°, 135°, 180°, 225°, 270° and 315° for the gradient passing through the centre pixel as shown in Figure 2. The maximum absolute value of the eight convolutions is taken as the one representing the local gradient of the pixel's neighbourhood, and its corresponding direction should be considered when minimizing the Laplacian magnitude anisotropically.
Figure 2

Kernels of the compass operator.

The coefficient of the Laplacian operator is c(|2 I |). Dissipation can be measured by this coefficient. The Laplacian operator is isotropic or uniform to the orientations; therefore, the compass operator has been used as it is free from the orientations. So the coefficient of the new PDE will be c(|O k I|).

Therefore, the fourth-order PDE becomes
I t = 2 c O k I O k I
where O is the compass operator and k is the direction of the compass that generates the maximum gradient at the pixel in image I. The diffusion coefficient c(|O k I|) is given by
c O k I = 1 1 + O k I z 2
Here k = 0.5. Further details on the implementation of the PDE diffusion filtering on discrete image are available in [13]. By applying the PDE diffusion filtering, noise can be removed from the DAPI images as shown in Figure 3.
Figure 3

Image with noise (a) and noise-free image (b).

2.2 Thresholding

Using the Otsu thresholding, the greyscale image is converted into a binary image [14]. The process is described as follows:

Suppose a greyscale image of FITC and DAPI contains N pixel with grey levels from 1 to L. The number of pixels with grey level i is denoted by g i . Therefore, the probability of grey level i in an image is given by
p i = g i N
The pixels are divided into two classes: C 1 and C 2, where the grey levels are [1,…, t] and [t + 1,…, L]. Now the grey level probability distributions are
C 1 = p 1 ω 1 t , ..... p 2 ω 2 t
C 2 = p t + 1 ω 2 t , p t + 2 ω 2 t , ..... p L ω 2 t
ω 1 t = i = 1 t p i
ω 2 t = i = t + 1 L p i
The means are specified as
μ 1 = i = 1 t i p i ω 1 t
μ 2 = i = t + 1 L i p i ω 2 t
where the mean intensity is described as follows:
ω 1 μ 1 + ω 2 μ 2 = μ T
ω 1 + ω 2 = 1
Now the variance between classes is
σ B 2 = ω 1 μ 1 μ T 2 + ω 2 μ 2 μ T 2 .
When variance between classes is maximized, then the threshold T is chosen. The binary image I(x,y) is obtained after applying the following Equation 14. Figure 4a shows an example of the original image, and Figure 4b shows the converted binary image.
I x , y = 1 white if I 1 T 0 black if I 2 < T
Figure 4

Original image sample (a) and converted binary image (b).

2.3 Identification

Area, roundness metric and eccentricity measure are used to identify Cryptosporidium and Giardia (oo)cysts in the binary image. Cryptosporidium oocysts are circular and smaller in size whereas Giardia cysts are bigger but elliptical. The calculation of area, roundness metric and eccentricity of an object starts with obtaining the perimeter. Consider a discrete binary image, which contains one or more objects, where the object pixels are 1 and the background pixels are 0. Basically, the perimeter of each object is the total number of pixels at the boundary around the object. The counting starts at an arbitrary initial pixel at the boundary of the object. After traversing and adding the total pixels around the object, the count should end at the initial pixel. The area of an object is the number of pixels in the object after its parameter is fixed. Figure 5 shows an example of how the perimeter and area of an object are calculated.
Figure 5

Calculation of the perimeter and area of an object. (a) Original object. (b) Area of the object after digitization. (c) Pixels that constitute the object perimeter.

The roundness metric is calculated for each object from the image using Equation 15. Its value will be close to 1 if the object is circular or has a round shape, but it will be less than 0.9 if the object is elliptical.
M = 4 × π × A P 2

where A and P are the area and perimeter of the object, respectively.

To calculate the eccentricity of an object is to measure how similar the object is to an ellipse. Hence, an ellipse is fitted to each object as shown in Figure 6, and eccentricity is calculated according to the following equation.
eccentricity = c a
where α is the distance from the centre to a focus point on the major axis and c is the distance from the focus point to a vertex on the minor axis. F1 and F2 are the two focus points called foci. The foci always lie on the major (longest) axis of an ellipse, spaced equally on each side of the centre. The value of eccentricity is greater than 1 for an elliptical object but is less than 1 for a circular object.
Figure 6

Eccentricity of a sample elliptical-shaped object.

3. Post-processing

An (oo)cyst is considered viable if there are nuclei inside its body. The positions of the (oo)cysts are highlighted in the FITC, but their nuclei can only be seen clearly in the DAPI image. Therefore, the FITC and DAPI binary images have to be merged to see whether the nuclei lie within the (oo)cysts. Since the area and perimeter of each (oo)cyst are already known, if there are no nuclei within the area of the (oo)cyst in the merged image, it is regarded as nonviable.

From the resultant image, nucleus counting is done for viability confirmation. Counting nuclei is similar to counting objects in the image. The number of objects/nuclei can be counted by the following steps [15].

Consider a binary image I containing several objects (nuclei) where the pixels of the nuclei have a value of 1 and the background has a value of 0.
  1. 1.

    Set the number of nuclei to 0.

  2. 2.
    Scan the image until we locate a pixel (x,y) belonging to a nucleus, i.e. f(x,y = 1).
    1. (a)

      Increase the number of nuclei by 1.

    2. (b)

      Find all pixels connected to pixel (x,y), i.e. find the entire object.

    3. (c)

      Remove the object from the image by setting all its pixel values to 0.

  3. 3.

    Continue scanning (back to step 2) until we reach the end of the image.

After termination, the objects will be labelled {2,…, n + 1}, where n equals the number of objects in the image. Each pixel of an object will now have the same integer value as shown in Figure 7.
Figure 7

Image containing objects before and after labelling. Zero pixel values are left blank for clarity.

4. Experimental results

The proposed technique is tested on 40 images containing Cryptosporidium and Giardia (oo)cysts extracted from samples of treated water concentrate obtained from the Department of Parasitology, University of Malaya. Table 1 shows the decision rule adopted to differentiate the Cryptosporidium and Giardia (oo)cysts. Figures 8 and 9 display the detected Cryptosporidium and Giardia (oo)cysts in a sample image, respectively.
Table 1

Decision system to identify the Cryptosporidium and Giardia




Roundness ≥ 0.9 ∩ area ≤ 1.0e + 003 × 1.24


Eccentricity > 1 ∩ area ≥ 1.0e + 003 × 0.24

Figure 8

Detection of Cryptosporidium oocysts. (a) FITC image. (b) DAPI image. (c) Cryptosporidium detection. (d) Roundness metric calculation. (e) Nucleus detection and calculation.

Figure 9

Detection of Giardia cysts. (a) FITC image. (b) DAPI image. (c) Giardia detection. (d) Eccentricity calculation. (e) Nucleus detection and calculation.

Tables 2 and 3 show the combined detection, viability and nucleus counting rates of Cryptosporidium and Giardia (oo)cysts for the 40 images.
Table 2

Performance evaluation in terms of detection and checking the viability of Cryptosporidium


Result (average, %)





Nucleus calculation


Table 3

Performance evaluation in terms of detection and checking the viability of Giardia


Result (average, %)





Nucleus calculation


Figure 8a,b displays the FITC and DAPI images which contain both Cryptosporidium and Giardia (oo)cysts, respectively. Figure 8c shows the position of the detected Cryptosporidium oocyst, and Figure 8d shows the value of its roundness metric. Figure 8e confirms the viability of the oocyst and the number of nuclei residing in it. Similarly, Figure 9a,b shows the DAPI and FITC images containing both types of (oo)cysts. Figure 9c shows the location of the detected Giardia cyst, and Figure 9d shows the value of its eccentricity. Finally, Figure 9e confirms the viability of the cyst and the number of nuclei within it.

Figures 10 and 11 show the performance of the proposed method and human observer in counting the number of parasites in the 40 images, while Figures 12 and 13 show their performance in nucleus counting. Minor errors are mainly caused by overlapping (oo)cysts and nuclei.
Figure 10

Comparison with the human observer in terms of Cryptosporidium viability checking and calculation.

Figure 11

Comparison with the human observer in terms of Giardia viability checking and calculation.

Figure 12

Comparison with the human observer in terms of nucleus counting for Cryptosporidium.

Figure 13

Comparison with the human observer in terms of nucleus counting for Giardia .

5. Conclusions

In this work, a robust technique is presented for image filtering of DAPI- and FITC-stained images for Cryptosporidium and Giardia (oo)cyst detection using compass operator with fourth-order PDE. Roundness metric and eccentricity are utilized to differentiate Cryptosporidium and Giardia (oo)cysts in 40 images. The performance of the system is measured in terms of detection, viability and nucleus counting rates and compared against those of the human observer. Excellent rates of more than 97% are achieved for both parasites on all measures. In the future, segmentation and identification of overlapping and occluded nuclei and (oo)cysts in clean and dirty images will be considered.



This research is fully supported by Exploratory Research Grant Scheme (ER031-2011A) under the Ministry of Higher Education, Malaysia.

Authors’ Affiliations

Applied Control and Robotics Laboratory, Faculty of Engineering, University of Malaya
Department of Parasitology, University of Malaya
Faculty of Electrical & Electronic Engineering, Universiti Malaysia Pahang


  1. Smith AH, Lopipero PA, MN Bates CM: Steinmaus, Arsenic epidemiology and drinking water standards. Sci. 2002, 296: 2145-2146. 10.1126/science.1072896View ArticleGoogle Scholar
  2. Carmena D: Waterborne transmission of Cryptosporidium and Giardia : detection, surveillance and implications for public health. In Current Research, Technology and Education Topics in Applied Microbiology and Microbial Biotechnology, vol. 20. Edited by: Mendez-Vilas A. Formatex, Badajoz; 2010:3-4.Google Scholar
  3. Robertson LJ, Johannessen GS, Gjerde BK, Loncarevic S: Microbiological analysis of seed sprouts in Norway. Int. J. Food Microbiol. 2002, 75: 119-126. 10.1016/S0168-1605(01)00738-3View ArticleGoogle Scholar
  4. LeChevallier MW, Norton WD, Lee RG: Occurrence of Giardia and Cryptosporidium spp. in surface water supplies. Appl. Environ. Microbiol. 1991, 57: 2610-2616.Google Scholar
  5. Meisel J, Perera D, Meligro C, Rubin C: Overwhelming watery diarrhea associated with a cryptosporidium in an immunosuppressed patient. Gastroenterol. 1976, 70: 1156.Google Scholar
  6. Hansen JS, Ongerth JE: Effects of time and watershed characteristics on the concentration of Cryptosporidium oocysts in river water. Appl. Environ. Microbiol. 1991, 57: 2790-2795.Google Scholar
  7. Fayer R, Ungar B: Cryptosporidium spp. and cryptosporidiosis. Microbiol. Rev. 1986, 50: 458.Google Scholar
  8. Ungar BL: Cryptosporidiosis in humans ( Homo sapiens ). In Cryptosporidiosis of Man and Animals. Edited by: Dubey JP, Speer CA, Fayer R. CRC Press, Boca Raton; 1990:59-82.Google Scholar
  9. McClellan P: Sydney Water Inquiry, Final Report. Government of New South Wales, Sydney; 1998.Google Scholar
  10. Widmer KW, Srikumar D, Pillai SD: Use of artificial neural networks to accurately identify Cryptosporidium oocyst and Giardia cyst images. Appl. Environ. Microbiol. 2005, 71: 80-84. 10.1128/AEM.71.1.80-84.2005View ArticleGoogle Scholar
  11. Fernandez-Canque H, Beggs B, Smith E, Boutaleb T, Smith H, Hintea S: Micro-organisms detection in drinking water using image processing. Cell. 2006, 15: 4.2.Google Scholar
  12. Lysaker M, Lundervold A, Tai X-C: Noise removal using fourth-order partial differential equation with applications to medical magnetic resonance images in space and time. IEEE Trans. Image Process. 2003, 12: 1579-1590. 10.1109/TIP.2003.819229View ArticleGoogle Scholar
  13. You Y-L, Kaveh M: Fourth-order partial differential equations for noise removal. IEEE Trans. Image Process. 2000, 9: 1723-1730. 10.1109/83.869184MathSciNetView ArticleGoogle Scholar
  14. Liao P-S, Chen T-S, Chung P-C: A fast algorithm for multilevel thresholding. J. Inf. Sci. Eng. 2001, 17: 713-728.Google Scholar
  15. Pratt WK: Digital Image Processing. Wiley, Hoboken; 2001.View ArticleGoogle Scholar


© Badsha et al.; licensee Springer. 2013

This article is published under license to BioMed Central Ltd. This is an open access article distributed under the terms of the Creative Commons Attribution License (, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.