Anisotropic Phase Stretch Transform-based Algorithm for Segmentation of Activated Sludge Phase-contrast Microscopic Image

The activated sludge (AS) process is a biological treatment process of wastewater used in sewage treatment plants, in which settling of AS is vitally important for wastewater treatment. In AS, however, bulking caused by filamentous bacteria will significantly reduce the settling capacity of activated sludge. Traditionally, the physicochemical method has been used to monitor the status or performance of filamentous bacteria in activated sludge, while it is a very compromising means in modern digital quality control for wastewater treatment when digital image processing and analysis technology is used to determine the status of filamentous bacteria in activated sludge. In order to avoid the disadvantages of deficient direction selectivity in the translation vector field for isotropic phase stretch transform (PST) and high noise susceptibility in determining the status of filamentous bacteria in AS and low accuracy, an anisotropic PST (APST) method for filamentous bacteria test in AS was proposed in this paper; specifically speaking, by analyzing and deriving the disadvantages of the traditional isotropic PST kernel function, we designed an APST kernel function, put forward a non-maximum suppression strategy for processing of images from different aspects and combined with the relative total variation theory to form APST-based algorithm for segmentation of activated sludge phase-contrast microscopic image. According to a large number of experimental results, in terms of the overall segmentation effect or the subjective and objective evaluation indicators, the resultant algorithm in this paper is superior to the latest traditional PST segmentation algorithm, Canny image segmentation algorithm and Sobel image segmentation algorithm. Also, the segmentation results for filamentous bacteria showed that probability rand index (PRI) and global consistency error (GCE) indicators were all improved by about 30%, supporting the effectiveness and superiority of the algorithm in this paper.


I. INTRODUCTION
Activated sludge is the grain of flocculent structure formed by mixture of microorganisms, suspended substances and colloids etc. featuring strong adsorption performance and favorable settling ability [1]. The stability of floc is the precondition for favorable settling ability, while favorable settling ability is the foundation for stability of processing system. The decreased settling ability of activated sludge can lead to sludge bulking and decreased processing effect, or loss of floc along the water, which will deteriorate the effluent quality [2]. There are multiple factors affecting the settling ability of activated sludge, microscopically including sludge floc morphological structure, flocculation capacity, viscosity, hydrophilia [3] and surface electrical behavior [4], floc size and distribution characteristics [5], sludge concentration [6], EPS (Extracellular Polymeric Substances) content, ion strength, positive ion concentration, microbial population and their activity, filamentous bacteria type and quantity etc [7]. However, the measurement of the above-mentioned factors involves high cost, complex operation and long duration. With the development of digital image processing and microscopic technology, AS image processing and analysis based on digital image becomes an effective potential means for monitoring the microorganism state and sludge bulking in sewage treatment plants [8].
Image segmentation is a key step in image analysis and the basis for further understanding of the microbial structure. The accuracy of image analysis depends on the quality of the segmentation of microbial aggregates and filaments in microscopy images of activated sludge. Several traditional image segmentation algorithms, including edge detection, clustering, texture-based segmentation, watershed algorithm, and some combinations of algorithms, have been reported for activated sludge images [9]. Khan et al. proposed a robust segmentation procedure for flocs and filamentous bacteria, and investigated regression models for SVI on the basis of the extracted morphological characteristic parameters of filaments and flocs [10]. Shelhamer et al. adopted contemporary classification convolutional networks into fully convolutional networks (FCNs) and transfer their learned representations to the segmentation task [11]. The U-Net deep learning network is a potential tool that can be used to further improve the loss of detailed image information caused by the multiple down-sampling operations of the image in the network [12]. The U-Net model network structure is easily trained and is suitable for a small sample. Li-Jie Zhao et al. proposed segmentation of activated sludge phase contrast microscopy images using U-Net deep learning model [13].
The analysis and processing of phasecontrast image of activated sludge are divided into 5 stages, including image acquisition and display, image enhancement, image segmentation, mathematical morphology processing and feature information extraction. Therein, image segmentation and feature information extraction are to extract the significant features or those to be investigated in the image (e.g., features of filamentous bacteria and flocs), which is the most critical step during the process of image analysis. The image segmentation methods extensively used mainly include threshold segmentation, clustering segmentation, region growing, deep learning, genetic-based segmentation, edge detection-based segmentation method (e.g., Canny-based image segmentation) and phase-based image segmentation, etc. Nisar et al. [14] adopted phase stretch transform (PST) for segmentation of phase-contrast image of activated sludge, which gets a good segmentation. However, in the paper, the main theory of phase warp and stretch transform was not analyzed in depth, and the traditional isotropic phase kernel function was still adopted. PST (phase stretch transform) is the theory and method proposed by M.H. Asghari and B. Jalali [15] in 2015 for digital signal and image processing, and its fundamental principle is to adopt warp and translation of signal phase after Fourier transform so as to highlight the phase information of high-frequency component and enlarge the angle value corresponding to the edge in the image after inverse Fourier transform, thereby acquiring the medium-high frequency features of image (e.g., edge and texture etc.). The kernel function for phase translation initially designed by M.H. Asghari and B. Jalali is an isotropic inverse tangent function without direction selectivity, and shows equal phase translation of different frequency spectrum on the concentric circle of the same radius on the plane for frequency domain (u, v), so that the detected edge contains massive noises, and especially the isolated, finely-divided high-frequency noisy points are reserved as the high-frequency components in the image by mistake, which brings difficulty in the subsequent threshold processing. Through theoretical analysis in this paper, a kind of anisotropic kernel function model for phase translation was proposed, which extended the contents of PST theory put forward by M.H. Asghari and B. Jalali, and the anisotropic PST was applied to the segmentation between filamentous bacteria and floc microorganism in the phase-contrast image of activated sludge and a favorable effect was obtained.
The contents of this paper were arranged as follows: in section 2, we introduced the background and the basic theory of PST, and analyzed the design and features of the typical isotropic kernel functions for phase translation; in addition, we designed an anisotropic PST kernel function for translation; besides, the rationality of the anisotropic kernel function was demonstrated theoretically to put forward a non-maximum suppression strategy for anisotropic translation vector field. According to the experimental results, the anisotropic kernel function proposed in this paper is not only superior to the traditional isotropic kernel function, but also better than the edge feature detection performance of the typical operators such as Canny and Sobel. In section 3, we compared and analyzed the experimental results of edge feature extraction and segmentation of microscopic image of bacteria. Section 4 describes the conclusion.

II. SEGMENTATION ALGORITHM FOR ACTIVATED SLUDGE BASED ON APST
A. The algorithm flow is as follows: can not only be used for structure-texture decomposition of image and image editing, but also as an effective filtering tool suitable for reservation of fine structure of image [16]. RTV firstly defines local windowing total variation measure ( ), ( ) x y D p D p [16] of every pixel p on any image S: ( ) R p is a local rectangle window centering on pixel p; q belongs to ( ) R p ; It is noticed that ( )   (4), and the following edgepreserving filtering [16] is formed: Where, I means input image; S is the resulting structure image (i.e., filtering output image) extracted from the input image;

1) INTRODUCTION OF PST
PST, a physics-inspired digital image transformation, which was proposed by M.H. Asghari and B. Jalali in 2015, simulates the process of electromagnetic wave propagation in the diffraction medium with a dielectric function that has warped dispersive (frequency dependent) property. It simulates the diffraction process through specific all-pass phase filter H(ω)=exp{jβ(ω)} with frequency-dependent diverging, in which phase β(ω) group delay  (ω)=∂β(ω)/∂ω is "S"-shape linear or sub-linear function, able to reshape signal field before signal sampling at analog-to-digital conversion to realize compression of analog signal bandwidth without prolonged duration of the signal in time domain, i.e. reducing TBP (time bandwidth product) of the signal to solve the two inherent problems of the traditional Nyquist uniform sampling [15]: first, when sampling rate is given, the traditional Nyquist uniform sampling can only acquire the information which is two times the maximum frequency components of the signal; second, when there is redundant in analog signal, the traditional Nyquist uniform sampling will obtain far more samples than necessary since oversampling occurs for the signals lower than Nyquist frequency).
PST that can be used before analog-to-digital conversion (ADC) can also be applied in the field of digital signal processing. The process of digital image edge detection -based PST was shown in Figure 4, in which the source image was subject to smoothing through a local low-pass filter kernel function, a phase operation of non-linear frequency function called phase stretch (dispersion) transform (PST) in frequency domain, and finally post-processing including thresholding and morphological filter to achieve edge detection. The mathematical model of PST in frequency domain is as follows [15]     where,

( , )
A m n is the output phase image; "∠" is the angle operator;

2). BASIC PST KERNEL FUNCTION
Although any phase kernel function can be considered in PST, according to the literature [15], the derivative of kernel function ( , ) u v  , i.e., group delay, is the linear or sub-linear function of the variable frequency. One simple example is "S"-shaped inverse tangent function. For simplicity, assuming that this operation for phase warp is isotropic on the plane of frequency domain, the warp degree is only related to the polar radius r under the polar coordinate system on o-uv frequency plane but irrelevant to polar angle θ; that is, assuming that the kernel function prototype of PST shows a circular symmetry in terms of the variable frequency, Where, r is the polar radius under the polar coordinate system on o-uv frequency plane; θ is polar angle and its relation with the variable frequency uv: , the derivative of r is S-shaped inverse tangent function, then It is noticed that the uv frequency plane after Fourier transform is a finite region, thus, ( ) polar r  can be solved by equation (7).
( ) t a n ( ) t a n ( ) 1 1 t a n ln (1 ) 2  is obtained through normalization of phase function in equation (8): Phase stretch strength S and warp W in non-linear warp and stretch transform are added into the phase function in equation (9) to obtain the final kernel function for phase translation ( , , )  N r W S with strength parameter S and warp parameter W in PST: 1 2 It can be seen from equation (11)  Therefore, an anisotropic translation vector field is proposed in this paper to make the translation to be of direction selectivity, and then the pseudo-edge is greatly reduced by the non-maximal suppression strategy to make the detection algorithm more robust to noise.

3) ANISOTROPIC TRANSLATION KERNEL FUNCTION
The typical isotropic inverse tangent translation vector field defined in equation (8) and equation (10) is irrelevant to direction because polar angle θ is ignored in equation (6); thus, it is isotropic, i.e., it is an inverted taper surface. If the constraint of PST for "increasing A/D sampling rate to reduce time-bandwidth product of analog signal" is not considered, the PST phase warp and stretch kernel function can be designed more specifically only from the perspective of application of PST to digital signal or image processing merely.
In equation (6), if θ=0, θ=π/2, the translation kernel functions of PST for direction selectivity on frequency plane u and v are obtained respectively: Two anisotropic (i.e., inclined to the edges of horizontal and vertical directions respectively) translation vector field prototype functions are obtained thereby: 3D surface and gradient surface of translation Taylor expansion is adopted and the biquadrate of u is rejected to obtain the approximate result: According to the general model (5) (17) It is noticed that: Equation (19) (22) is adopted.
In this paper, the strategy of "suppression of local non-maximum" was adopted for the translation kernel function with direction selectivity designed in such way, assuming that:

E. DUAL THRESHOLD SELECTION AND LAG EDGE FOLLOWING
General edge detection algorithm is to use one threshold to filter the small gradient value caused by noise or color change and to reserve large gradient value. Dual threshold, i.e., one high threshold and one low threshold were used for the algorithm in this paper to distinguish edge pixel. If the gradient value of edge pixel point is larger than the high threshold, it will be regarded as strong edge point. If gradient value of the edge pixel is smaller than the high threshold but larger than the low threshold, it will be marked as weak edge point (the effect example of strong edge point and weak edge point was shown in Figure  9). The points with gradient value smaller than the low threshold are eliminated. Strong edge point can be regarded as the true edge, while weak edge point can either be true edge or false edge caused by noise or color change. To obtain accurate results, the weak edge point caused by the latter shall be eliminated. It is generally believed that the weak edge point and strong edge point caused by true edge are connected, while it is negative to the weak edge point caused by noise. The so-called lag edge following algorithm is to detect the pixels in 8 connected domains of one weak edge point, in which once a strong edge point is found, this weak edge point will be reserved as a true edge. This algorithm will search all the connected weak edges, if any point of the connected weak edge is connected with strong edge point, this weak edge will be reserved; otherwise, it will be suppressed.

A. COMPARISON OF EXPERIMENTAL RESULTS
Comparing analysis was performed for the edge obtained through the algorithm in this paper, i.e., image segmentation effect chart and the image segmentation by Canny, traditional isotropic PST and Sobel algorithm. The code for the algorithm of this paper was provided by the author (https://github.com/lanbaoshi110/papers), and the comparison of some images in phC-U373 data set was shown in Figure 10 The average subjective evaluation score for the segmented image was finally obtained:

2) OBJECTIVE EVALUATION
Objective evaluation can be divided into system/task-based evaluation and direct evaluation, in which direct evaluation can be further divided into analytical method and experimental method. The experimental method is also divided into the segmentation quality evaluation with supervision (reference segmentation is required) and segmentation quality evaluation without supervision (reference segmentation is not required). The classification of these evaluation methods is not mutually exclusive because each type of evaluation method has specific limitation; thus, only combination of multiple types of evaluation method can achieve mutual complementarity.
Segmentation quality evaluation with supervision is the evaluation method based on similarity or diversity measures, determining advantages and disadvantages of segmentation algorithm by measuring the similarity or diversity between algorithmic segmentation and reference segmentation. The greater the similarity or the smaller the diversity between algorithmic segmentation and reference segmentation, the higher the quality of the segmentation algorithm is. Two evaluation indexes with supervision, i.e., PRI (Probability Rand Index) [18] and GCE (Global Consistency Error) [19] were adopted in this paper for evaluation.
(1) PRI Image segmentation can be regarded as the Where, N means total number of pixel points; To further illustrate the advantages of the algorithm proposed in this paper, 50 AS phase-contrast images were selected from PhC-U373 data set and processed by four image segmentation algorithms including traditional PST and Canny etc. The processing results were evaluated subjectively and objectively; in the subjective evaluation, H=30 was used as the quality assessor for image segmentation, and mean value of subjective evaluation was shown in figure 15; the PRI and GCE values of objective evaluation were shown in figure 16 and 17. It can be seen from Table 2-8 and  Figure15-17, the average subjective evaluation score and PRI value by algorithm in this paper were higher than those based on the image segmentation algorithms including traditional PST, Canny etc. GCE values are lower than those based on the image segmentation algorithms including traditional PST, Canny etc., which fully demonstrates that the noise inhibiting effect by the algorithm in this paper is better, reducing the probability of excessive, insufficient and incomplete segmentation of the activated sludge containing noise and unclear edge. In addition, its segmentation result is more approaching to the ideal edge and better segmentation effect is obtained due to enhanced image edge. The image segmentation by traditional PST showed better edge but with noise inhibiting active bacteria; Canny-based image segmentation showed the result of inaccurate segmentation effect including excessive segmentation etc., under the influence of noise; Sobel-based image segmentation showed insensitivity to image edge and error results including excessive segmentation etc.
To sum up, both the integral segmentation effect and the mean value of evaluation index further verify the effectiveness and stability of the algorithm in this paper.

IV. CONCLUSION
Aiming at the lack of direction selectivity of traditional isotropic PST, this paper put forward a kind of APST, designed the translation vector field with X and Y direction selectivity, and performed operations including non-maximum suppression and edge extraction etc., for the translation vector field at X and Y directions to obtain phase-contrast image microbial segmentation algorithm for activated sludge. The objective evaluation indexes PRI and GCE indicated that the microbial segmentation result by the algorithm proposed in this paper was significantly superior to that by traditional PST, Canny and Sobel etc. Compared with the image segmentation algorithm by traditional PST etc., the PRI and GCE evaluation indexes in the segmentation result of filamentous bacteria were promoted by around 30%; thus, the research result can be applied to digital monitoring and control of settling performance of activated sludge in wastewater treatment.