Digital microscopic image application ( DMIA ) , an automatic method for particle size distribution analysis in waste activated sludge

An important physical property in environmental samples is particle size distribution. Several processes exist to measure particle diameter, including change in electrical resistance, blocking of light, the fractionation of field flow and laser diffraction (these being the most commonly used). However, their use requires expensive and complex equipment. Therefore, a digital microscopic imaging application (DMIA) method was developed adapting the algorithms used in the helminth egg automatic detector software coupled with a neural network (NN) and Bayesian algorithms. This allowed the determination of particle size distribution in samples of waste activated sludge (WAS), recirculated sludge (RCS), and pre-treated sludge (PTS). The recirculation and electro-oxidation pretreatment processes showed an effect in increasing the degree of solubilization, decreasing particle size and breakage factor with ranges between 44.29%, and 31.89%. Together with a final NN calibration process, it was possible to compare results. For example, the 90th percentile of equivalent diameter value obtained by the DMIA with the corresponding result for the laser diffraction method. DMIA values: 228.76 μm (WAS), 111.18 μm (RCS), and 84.45 μm (PTS). DMIA processing has advantages in terms of reducing complexity, cost and time, and offers an alternative to the laser diffraction method.


GRAPHICAL ABSTRACT INTRODUCTION
Due to reduction of mass and the production of methane (CH 4 ), treatment of waste activated sludge (WAS) by anaerobic digestion constitutes the most common stabilization process applied worldwide (Bougrier et  However, it only converts between 20 and 50% of the organic matter to biogas. The process is also limited by the hydrolysis of organic compounds due to the relationship between the amount of methane generated and the surface available for microorganisms (Yu et  To overcome this limitation, various pre-treatment processes have been proposed to increase the solubilization of organic matter (Dogǎn & Sanin ; Ding et al. ). Of these, electro-oxidation represents an efficient alternative (Veluchamy et al. ; Pérez-Rodríguez et al. ).
Electro-oxidation pre-treatment is based on the formation of oxidizing species, mainly hydroxyl radicals (OH • ), which attack long-chain organic compounds (Veluchamy et al. ). It (a) improves hydrolysis (Tyagi et al. ; Anjum et al. ), and (b) contributes to reducing the costs generated through the activated sludge treatment train, which amounts to 50% of the total treatment plant operation (Fdz-Polanco et al. ; Ak et al. ).
In order to evaluate the efficiency of pre-treatment processes, several parameters with an influence on anaerobic digestion have been analyzed, one of these processes is particle size distribution. Decrease in particle size distribution results in an improved digestion process by increasing surface area and thus the degradation rate (Yu et al. ). Measurement of particle size distribution is routinely carried out across a wide range of industries including chemical, food, mining, forestry, agriculture, nutrition, pharmaceutical, energy, and aggregate; understanding these effects becomes a critical parameter in the success of manufacturing processes. Improved size distribution also promotes some chemical reactions via their acceleration or an increase in the quantity of some products.
In the environmental field, this analysis of particle size distribution predicts the rates of settlement and allows the characterization of sludge particles (Wu & Wheatley ). Furthermore, particle size analysis has been proposed as a measure of microbial quality through correlations between the number or volume of particles and the concentration of microorganisms such as helminth eggs (Chávez et al. ).
The morphology of the particles that form activated sludge can be determined via various methods, such as change in electrical resistance, blocking of light, field flow fractionations, sedimentation, and diffraction of laser beams, one of the most widely applied to determine the diameter of the particles. These techniques require the use of costly equipment, and the results obtained may be questionable when samples are compared, mainly due to possible fragmentation of sludge flocs during handling (Wang et al. ; Bieganowski et al. ).
For decades, microscopy has represented an alternative for determining size and number of particles or flocs; it allows visible individual particles to be analyzed at the required magnification, and only small volumes of the sample are required. In addition, during generation, extraction, preparation, and measurement, it is feasible: (a) to measure a representative sample or subsample of the original floc suspension, (b) to avoid damage, breakage, or change in the shape of the flocs, (c) to avoid further aggregation.
Due to the accessibility of computers and digital image capture techniques the application of microscopy for digital microscopic image application (DMIA), an adaptation of the helminth egg automatic detector (HEAD), was applied. HEAD is an image processing system developed to automatically identify and quantify different species of helminth eggs of medical importance from conventional microscopy images taken from environmental samples (Jiménez et al. ), and it could constitute an alternative to traditional laser diffraction measurement to analyze and quantify particle size. In addition, it is a relatively simple technique, and may be carried out over much shorter time periods.
Considering the above information, the objective of the present work was to evaluate and compare microscopic digital image application, through the adaptation of the algorithms that make up the HEAD software. It was evaluated as an alternative method to determine the average size of particles with respect to the laser diffraction techniques currently used for the analysis of WAS, recirculated (RCS), and pre-treated (PTS) WAS.

Collection and preparation of activated sludge samples
Untreated WAS was obtained from a municipal wastewater treatment plant located east of Mexico City, Mexico. Sludge samples were obtained directly from the secondary waste valve of the secondary settling tank, in 20 L plastic containers, and transported to the laboratory. Samples were stored at 3 C for a period not exceeding 4 days. The conditioning of the WAS at a final concentration of total solids of 3% total solids, consisted of a previous sedimentation for two hours to remove the supernatant, followed by centrifugation of the sediment at 1,400 × g for 20 minutes (Beckman Coulter brand centrifuge, model Avanti J-26S XPI, JA-10 rotor). To remove material that could cause plugging of the electro-oxidation and recirculation system, the activated sludge was sieved using a 0.3 mm screen (Pérez-Rodríguez et al. ).

Electrochemical pre-treatment
Electrochemical pre-treatment was performed in a commercial electrochemical cell (Diaclean, Waterdiam, Switzerland) with boron-doped diamond electrodes. Based on prior studies (Pérez-Rodríguez et al. ), the conditions of pre-treatment were 19.3 mA cm À2 , 30 minutes, and 5 L min À1 . RCS was obtained under the same conditions as the electrochemical pre-treatment (30 minutes and 5 L min À1 ), but without applying current, in order to identify the influence of turbulence and shear within the electrooxidation system (hoses, pump, stirrer paddle, etc.) on the sludge. For each test, four repetitions were performed.

Degree of solubilization (DS)
To measure the DS of the organic matter present in the sludge following electrochemical pre-treatment, Equation (1) was used (Appels et al. ). DS represents the fraction of organic matter that is in a soluble form (in terms of chemical oxygen demand, COD) and, therefore, readily available to the microorganisms that produce methane (Appels et al. ; Yu et al. ): where: CODs is the soluble chemical oxygen demand in RCS or PTS (mg O 2 L À1 ), CODs 0 is the soluble chemical oxygen demand in WAS (mg O 2 L À1 ), CODt 0 is the total chemical oxygen demand in WAS (mg O 2 L À1 ).
The CODt and CODs of the sludge samples were determined according to the Standard Methods (APHA-AWWA-WEF ). In the case of the CODs, the activated sludge samples were previously centrifuged (1,400 × g for 20 min) and the supernatant was filtered using 0.45 μm filters (Millipore ® ). A JEOL brand scanning electron microscope (SEM), model JSM-6360 LV was implemented to observe the morphological characterization of the sludge samples using the methodology reported by Kashi et al. ().

Laser diffraction method
At the same time, and in order to be able to compare the results between the two methods, volumes of the three different sludge samples were sent to the Chemistry Institute, UNAM, to be processed with standard diffraction laser (Mastersizer 2000, Malvern Instruments). The general characteristics of the Mastersizer 2000, Malvern Instruments equipment are shown in Table 1.

Digital microscopic image application, a HEAD software adaptation
Through the adaptation of different algorithms of the HEAD software, and in conjunction with the computer system developed in MATLAB (MathWorks ® ), a DMIA method to perform the size analysis of the particles present in the different sludge samples was tested (Belanche-Muñoz & Blanch ; Dogantekin et al. ; Avci & Varol ). By using coding from the HEAD software, such as image thresholding and morphologic operators, it was possible to separate the particles presented in the image and the background to later determine their characteristics of area and equivalent diameter (ED).

Digital microscopic image application method
In order to determine the particle size accurately it was necessary to perform a scaling step. DMIA provides a processing function that applies a micrometric scale to determine a pixel size, in microns, of the image data set ( Figure 1).

Sludge samples
One set of 50 microscopic digital images was obtained for each type of sludge sample. Prior to imaging, the sludge samples were diluted with distilled water at a 1:5 ratio (sludge: water). For the DMIA method the following statistical parameters were determined applying a MATLAB program: (a) pixel size in microns (based on a millimeter scale) and (b) the statistical values (maximum, minimum, average, median, range, standard deviation, percentiles and dispersion).

Digital microscopy color image capture
Images were taken with a Carl Zeiss AxioLab A1 optical microscope and an Imaging Development Systems U2-1480LE-C-HQ USB2 color camera. To collect homogenous images, all of them were acquired at 2,560 × 1,920 pixel resolution without compression.

Gray level conversion
For each captured image the gray level conversion was carried out. This reduced processing time, since instead of processing three image channels (blue, green and red on RGB), their average is used, reducing possible noise due to the sensitivity of each band.

Median filtering algorithm
Median filtering is a nonlinear process, advantageous in reducing impulsive or salt-and-pepper noise. It is also appropriate for preserving large edges in an image while reducing random noise (Koivuranta et al. ). In a median filter, a window slides along the image, and the median intensity value of the pixels (5 × 5) within the window becomes the output intensity.

Histogram equalization
The histogram equalization method is appropriate for images with backgrounds and close-ups that are bright or dark, characterized by increasing the overall contrast of the images, especially when the data from the image are represented by small contrast values. This is the case for images with normalized gray level values concentrated at a threshold of 0.3 to 0.6, and which after equalization are distributed almost uniformly from 0 to 1. At this setting the intensities will be better distributed on the histogram; in this case, using the Michelson contrast and calculating its  value in the images, the contrast value increases from 0.3 to 1 (Pelli & Bex ).

Binarization by a local threshold
Image thresholding is a common task in many computer graphic vision applications. Its main goal is to permit spatial variations in lighting to be established, for which it applies the local average intensity around the pixel vicinity (Bradley & Roth ). The main concept of this algorithm is that each pixel is compared with the average of the surrounding pixels. In doing so, an approximate moving average of the last pixels seen while the image is being traversed is estimated. If the value of the current pixel is ten percent lower than the average, it is set to black (background), otherwise, it is set to white (particle).

Size filter and blobs connected with the image border
The principal characteristic employed to determine floc size was the area. In order to calculate the ED, Equation (2) was applied. A database within which the floc size statistics can be calculated was created: where: ED is the equivalent diameter; A is the area of the particle.
To verify whether the number of flocs was representative in the determination of particle size distribution, the Paine's critical number shown in Equation (3) where: r refers to the base distribution intervals, being equal to 1 for numeric average, 2 for EDs based on area, and 3 for EDs based on volume.
GSDr is the geometric standard deviation (Equation (4)): where: dr, 84 is the diameter on r base where 84% of the particle distribution is found, and dr, 16 is the diameter where 16% of the particle distribution is detected.

Statistical analysis
Once particle areas and EDs were calculated for all of the samples (WAS, RCS, and PTS) by DMIA, the statistical analysis of average size, standard deviation, range, and percentiles in an Excel compatible format file was obtained.

Breakage factor
Besides the DS, in order to evaluate the effect of electrochemical treatment on particle size, the breakage factor was also calculated. The breakage factor is an international indicator employed in different types of environmental samples (Equation (5)) and refers to the relationship between the average of the WAS and the pre-treated and RCS. A smaller factor indicates greater rupture of the sludge flocs by treatment and therefore a smaller particle size (Koivuranta et al. ; Wu et al. ): where: value 1 applies to the sludge after processing (RCS or PTS), in terms of ED, value 2 applies to WAS, in terms of ED.

RESULTS AND DISCUSSION
Electrochemical treatment Table 2 shows an increase in the DS in the electrochemically PTS compared to the RCS.
The increase in the DS in RCS can be explained by the shear caused by the pump rollers as well as the turbulence within the system. However, the DS in PTS is higher, largely due to the effect of OH • radicals causing cell breakage. Table 3 shows the average ED for each of the sludge samples obtained using the DMIA method, where the minimum value (0.98 μm) corresponds to the lower limit of particle detection equivalent to three pixels of resolution for image acquisition, in accordance with Souza & Menegall (). Equivalent diameter values for the minimum, 10th and 25th percentiles indicate that small particles have a similar distribution, with the larger sludge particles the most affected by the recirculation and electro-oxidation processes. The mean and maximum values indicate that the highest value of ED was for the WAS (167.25 μm), followed by the RCS (135.17 μm), and finally by the PTS (86.73 μm).

Digital microscopic image application
As expected, the statistical parameters such as median, 75th, 90th percentiles and maximum values was higher for the PTS (92,426), and RCS (44,824) samples, with respect to WAS (22,319); this is explained as a result of the effect of recirculation and electro-oxidation in the breakdown of particles and therefore in the increase in quantity in the same sample.
By using values lower than the defined threshold, it was possible to eliminate small objects such as air bubbles. These may be considered as false particles created by the microscope. Similar actions, such as erosion, generate similar results by eliminating particles smaller than the defined threshold, allowing their verification if they are in contact with the edges of the image (Koivuranta et al. ).
For DMIA, the MATLAB program processes each microscopy original image and calculates the ED of each detected particle together with their total number in the analyzed volume. Finally, it shows the particles detected in each image, calculates the statistical information (maximum and minimum values, percentiles, mean, etc.), and stores these data in Microsoft Excel documents for later use. Figure 2 shows a screen capture of the DMIA user interphase with a processed image.

Laser diffraction method
It should be noted that the particle size analysis by Master Sizer Instrument Equipment does not show the results of mean and percentiles as the DMIA method does. Table 4 shows ED values for the 90th that indicate that 90% of the particles in the WAS sample had values lower than 232.32 μm, lower than 112.21 μm for RCS, and lower than 82.55 μm for PTS, the sample with the smallest size. This can also be observed in Figure 3, where, the largest particles were detected in the WAS sample, without any alteration, and the smallest in the PTS.
According to Dogǎn & Sanin () and Pérez-Rodríguez et al. () electrochemical treatment has a pronounced effect on the disintegration of the floc structure, solubilizing intracellular material, and therefore having the effect of enhancing the hydrolysis stage during anaerobic digestion of sludge.

Breakage factor
To characterize breakage in the RCS and PTS samples, the breakage factor was calculated (see Equation (2)). The average values were RCS: 44.29%, and PTS: 31.89%; which agree with those observed in the digital microscopic and SEM images, where small particle sizes were seen in the PTS. Figure 4 shows the images obtained by SEM analysis of the sludge samples. In the case of WAS (Figure 4(a)), a relatively rougher surface is observed with respect to the RCS (Figure 4(b)), and PTS (Figure 4(c)).
As can be seen, in PTS the surface becomes smoother, visibly confirming that shear and turbulence, in addition to the electro-oxidation treatment, cause a reduction in particle size.

Paine's critical number
Using the results of the laser diffraction method, the Paine's number calculated from the WAS sample using Equations (4) and (5) (Souza & Menegall ).

Comparison between methods
A comparison between the two methods shows lower DMIA values in each of the three different sludge samples; according to an evaluation of the magnitudes obtained by each method, these differences are due to the image processing technique. In order to solve this issue, a correction applying the adjustment established by Jarvis et al. () was carried out ( Figure 5). Particle size is commonly reported using ED and the probability distribution comparison by volume (Mastersizer 2000). Table 5 shows the statistical results of the particle ED for the WAS sample obtained by laser diffraction and DMIA methods.  The comparison of the ED values using both techniques showed that, in the case of the DMIA method, the numbers are significantly lower for each of the statistical parameters, indicating an underestimation of the particle size. For the application of the defined threshold, particles of at least 3 pixels in length must be taken into account, guaranteeing the elimination of those whose ED value is less than 0.98 μm. This conforms to the 8-connectivity standard, where all neighbors that touch one of the edges or corners of a central pixel are connected horizontally, vertically and diagonally (Koivuranta et al. ).
The calibration values for the particle size distribution data did not show a linear behavior, as can be seen in Figure 6, where each value is different along the corresponding ED.
Since the calibration value for each percentile was different, instead of using models such as linear regression, it was necessary to apply a neural network (NN) fitting algorithm to the three types of sludge samples. The implementation is a two-layer feed-forward NN with a Bayesian regularization employed in the training step. This gives a good generalization for small datasets but requires more time (Burden & Winkler ).
Using this adjustment, the values are expected to be similar for the two methods: a set of numerical input data (image processing) and a set of numerical targets (Mastersizer 2000).
The data sets were divided into three parts: • Training (65% of the data set): values present themselves to the network during training, and the network adjusts them according to their error.
• Validation (5% of the data set, due to the lack of use for Bayesian regularization): used to measure network generalization and to stop training when generalization stops improving.
• Testing (30% of the data set): no effect on training, therefore it provides an independent measure of network performance after training.   After the training process, NN performance was measured using an error histogram test. Figure 8 shows examples of error histograms for trained NN with WAS, RCS, and PTS data: distribution of errors in the training stage (blue), and independent performance testing (red).
Errors are distributed within the limits of À6.17 μm and 4.48 μm (Figure 8(a)), showing that the NN fitting performance has a small threshold of error, and avoids underestimating or overestimating the values (Bishop & Roach ). In similar cases, the errors ranged between À1.77 μm and 1.93 μm (Figure 8(b)) for RCS, and À0.77 μm to 0.85 μm for PTS (Figure 8(c)).
The mean square error (MSE) and regression values (R) were used to estimate the NN fitting quality: • (MSE): The difference between the average squared between outputs and targets. Zero means that there is no error.
• (R): Values that measure the correlation between results and objectives. An R value of 1 means a close relationship, 0 a random relationship. Table 6 shows the NN training results for each type of sludge in the test group. The RCS has a considerably lower MSE value compared to the WAS and the PTS, but the linear regression in all cases indicates a close relationship between the data calculated by means of the NN and that given by the Mastersizer 2000.
A comparison was made between the percentage values of the Mastersizer 2000 and those generated by the proposed    digital image processing method, which together with an NN calibration, allowed a determination of the behavior of the various ED sizes, from the smallest to the largest. Table 7 and Figure 9 show the compatibility of the percentile values for the three sludge samples, for DMIA and laser diffraction methods, before and after the NN calibration step.

CONCLUSIONS
The application as a whole of a DMIA, the adaptation of HEAD software algorithms, the implementation and regulation of adjustments of models such as a NN for a final calibration process, allowed the evaluation of the particle size distribution of three different samples of activated sludge: untreated WAS, RCS, and PTS. After the recirculation and electro-oxidation pre-treatment processes, each of which showed an effect on increasing the DS, a decrease in particle size was observed. This was also reflected in the breakage factor shown by the laser diffraction method, with ranges of between 44.29% (RCS) and 31.89% (PTS). This was confirmed by analysis of the average values obtained for the breakage factor using the DMIA method after NN calibration: RCS: 38.22%, and PTS: 31.44%.
Statistical values such as average size, standard deviation, range, percentiles, breakage factor, and Paine's number agree with those observed in digital microscopic and SEM images, where small particle sizes were seen in the PTS. The passage of current density through the sludge attacked the particles, and gave it a relatively more homogeneous appearance, which inferred that the process causes a reduction in particle size, increasing the contact surface area available to degradation by microorganisms, and therefore also enhancing anaerobic biodegradability.
The values of ED observed for the three types of sludge samples, for the two methods investigated in the present study, are of similar magnitude. This followed homologation after a final NN calibration process of the values obtained by the DMIA method. The DMIA method represents a basis to create a tool capable of calculating the particle size statistics for sludge samples, since it can detect a representative number of particles (22,319), assuming that the particle distribution is lognormal. Compared with the traditional diffraction laser method the proposed methodology has the following advantages: ✓ A relative simplicity in the preparation of the sample to obtain images. ✓ An economical alternative. The equipment needed for the analysis, and an optical microscope, are found in most environmental engineering laboratories. ✓ A reduced time for the test determination. ✓ Calculation of data from measures of central tendency and measures of dispersion.
Following the NN calibration process, comparison of values obtained by DMIA and laser diffraction show that both methods are statistically compatible. It is important to mention that additional particle size values in lower   and upper thresholds values may be required; for example, for those values obtained by the DMIA NN calibrated method in the WAS sample that are below 0.45 μm (1.44 μm for the laser diffraction) or over 417.29 μm (416.86 μm for the laser diffraction method). The NN fitting process must be strengthened to allow calibration and estimation through the development of a training database more advanced than the proposed by the present study. This should be carried out in order to reduce the difference between the minimum and maximum values.