An Automated Image Segmentation and Useful Feature Extraction Algorithm for Retinal Blood Vessels in Fundus Images

: The manual segmentation of the blood vessels in retinal images has numerous limitations. It is very time consuming and prone to human error, particularly with a very twisted structure of the blood vessel and a vast number of retinal images that needs to be analysed. Therefore, an automatic algorithm for segmenting and extracting useful clinical features from the retinal blood vessels is critical to help ophthalmologists and eye specialists to diagnose different retinal diseases and to assess early treatment. An accurate, rapid, and fully automatic blood vessel segmentation and clinical features measurement algorithm for retinal fundus images is proposed to improve the diagnosis precision and decrease the workload of the ophthalmologists. The main pipeline of the proposed algorithm is composed of two essential stages: image segmentation and clinical features extraction stage. Several comprehensive experiments were carried out to assess the performance of the developed fully automated segmentation algorithm in detecting the retinal blood vessels using two extremely challenging fundus images datasets, named the DRIVE and HRF. Initially, the accuracy of the proposed algorithm was evaluated in terms of adequately detecting the retinal blood vessels. In these experiments, ﬁve quantitative performances were measured and calculated to validate the efﬁciency of the proposed algorithm, which consist of the Acc., Sen., Spe., PPV, and NPV measures compared with current state-of-the-art vessel segmentation approaches on the DRIVE dataset. The results obtained showed a signiﬁcantly improvement by achieving an Acc., Sen., Spe., PPV, and NPV of 99.55%, 99.93%, 99.09%, 93.45%, and 98.89, respectively.


Introduction
Retinal fundus pictures are commonly used to diagnose many eye-related illnesses that lead to blindness, such as macular degeneration and diabetic retinopathy [1]. A direct ophthalmoscope, or the manual inspection of the fundus by a professional, is being replaced by a computer-assisted diagnosis of retinal fundus images. Furthermore, the computerassisted diagnosis of retinal fundus images is as accurate as a direct ophthalmoscope and requires less processing and analysis time. The extraction of retinal blood vessels from fundus pictures is one of the essential processes in detecting diabetic retinopathy. Even though numerous segmentation approaches have been proposed, segmentation of the retinal vascular network and picture quality remains difficult. Noise (typically owing to uneven lighting) and narrow vessels are now the critical obstacles in retinal vascular segmentation.
Although most vessel segmentation methods include pretreatment procedures to improve vessel appearance, other plans skip the pre-processing steps and jump straight to the segmentation stage [2]. Additionally, most of the proposed segmentation algorithms optimise the pre-processing and vessel segmentation parameters for each dataset separately. As a result, these algorithms can typically achieve high accuracy for the optimised dataset, but their accuracy will be lowered when applied to different datasets.
Many segmentation approaches nowadays use machine learning ideas in conjunction with traditional techniques to improve the segmentation accuracy by providing a statistical analysis of the data to enhance segmentation algorithms [3]. Based on the usage of labelled training data, these machine learning principles can be divided into unsupervised and supervised approaches. A supervised technique, a human operator labels and assigns a class to each pixel in the image, such as vessel and non-vessel. A classifier is trained using the tags supplied to the input. A sequence of feature vectors is formed from the data being processed (pixel-wise features in image segmentation problems). In an unsupervised technique, similar samples are grouped into various classes using predetermined feature vectors without any class labels. This clustering is based on several assumptions about the input data structure, namely, that there are two classes of input data with identical feature vectors (vessel and not vessel). Depending on the situation, this similarity metric might be sophisticated or specified by a simple metric, such as pixel intensities [4].
The detection of the vascular tree in fundus images with precision and accuracy can provide several essential aspects for diagnosing various retinal disorders. However, when utilised as a pre-processing step for higher-level picture analysis, retinal blood vessel segmentation might significantly impact other applications. For instance, reliable blood vessel tree detection can be employed in registering time series fundus images, finding the optic disc or over, recognising the retinal nerve fibre layer, and biometric identification. There is substantial work on this topic due to the wide range of applications and the fact that segmentation of retinal vessels is one of the most challenging jobs in retinal image processing [5].
An accurate, rapid, and fully automatic blood vessel segmentation and clinical features measurement algorithm for retinal fundus images is proposed to improve the diagnosis precision and decrease the workload of the ophthalmologists. The main pipeline of the proposed algorithm is composed of two essential stages: image segmentation and clinical features extraction stage. In the segmentation stage, a fully automated segmentation algorithm is proposed and named a trainable filtering algorithm to detect the blood vessels in the retinal images accurately. An efficient and reliable image pre-processing procedure in the trainable filtering algorithm is applied to increase the contrast level. To improve or enhance the intensity level of the small objects in the retinal blood vessel structure, contrast limited adaptive histogram equalisation (CLAHE) and improved complex wavelet transform (I-CWT), respectively, are used by removing all the undesired objects (e.g., small vessel segments) in the enhanced image by applying the Vessels Detection Stage. Finally, the retinal blood vessels are detected using an efficient edge detection algorithm based on an improved Canny edge detector. Finally, the output segmented images produced from the proposed algorithm are fused to produce the final segmented image. In the post-processing step, a novel blood vessel linking procedure is proposed to correctly join the discontinuous blood vessels produced in the segmented image resulting from the previous step. Several useful clinical features are computed, such as the blood vessel's tortuosity, length, density, and thickness, which are efficiently used in the early diagnosis of several cardiovascular and ophthalmologic diseases. An efficient and accurate algorithm for computing the blood vessel thickness is proposed in this stage. The main contributions list can be summarised as follows:

•
An accurate, rapid, and fully automatic blood vessel segmentation and clinical features measurement algorithm for retinal fundus images is proposed to improve the diagnosis precision and decrease the workload of the ophthalmologists.

•
The fully automated segmentation algorithm is proposed and named a trainable filtering algorithm to accurately detect the delicate blood vessels in the retinal images. • A novel blood vessel linking procedure is proposed to correctly join the discontinuous blood vessels produced in the segmented image resulting from the previous step.
The rest of this study is organised as follows: Section 2 presents related works on a fully automatic blood vessel segmentation and clinical features measurement algorithm for retinal fundus images. The main steps of the proposed trainable filtering algorithm, composed of two main stages, including the image pre-processing stage and the vessels detection stage, are presented in Section 3. Section 4 provides several extensive experiments to evaluate the performance and accuracy of the developed hybrid and fully automated segmentation algorithm for detecting the retinal blood vessels using two extremely challenging fundus images datasets. Finally, the conclusion and future work are discussed in Section 5.

Related Works
Automated techniques for medical image analysis have become essential due to the large volume of patient information that needs to be processed. Manual analysis can be reduced or avoided by achieving high accuracy from the retinal blood vessels tree auto segmentation. According to Maitreya et al. [6], they used trainable semantic segmentation by utilizing a hybrid method to solve the resolution issue by implementing an artificial neural network and Capsule Network to achieve up to 99.01% and 98.7%, respectively. The approach proposed by [7] works on breast cancer boundary and pectoral muscle in mammogram images through implementing several algorithms, such as the improved threshold-based and trainable via use mammographic image analysis society and breast cancer digital repository. The proposed study achieved 98.6% accuracy even though the authors highlight that mammogram segmentation is still an open research problem and has to be improved. Reference [8] utilized the fully-convolutional networks U-Nets to improve the segmentation and detection in the medical images by using two different datasets, which are ECU and HGR, and their average output results were 92.3% and 94%, respectively. The researcher focused on enhancing the idea of the contextual pixel analysis through utilizing the lower numbers of trainable parameters and thus gives the space open to future work to increase the numbers. According to [9], they are working on a conventional neural network method for the segmentation of retinal images via the used dataset of 50 colour images that produced 0.95 average accuracies. Failing to observe the progress of some dangerous disease leads to the development of a particular abnormality in the retinal vessels that might damage the retina. Soaibuzzaman et al. [10] worked on an image segmentation based on convolutional neural networks and trainable methods. The most common datasets-PASCAL VOC 2012 and Citypass-are used to perform the proposed algorithms.
Ali Hatamizadeh et al. [11] presented trainable deep active contours (TDACs) to implement in the image segmentation framework to solve the accuracy issue using the vaihingen and bing huts datasets. In addition, a modern hybrid method was proposed; but, we noticed some points that could limit the applicability, such as dependence on pre-trained convolutional neural networks. Moreover, they leave the area open for further enhancement on the accuracy of CNN-based image segmentation. They might stop at one point and open the space to future work enhancement. Eventually, the studies present in this section mostly all focused on enhancing the accuracy of the segmented retinal images. Therefore, this paper highlights the trainable filter algorithm adapted with very powerful and common datasets, DRIVE and HRF, to achieve the highest accuracy results of up to 99.12% and 98.78%, respectively.

The Proposed Automatic Blood Vessels Segmentation and Clinical Features Measurement Algorithm
A fully automated algorithm is presented for detecting the retinal blood vessels in the highly challenging fundus images. A quantitative investigation of retinal images is widely used to diagnose, screen, and treat disease. Among these diseases mentioned, diabetic retinopathy and macular degeneration are the two main reasons for vision loss. Blood vessel segmentation is an essential step required for the quantitative investigation of retinal images. A set of critically beneficial clinical features, such as the blood vessel's tortuosity, length, density, and thickness, can be extracted from the segmented vascular tree.
Furthermore, the segmented vascular tree has also been used in several medical applications, including the retinal image mosaic structure, temporary or multi-modal image registration, optic disc identification, biometric identification, and fovea localization. Accordingly, an automatic algorithm for segmenting and extracting useful clinical features from the retinal blood vessels is proposed to help ophthalmologists and eye specialists diagnose different retinal diseases and treatment assessments early. Figure 1 shows the projected blood vessel segmentation and clinical features measurement algorithm.

The Trainable Filtering Algorithm
As presented in Figure 2, the proposed trainable filters algorithm consists of two main stages: image pre-processing and vessels detection stage. In the image pre-processing stage, an efficient and reliable image enhancement procedure was proposed for reducing the noise and enhancing the quality of the retinal fundus image to make the blood vessel structures more visible. In the vessel detection stage, the fusing of the responses of two trainable and rotation-invariant filters, namely, symmetric and asymmetric filters, is firstly obtained. Then, the final segmented image is produced by applying a thresholding algorithm to the fused image. The main stages of the proposed trainable filtering algorithm are explained in detail in the next sub-sections.

The Trainable Filtering Algorithm
As presented in Figure 2, the proposed trainable filters algorithm consists of two main stages: image pre-processing and vessels detection stage. In the image pre-processing stage, an efficient and reliable image enhancement procedure was proposed for reducing the noise and enhancing the quality of the retinal fundus image to make the blood vessel structures more visible. In the vessel detection stage, the fusing of the responses of two trainable and rotation-invariant filters, namely, symmetric and asymmetric filters, is firstly obtained. Then, the final segmented image is produced by applying a thresholding algorithm to the fused image. The main stages of the proposed trainable filtering algorithm are explained in detail in the next sub-sections.

Image Pre-Processing Stage
The main steps of the proposed image enhancement procedure in the proposed trainable filters algorithm can be summarized as follows: 1.
The contrast of the resulting image was enhanced using the CLAHE method.

2.
An efficient image denoising procedure was proposed based on an improved Dual-Tree Complex Wavelet Transforms (DT-CWT) approach to decompose the input image and shrinkage process to eliminate the noise in the input image.

3.
We are applying the moving average filter to enhance the edges of the blood vessels in the retinal fundus image.

Image Pre-Processing Stage
The main steps of the proposed image enhancement procedure in the proposed trainable filters algorithm can be summarized as follows: 1. The contrast of the resulting image was enhanced using the CLAHE method.
2. An efficient image denoising procedure was proposed based on an improved Dual-Tree Complex Wavelet Transforms (DT-CWT) approach to decompose the input image and shrinkage process to eliminate the noise in the input image. 3. We are applying the moving average filter to enhance the edges of the blood vessels in the retinal fundus image.
The adaptive histogram equalization (AHE) is frequently employed for image contrast enhancement by expanding the dynamic range of the image intensity so that its histogram distribution has the wanted shape [12]. The AHE is different from the conventional histogram equalization, where the adaptive histogram is computed from a specific region in the input image. Then they are used to redistribute the brightness of the image. Thus, it can efficiently improve the local contrast for each part of an image [13]. However, the AHE method has a bias to expand the noise in approximately homogeneous areas of an image. A variant of AHE, named contrast limited adaptive histogram equalization (CLAHE), was developed to overcome this issue by limiting the amplification [14]. The CLAHE is a block-based processing method that improves the local contrast in small regions, called tiles instead of the entire image. Then, the adjoining tiles are fused using bilinear interpolation to reduce the artificially produced boundaries. The local contrast enhancement in the homogeneous areas can be restricted to avoid the over-enhancement of noise and lessens the edge-shadowing effects in the enhanced image.
CLAHE controls the quality of the enhanced image by two essential parameters: the Clip Limit (CL) and Block Size (BS). A high value based on the CL parameter leads to an increase in the brightness of the input image due to the low-intensity level of the input image. On the other hand, a higher value of the BS parameter expands the image intensity's dynamic range and increases its contrast level. A novel method was proposed by The adaptive histogram equalization (AHE) is frequently employed for image contrast enhancement by expanding the dynamic range of the image intensity so that its histogram distribution has the wanted shape [12]. The AHE is different from the conventional histogram equalization, where the adaptive histogram is computed from a specific region in the input image. Then they are used to redistribute the brightness of the image. Thus, it can efficiently improve the local contrast for each part of an image [13]. However, the AHE method has a bias to expand the noise in approximately homogeneous areas of an image. A variant of AHE, named contrast limited adaptive histogram equalization (CLAHE), was developed to overcome this issue by limiting the amplification [14]. The CLAHE is a block-based processing method that improves the local contrast in small regions, called tiles instead of the entire image. Then, the adjoining tiles are fused using bilinear interpolation to reduce the artificially produced boundaries. The local contrast enhancement in the homogeneous areas can be restricted to avoid the over-enhancement of noise and lessens the edge-shadowing effects in the enhanced image.
CLAHE controls the quality of the enhanced image by two essential parameters: the Clip Limit (CL) and Block Size (BS). A high value based on the CL parameter leads to an increase in the brightness of the input image due to the low-intensity level of the input image. On the other hand, a higher value of the BS parameter expands the image intensity's dynamic range and increases its contrast level. A novel method was proposed by Min et al. [15] to determine the optimal value of these two parameters. The pseudo-code of the CLAHE method is shown in Algorithm 1. The contrast of the blood vessels was considered as one of the primary characteristics of the coloured retinal image. Image contrast combines the range of pixels' intensity values and the difference between the highest and smallest pixel values. The primary purpose of the proposed image enhancement procedure using the CLAHE method is to produce a uniform intensity distribution. The image with poor contrast has a small intensity range. Thus, the CLAHE method spreads and adjusts the intensity distribution of the image to improve its contrast.
First, the coloured retinal image was split into three channels (e.g., red, green, and blue). The entire coloured retinal image was used in this stage rather than the green channel as in the proposed trainable filtering algorithm. Second, the CLAHE method was applied only to the green channel because it encodes the essential information about the blood vessel structures compared with other channels.
Finally, an improved DT-CWT was employed as a powerful image denoising approach to decrease the noise level and prevent damaging the fine details of the blood vessels (e.g., edges and curves) in the retinal image, as displayed in Figure 3c. Typically, image denoising approaches using wavelet transform suffer from four weaknesses: shift variety, oscillations, aliasing, and shortness of directionality [16]. Herein, an improved DT-CWT based on the shrinkage operation was employed to decrease the noise level and improve the delicate structures of the blood vessels in the retinal image. The wavelet-based shrinkage image denoising method mainly depends on thresholding the wavelet transforms coefficients where the coefficients of the small values encode the noisiest and excellent features of the image. In contrast, the essential features are encoded by the wavelet coefficients having large values. Let Y be a noisy image, X be a noiseless image, and n be the noise level.
Then, the significant steps of the wavelet-based shrinkage image denoising technique are summarized as follows: 1. Applying the wavelet transform ( ) to the input image to estimate the wavelet coefficient matrix ( ), as in Equation (5): We modify the coefficients of ( ) by shrinking (thresholding) operation to get the estimate ( ) matric of the wavelet coefficients of .
3. Applying the inverse wavelet transform to the coefficients matric produced from step 2 to produce the denoised coefficients, as in Equation (7): In this study, a soft threshold function ( = ) was implemented in step 2.

Algorithm 1: The pseudo-code of the CLAHE method
Step 1: Dividing an input image of size (M × N) pixels into non-overlapping tiles of size (8 × 8) pixels.
Step 2: Estimating the histogram of each tile according to the grey-scale levels present in an input image.
Step 3: The contrast limited histogram is computed for each tile by (CL) value as N avg = Nr x × Nr y N gray (1) where N avg refers to the average number of pixels, N gray refers to the number of grey levels in the tile, Nr x and Nr y represent the numbers of pixels in the x and y dimensions of the specific tile. The (CL) parameter can be computed as follows: (2) where N CL refers to the actual (CL), N clip is the normalized (CL) in the range of [0, 1]. If the number of pixels is larger than N CL , then the pixels are clipped and the average value of the remain pixels to spread to each grey-scale level is defined as follows: where N ∑ clip refers to the total number of clipped pixels.
Step 4: Redistributing the remain pixels as follows: The program starts the search from the lowest to the highest of the grey-scale level using the above step value. If the number of pixels is less than N CL the program will spread 1-pixel to the grey-scale. If not all the pixels are distributed when the search is ended, the program will compute a new step according to Equation (4) and start a new search cycle until the other pixels are all distributed.
Step 5: The Rayleigh transform is employed to enhance the intensity values in each tile, as de-scribed in [17].
Step 6: Computing a new grey-scale level distribution of pixels within a tile using a bi-linear interpolation among four different mappings to eliminate boundary artefacts.
Then, the significant steps of the wavelet-based shrinkage image denoising technique are summarized as follows: 1.
Applying the wavelet transform (W) to the input image to estimate the wavelet coefficient matrix (w), as in Equation (5):

2.
We modify the coefficients of (w) by shrinking (thresholding) operation to get the estimate (ŵ) matric of the wavelet coefficients of X. 3.
Applying the inverse wavelet transform to the coefficients matric produced from step 2 to produce the denoised coefficients, as in Equation (7): In this study, a soft threshold function (Th = 10) was implemented in step 2.

Vessel Detection Stage
In this stage, the retinal blood vessels were detected by fusing the responses of two Shifted Filter Responses (SRF), termed the symmetric and asymmetric filter for detecting the main blood vessels structures and the endings of the vessels, respectively (see Figure 4). These two filters were rotated in 12 orientations to include all the possible directions of the retinal blood vessels. Consequently, it creates a filter bank of a 15 • rotation of the filter, which is reliable and suitable for optimal retinal blood vessels detection. Then, the final segmented image was obtained by fusing the responses of these two filters and then thresholding the fused image. The proposed SRF filters are non-linear due to their ability orientation selectivity based on the output representations produced from a set of Difference of Gaussians (DoG) filters. The SRF filters are invariant to rotation, scale, translation, and reflection transformations. The selectivity of these two trainable filters is not pre-defined in the implementation process. However, it is defined from operator-specified sample patterns (e.g., vertical vessels and bifurcation points) in an automated manner. mented image from the edge detection stage after applying thresholding; (h) the overlapped automated segmented image with the original retinal image.

Vessel Detection Stage
In this stage, the retinal blood vessels were detected by fusing the responses of two Shifted Filter Responses (SRF), termed the symmetric and asymmetric filter for detecting the main blood vessels structures and the endings of the vessels, respectively (see Figure  4). These two filters were rotated in 12 orientations to include all the possible directions of the retinal blood vessels. Consequently, it creates a filter bank of a 15° rotation of the filter, which is reliable and suitable for optimal retinal blood vessels detection. Then, the final segmented image was obtained by fusing the responses of these two filters and then thresholding the fused image. The proposed SRF filters are non-linear due to their ability orientation selectivity based on the output representations produced from a set of Difference of Gaussians (DoG) filters. The SRF filters are invariant to rotation, scale, translation, and reflection transformations. The selectivity of these two trainable filters is not pre-defined in the implementation process. However, it is defined from operator-specified sample patterns (e.g., vertical vessels and bifurcation points) in an automated manner.
The SRF filters are unsupervised trainable edges detectors filters that can be configured to automatically detect the symmetric and asymmetric straight-edges structures of the retinal blood vessels. Figure 5 shows how the SRF filters performed the detection process of the patterns by using the DoG filter. The input of SRF can be represented by five blobs produced from the DoG filter and placed at a specific distance from the centre of the filter, as presented in Figure 4a. The result of the SRF filters was calculated as the weighted geometrical mean of the shifted and the blurred responses of the DoG filter.  The main steps of applying the SRF filters can be summarized as follows: 1. Create the DoG filter and convolute it with the retinal image as in Equations (8) and (11): The SRF filters are unsupervised trainable edges detectors filters that can be configured to automatically detect the symmetric and asymmetric straight-edges structures of the retinal blood vessels. Figure 5 shows how the SRF filters performed the detection process of the patterns by using the DoG filter. The input of SRF can be represented by five blobs produced from the DoG filter and placed at a specific distance from the centre of the filter, as presented in Figure 4a. The result of the SRF filters was calculated as the weighted geometrical mean of the shifted and the blurred responses of the DoG filter.
The main steps of applying the SRF filters can be summarized as follows: 1.
Create the DoG filter and convolute it with the retinal image as in Equations (8) and (11): Here, (x, y) refers to the centre of the DoG filter, and σ refers to the SD, and it is 0.5 for the inner Gaussian filter.

2.
Blurring the gained responses of the DoG filter by applying Equation (9). 3.
Shifting the produced blurred DoG responses to the filter centre's direction with a shift-vector as in Equation (10).
where |.| + refers to the Rectifying Linear Unit (ReLU). For a given I(x , y ) intensity distribution of an input image I, the response C σ (x, y) of the DoG filter is . If the output of the convolution process is negative, then it is replaced with 0 as in Equation (11). The shifted and blurred DoG responses at the location (x, y) can be defined by Equation (12).

4.
Generating the responses of the SRF filters by calculating the geometric mean, as in Equation (13). (13), the DoG responses of the SRF filters for each retinal image were thresholded by using a specific parameter (t) value to classify the image's pixels into two classes: blood vessels or non-blood vessels.

Post-Processing Step
Once the segmented retinal image is obtained from the trainable filter, the output is used to produce the final segmented image. Then, a novel blood vessel linking procedure was proposed to correctly join the discontinuous blood vessels produced in the segmented image resulting from the previous step. These discontinuous blood vessels are presented in the final segmented image due to the poor visibility of the specific blood vessels or the noise presented in the retinal image. The accuracy of the extract clinical features, such as the tortuosity, length, density, and thickness of blood vessels, can significantly be affected by the appearance of the discontinuous blood vessels. Thus, a new procedure was proposed in this study to correctly connect the discontinuous blood vessels in the final segmented image. The proposed blood vessel linking procedure was implemented as follows: • Produce the skeleton blood vessels structure of the final retinal segmented image and identify the vessels' end-points. • Defining a possible highest distance between the endings of each two segments of a disconnected blood vessel. Then a circular-shaped structure element of radius = (highest distance)/2 was placed at the end of each blood vessel. If the ends of the two blood vessels approached each other, the placed structural elements were overlapped, as displayed in Figure 6c. • Finally, the thinning process was applied to the whole image. Hence, a line of one pixel wide will be left by the thinned structural elements to link the two endings of the vessel, while the separated ends are recovered to their initial structure, as displayed in Figure 6d.

Clinical Features Extraction Stage
This method was designed for diagnosing retinopathies diseases, for use by ophthalmologists and eye specialists, which can help shape the retinal lesions' thickness, length, or presentation. All this is connected with cardiovascular and retinopathies diseases. The quantitative analysis of abnormalities in blood vessel structures can be found in vessel tortuosity. It can describe their severity level and treatment assessments. One of the main aims of this work is to develop an automated algorithm description procedure to analyse the whole blood vessels network in the retinal image. The clinical features extraction stage computes a set of useful clinical features from the automatically detected retinal blood vessels accurately and objectively. In this stage, several clinical features associated with the healthiness of the retinal blood vessels are extracted as follows: The length of the retinal blood vessel was computed for each vessel's segment by firstly taking the vessel's skeleton structure, and then the distance between sequential pixels in the blood vessel segment is summed as in Equation (14).

Clinical Features Extraction Stage
This method was designed for diagnosing retinopathies diseases, for use by ophthalmologists and eye specialists, which can help shape the retinal lesions' thickness, length, or presentation. All this is connected with cardiovascular and retinopathies diseases. The quantitative analysis of abnormalities in blood vessel structures can be found in vessel tortuosity. It can describe their severity level and treatment assessments. One of the main aims of this work is to develop an automated algorithm description procedure to analyse the whole blood vessels network in the retinal image. The clinical features extraction stage computes a set of useful clinical features from the automatically detected retinal blood vessels accurately and objectively. In this stage, several clinical features associated with the healthiness of the retinal blood vessels are extracted as follows:

Vessel Length
The length of the retinal blood vessel was computed for each vessel's segment by firstly taking the vessel's skeleton structure, and then the distance between sequential pixels in the blood vessel segment is summed as in Equation (14). (14) Here, N refers to the number of sequential pixels produced from the blood vessel skeleton segment, and (x i , y i ) refers to the pixels coordinates in the blood vessel segment.

Vessel Density
The retinal blood vessels density was calculated by dividing the sum of all the pixels of the blood vessels by the overall area of the whole retinal image as in Equation (15):

Vessel Tortuosity
The tortuosity coefficient of the blood vessel is interpreted as a degree of curvature and twists presented in the blood vessel course, as shown in Figure 7. Some studies have proved that the vessel tortuosity coefficient can be associated with the average internal blood pressure; however, no significant increase was observed until the critical blood pressure level is reached [17,18]. Herein, the mean tortuosity coefficient of the whole retinal blood vessels network was computed. First, the skeleton structure of the blood vessels was produced. This was followed by defining the branch points of the blood vessels to divide the length of the Blood Vessel Segment (BVS) into (b) branches, as in Equation (16):

Vessel Tortuosity
The tortuosity coefficient of the blood vessel is interpreted as a degree of curvature and twists presented in the blood vessel course, as shown in Figure 7. Some studies have proved that the vessel tortuosity coefficient can be associated with the average internal blood pressure; however, no significant increase was observed until the critical blood pressure level is reached [17,18]. Herein, the mean tortuosity coefficient of the whole retinal blood vessels network was computed. First, the skeleton structure of the blood vessels was produced. This was followed by defining the branch points of the blood vessels to divide the length of the Blood Vessel Segment (BVS) into (b) branches, as in Equation (16): Then, the tortuosity coefficient index for the (BVS) was then computed as follows: where refers to the length of vessel branch, and it was estimated by Equation (17). is the straightforward distance between the endings point and was estimated as follows: Here, N refers to the number of fundamental pixels captured from the branch of the blood vessels, while (x,y) refers to the pixels coordinates in each branch of the blood vessels. Finally, the mean tortuosity coefficient of the entire blood vessels network was acquired by calculating the mean tortuosity values obtained of each blood vessel.  Then, the tortuosity coefficient index for the (BVS) was then computed as follows: where s length refers to the length of vessel branch, and it was estimated by Equation (17). s straight is the straightforward distance between the endings point and was estimated as follows: Here, N refers to the number of fundamental pixels captured from the branch of the blood vessels, while (x,y) refers to the pixels coordinates in each branch of the blood vessels. Finally, the mean tortuosity coefficient of the entire blood vessels network was acquired by calculating the mean tortuosity values obtained of each blood vessel.

Vessel Thickness
The blood vessel thickness is the average width of the retinal blood vessels. In this paper, a new procedure for computing the retinal blood vessels thickness is developed. Figure 8 shows the output of the developed thickness procedure. The primary steps of the developed procedure after identifying each blood vessel were implemented as follows:

1.
Distance transform was computed from the binary image of the detected retinal blood vessels, where all background pixels in the transformed image become white, while the object pixels become black. This transform calculates the Euclidean distance for each black pixel in the segmented image to the nearest non-zero pixel. In the developed procedure, the distance transform was implemented on the inverse of the binary image of the detected retinal blood vessels. Thus, for each pixel of the detected blood vessel, the Euclidean distance of that specific pixel to the nearest border pixel of the blood vessel was calculated.

2.
After applying the distance transform, the blood vessel pixels that have the most significant distance values in the distance transform will be located at the middle of the blood vessel segment. The distance values representing the halfway edge between the blood vessel segment were obtained with some leniency of the most significant distance values because of the floating-point computation.

3.
Finally, the overall average of all accumulated distance values defines the half-width of the blood vessel. Consequently, the blood vessel thickness (width) was measured by multiplying the outcome reached by two.

Vessel Thickness
The blood vessel thickness is the average width of the retinal blood vessels. In this paper, a new procedure for computing the retinal blood vessels thickness is developed. Figure 8 shows the output of the developed thickness procedure. The primary steps of the developed procedure after identifying each blood vessel were implemented as follows: 1. Distance transform was computed from the binary image of the detected retinal blood vessels, where all background pixels in the transformed image become white, while the object pixels become black. This transform calculates the Euclidean distance for each black pixel in the segmented image to the nearest non-zero pixel. In the developed procedure, the distance transform was implemented on the inverse of the binary image of the detected retinal blood vessels. Thus, for each pixel of the detected blood vessel, the Euclidean distance of that specific pixel to the nearest border pixel of the blood vessel was calculated.
2. After applying the distance transform, the blood vessel pixels that have the most significant distance values in the distance transform will be located at the middle of the blood vessel segment. The distance values representing the halfway edge between the blood vessel segment were obtained with some leniency of the most significant distance values because of the floating-point computation. 3. Finally, the overall average of all accumulated distance values defines the half-width of the blood vessel. Consequently, the blood vessel thickness (width) was measured by multiplying the outcome reached by two.

Experimental Results and Discussion
To evaluate the performance and accuracy of the developed hybrid and fully automated segmentation algorithm, for detecting the retinal blood vessels, we used two extremely challenging fundus images datasets, namely, DRIVE [20] and High-Resolution Fundus (HRF) [21]. In this study, several extensive experiments were conducted. Firstly,

Experimental Results and Discussion
To evaluate the performance and accuracy of the developed hybrid and fully automated segmentation algorithm, for detecting the retinal blood vessels, we used two extremely challenging fundus images datasets, namely, DRIVE [20] and High-Resolution Fundus (HRF) [21]. In this study, several extensive experiments were conducted. Firstly, the main description of the employed retinal images datasets in these experiments is given. Secondly, a detailed evaluation of the fully automated segmentation algorithm (a trainable filtering algorithm) is presented along with their combination and compared their performance against the Ground Truth (GT) images. Finally, the performance of the developed algorithms is compared with the state-of-the-art approaches.

Dataset Description
The performance of the proposed blood vessel segmentation algorithms has been tested using two established, publicly available datasets of retinal fundus images (DRIVE and HRF). These two datasets have gained particular popularity because they provide the associated GT images in which different expert observers manually detect the blood vessel. Thus, they enable the possibility of comparing the results obtained against the provided GT images to validate the reliability and efficiency of the proposed algorithms. The main aim of these two datasets is to establish and encourage comparative studies on developing automated segmentation algorithms for retinal blood vessels in the fundus images.
1. DRIVE dataset [20]: This dataset comprises 40 coloured retinal images split into a training set and a testing set, each of which comprises 20 images. The mask image representing the Field-Of-View (FOV) of the retina area is provided for each image and the corresponding GT image. One expert manually segmented the blood vessels in the retinal images of the training set. In this work, the training set was used to fine-tune the parameters of the proposed segmentation algorithms. On the other hand, two other experts manually segmented the blood vessels in the testing set images. The actual performance of the proposed vessel segmentation algorithms was assessed using the testing set. The DRIVE database contains retinal images captured from 400 diabetic subjects between 25-90 years old in the Netherlands. Around 40 images were randomly chosen: 33 images without any sign of diabetic retinopathy, and seven images showed mild early diabetic retinopathy. The retinal images were captured using a Canon CR5 non-mydriatic 3CCD camera with a 45 • FOV. All the images were saved in TIF format with an 8-bits coloured image and size of 768 × 584 pixels. An example of retinal fundus images from the DRIVE dataset with corresponding manually gold standard images is shown in Figure 9. and HRF). These two datasets have gained particular popularity because they provide the associated GT images in which different expert observers manually detect the blood vessel. Thus, they enable the possibility of comparing the results obtained against the provided GT images to validate the reliability and efficiency of the proposed algorithms. The main aim of these two datasets is to establish and encourage comparative studies on developing automated segmentation algorithms for retinal blood vessels in the fundus images. [20]: This dataset comprises 40 coloured retinal images split into a training set and a testing set, each of which comprises 20 images. The mask image representing the Field-Of-View (FOV) of the retina area is provided for each image and the corresponding GT image. One expert manually segmented the blood vessels in the retinal images of the training set. In this work, the training set was used to fine-tune the parameters of the proposed segmentation algorithms. On the other hand, two other experts manually segmented the blood vessels in the testing set images. The actual performance of the proposed vessel segmentation algorithms was assessed using the testing set. The DRIVE database contains retinal images captured from 400 diabetic subjects between 25-90 years old in the Netherlands. Around 40 images were randomly chosen: 33 images without any sign of diabetic retinopathy, and seven images showed mild early diabetic retinopathy. The retinal images were captured using a Canon CR5 non-mydriatic 3CCD camera with a 45° FOV. All the images were saved in TIF format with an 8-bits coloured image and size of 768 × 584 pixels. An example of retinal fundus images from the DRIVE dataset with corresponding manually gold standard images is shown in Figure 9.

DRIVE dataset
2. HRF dataset [21]: The HRF dataset comprises 45 images captured from three different groups (e.g., healthy subjects, diabetic retinopathy patients, and glaucomatous patients). Each group has 15 images acquired using a mydriatic fundus CANON CF-60UVi camera with a 60° FOV. All the images were saved in JPEG format with a 24-bits coloured image and size of 3504 × 2336 pixels and a pixel size of 6.05 × 6.46 μm. The binary FOVmask images of the dataset are provided to perform the analysis only in the region surrounded by the dark background (see Figure 10b). In this dataset, the tree of blood vessels was manually traced by three experts in retinal image interpretation. An example of retinal fundus images from the HRF dataset with corresponding manually gold standard images is shown in Figure 10.   [21]: The HRF dataset comprises 45 images captured from three different groups (e.g., healthy subjects, diabetic retinopathy patients, and glaucomatous patients). Each group has 15 images acquired using a mydriatic fundus CANON CF-60UVi camera with a 60 • FOV. All the images were saved in JPEG format with a 24-bits coloured image and size of 3504 × 2336 pixels and a pixel size of 6.05 × 6.46 µm. The binary FOV-mask images of the dataset are provided to perform the analysis only in the region surrounded by the dark background (see Figure 10b). In this dataset, the tree of blood vessels was manually traced by three experts in retinal image interpretation. An example of retinal fundus images from the HRF dataset with corresponding manually gold standard images is shown in Figure 10.

Blood Vessel Segmentation Evaluation
In the binary classification task, each pixel in the input image is classified as a vessel by the proposed algorithm. It is also classified as a vessel in the GT image, counted as a true positive. On the other hand, each pixel is classified as a vessel in the final segmented image, but not in the GT image, counted as a false positive (see Table 1). In the evaluation of the retinal vessel segmentation, the average values of five quantitative performance measures were calculated to validate the efficiency of the proposed algorithms, including the Accuracy (Acc.), Sensitivity (Sen.), Specificity (Spe.), Positive Predictive Value (PPV), and Negative Predictive Value (NPV). These five quantitative measures are computed as follows: Here, TP, TN, FP, and FN refer to True Positives, True Negatives, False Positives, and False Negatives, respectively. The Acc. measurement refers to the total number of correctly classified pixels to the number of pixels in the FOV-mask image. Sensitivity (Sen.) refers to the ability of the proposed algorithm to detect the vessel pixels correctly. Specificity (Spe.) is the ability of the proposed algorithm to detect non-vessel pixels correctly. The PPV or Precision rate refers to the ratio of pixels correctly identified as vessel pixels. Finally, the NPV is the ratio of pixels correctly identified as non-vessel pixels (e.g., background).

Blood Vessel Segmentation Evaluation
In the binary classification task, each pixel in the input image is classified as a vessel by the proposed algorithm. It is also classified as a vessel in the GT image, counted as a true positive. On the other hand, each pixel is classified as a vessel in the final segmented image, but not in the GT image, counted as a false positive (see Table 1  Here, TP, TN, FP, and FN refer to True Positives, True Negatives, False Positives, and False Negatives, respectively. The Acc. measurement refers to the total number of correctly classified pixels to the number of pixels in the FOV-mask image. Sensitivity (Sen.) refers to the ability of the proposed algorithm to detect the vessel pixels correctly. Specificity (Spe.) is the ability of the proposed algorithm to detect non-vessel pixels correctly. The PPV or Precision rate refers to the ratio of pixels correctly identified as vessel pixels. Finally, the NPV is the ratio of pixels correctly identified as non-vessel pixels (e.g., background).

Results on DRIVE Dataset
Firstly, the performance of the proposed algorithm for detecting the retinal blood vessels was evaluated on the DRIVE dataset. Training set images were used, and several extensive experiments were carried out to choose the best value for a set of parameters in such a way as to maximize the segmentation accuracy of the proposed algorithms. For instance, the value of the parameter (t) (in Equation (13) using the proposed trainable filters algorithm was chosen by varying its value between 0 and 1 in steps of 0.01. This threshold process assigns each pixel into two labels: Vessels and Non-Vessels. Then, the segmentation accuracy was computed to select the best value of the parameter (t). As shown in Figure 11, the best value of parameter (t) was set to 0.5. Hence, 100 experiments were carried out where we increased the value of the parameter (t) by 0.1. In the evaluation stage, five performance evaluation metrics were computed using the testing images, and the two provided human observers as the GT images. instance, the value of the parameter (t) (in Equation (13) using the proposed trainable filters algorithm was chosen by varying its value between 0 and 1 in steps of 0.01. This threshold process assigns each pixel into two labels: Vessels and Non-Vessels. Then, the segmentation accuracy was computed to select the best value of the parameter (t). As shown in Figure 11, the best value of parameter (t) was set to 0.5. Hence, 100 experiments were carried out where we increased the value of the parameter (t) by 0.1. In the evaluation stage, five performance evaluation metrics were computed using the testing images, and the two provided human observers as the GT images. Figure 11. The segmentation accuracy obtained during 100 experiments to find the best value of the parameter (t) in the using the proposed trainable filters algorithm. Table 2 shows the results generated using the proposed trainable filters algorithm. This table shows that better results have been achieved using the second human observer than the first human observer in terms of all the adopted five evaluation metrics. It achieved an Acc. of 99.12%, Sen. of 98.89%, Spe. of 98.86%, PPV of 93.28%, and NPV of 97.77%. Furthermore, the performance of the proposed trainable filters algorithm has outperformed the performance of the proposed algorithm by achieving an overall average Acc. of 98.785%, Sen. of 98.455%, Spe. of 98.375%, PPV of 92.125%, and NPV of 95.93%. Then, the proposed blood vessel linking procedure was applied to correctly join the discontinuous blood vessels produced in the segmented retinal image resulting from the previous step. In this work, to validate the advantage of applying the proposed blood vessel linking procedure, the adopted five evaluation metrics were computed with and without applying the proposed blood vessel linking procedure. An example of the output segmentation results on the DRIVE dataset is shown in Figure 12.  Figure 11. The segmentation accuracy obtained during 100 experiments to find the best value of the parameter (t) in the using the proposed trainable filters algorithm. Table 2 shows the results generated using the proposed trainable filters algorithm. This table shows that better results have been achieved using the second human observer than the first human observer in terms of all the adopted five evaluation metrics. It achieved an Acc. of 99.12%, Sen. of 98.89%, Spe. of 98.86%, PPV of 93.28%, and NPV of 97.77%. Furthermore, the performance of the proposed trainable filters algorithm has outperformed the performance of the proposed algorithm by achieving an overall average Acc. of 98.785%, Sen. of 98.455%, Spe. of 98.375%, PPV of 92.125%, and NPV of 95.93%. Then, the proposed blood vessel linking procedure was applied to correctly join the discontinuous blood vessels produced in the segmented retinal image resulting from the previous step. In this work, to validate the advantage of applying the proposed blood vessel linking procedure, the adopted five evaluation metrics were computed with and without applying the proposed blood vessel linking procedure. An example of the output segmentation results on the DRIVE dataset is shown in Figure 12.  In this work, the performance of the proposed algorithms was compared with current state-of-the-art vessel segmentation approaches on the DRIVE dataset images. The results obtained from the second human observer have been considered for comparison purposes. It was noted that most previously published approaches in the literature report the values of accuracy, sensitivity, and specificity. Thus, the overall average of these three metrics and the PPV and NPV values have been computed with GT images (2nd human observer) and listed in Table 3. Although, Li et al. [22], Jin et al. [23], Hassan et al. [24], Dasgupta and Singh [25], Li et al. [26], Tamim et al. [27], Yang et al. [28], and Yang et al. [29] have achieved a higher Spe. and NPV value compared with the proposed trainable filters algorithm in terms of all the adopted five evaluation metrics, better results were obtained using the proposed algorithm mentioned earlier, except for Yang et al. [28], which achieved slightly a higher NPV value. In this work, the performance of the proposed algorithms was compared with current state-of-the-art vessel segmentation approaches on the DRIVE dataset images. The results obtained from the second human observer have been considered for comparison purposes. It was noted that most previously published approaches in the literature report the values of accuracy, sensitivity, and specificity. Thus, the overall average of these three metrics and the PPV and NPV values have been computed with GT images (2nd human observer) and listed in Table 3. Although, Li et al. [22], Jin et al. [23], Hassan et al. [24], Dasgupta and Singh [25], Li et al. [26], Tamim et al. [27], Yang et al. [28], and Yang et al. [29] have achieved a higher Spe. and NPV value compared with the proposed trainable filters algorithm in terms of all the adopted five evaluation metrics, better results were obtained using the proposed algorithm mentioned earlier, except for Yang et al. [28], which achieved slightly a higher NPV value.

Results on HRF Dataset
In this section, the performance of the proposed vessels segmentation algorithm has been assessed using the HRF dataset using the same parameter configuration described in Section 4.2. The adopted five evaluation metrics were initially calculated for the proposed vessels segmentation algorithms using the GT images provided in the HRF dataset, as shown in Table 4. A comparable performance was achieved by the proposed trainable filtering, with a PPV of 95.89% and NPV of 98.97%. On the other hand, a better Acc. of 98.78%, Sen. of 99.12%, and Spe. of 99.34% was obtained using the proposed algorithm. An example of the output segmentation results on the HRF dataset is shown in Figure 13. The performance of the proposed blood vessel segmentation algorithms has also been compared with the state-of-the-art approaches on the HRF dataset, as given in Table 5. It was observed that some existing approaches have achieved a slightly higher segmentation accuracy compared with the proposed algorithms. For instance, Kishorea and Ananthamoorthy [34] have reached an Acc. of 99.6% compared to an Acc. of 98.76% and 98.78% using the proposed trainable filters algorithm. However, the work presented in [34] has obtained inferior results in another evaluation metric (e.g., Sen., Spe., PPV, and NPV) compared with the proposed algorithm. On the other hand, Chalakkal et al. [37] has achieved a slightly better Spe. value of 100% compared with Spe. values of 99.17%, 99.35%, and 99.78%, using the trainable filters. However, they got inferior results on the other evaluation metric (e.g., Acc. and Sen.). Finally, one can see the best Sen. values of 98.87%, 99.12%, and 99.89% were obtained using the trainable filtering algorithm, compared with the state-of-the-art approaches on the HRF dataset. The performance of the proposed blood vessel segmentation algorithms has also been compared with the state-of-the-art approaches on the HRF dataset, as given in Table  5. It was observed that some existing approaches have achieved a slightly higher segmentation accuracy compared with the proposed algorithms. For instance, Kishorea and Ananthamoorthy [34] have reached an Acc. of 99.6% compared to an Acc. of 98.76% and 98.78 using the proposed trainable filters algorithm. However, the work presented in [34] has obtained inferior results in another evaluation metric (e.g., Sen., Spe., PPV, and NPV) compared with the proposed algorithm. On the other hand, Chalakkal et al. [37] has achieved a slightly better Spe. value of 100% compared with Spe. values of 99.17%, 99.35%, and 99.78%, using the trainable filters. However, they got inferior results on the other evaluation metric (e.g., Acc. and Sen.). Finally, one can see the best Sen. values of 98.87%, 99.12%, and 99.89% were obtained using the trainable filtering algorithm, compared with the state-of-the-art approaches on the HRF dataset. The first human observer of the DRIVE dataset: Pearson correlation plots were also adopted to confirm further the clinical reliability and usefulness of the proposed blood vessels segmentation algorithms as effective tools to provide a precise and automated estimation of the vessel's clinical features. As shown in Figure 13, a Pearson's correlation r and p coefficient of r = 0.81, p < 0.0001, for vessel tortuosity; r = 0.87, p < 0.0001, for vessel thickness; r = 0.76, p < 0.0001, for vessel length; and r = 0.93, p < 0.0001, for vessel density using the proposed trainable filters algorithm (see Figure 14).
The same clinical evaluation was carried out to get the automated estimation of the clinical features from the DRIVE dataset using the 2nd human observer. As shown in Table 6 and Figure 14, a Pearson's correlation r and p coefficient of r = 0.88, p < 0.0001 were achieved for vessel tortuosity; r = 0.87, p < 0.0001, for vessel thickness; r = 0.96, p < 0.0001, for vessel length; and r = 0.94, p < 0.0001, for vessel density using the proposed trainable filters algorithm (see Figure 15). The first human observer of the DRIVE dataset: Pearson correlation plots were also adopted to confirm further the clinical reliability and usefulness of the proposed blood vessels segmentation algorithms as effective tools to provide a precise and automated estimation of the vessel's clinical features. As shown in Figure 13, a Pearson's correlation r and p coefficient of r = 0.81, p < 0.0001, for vessel tortuosity; r = 0.87, p < 0.0001, for vessel thickness; r = 0.76, p < 0.0001, for vessel length; and r = 0.93, p < 0.0001, for vessel density using the proposed trainable filters algorithm (see Figure 14). The same clinical evaluation was carried out to get the automated estimation of the clinical features from the DRIVE dataset using the 2nd human observer. As shown in Table 6 and Figure 14, a Pearson's correlation r and p coefficient of r = 0.88, p < 0.0001 were achieved for vessel tortuosity; r = 0.87, p < 0.0001, for vessel thickness; r = 0.96, p < 0.0001, for vessel length; and r = 0.94, p < 0.0001, for vessel density using the proposed trainable filters algorithm (see Figure 15). Further evaluation was performed on the HRF Dataset, which contains 40 GT images constructed to efficiently assess the performance of the proposed blood vessel segmentation algorithms. Table 7 shows the overall AV., STD, Max, and Min of each clinical feature. The manual and automated images were computed along with the Diff and Diff % between them. The average Diff % between the manual and automated estimations calculated using the proposed trainable filter algorithm were 2.560%, 12.59%, 2.484%, and 5.529% for tortuosity, thickness, length, and density, respectively. Correlation plots between the manual and automated clinical estimations from the HRF dataset using the proposed trainable filtering algorithm are presented in Figure 16.   Further evaluation was performed on the HRF Dataset, which contains 40 GT images constructed to efficiently assess the performance of the proposed blood vessel segmentation algorithms. Table 7 shows the overall AV., STD, Max, and Min of each clinical feature. The manual and automated images were computed along with the Diff and Diff % be-  posed trainable filtering algorithm are presented in Figure 16.

Conclusions
This study proposes an accurate, rapid, and fully automatic blood vessel segmentation and clinical features measurement algorithm for retinal fundus images. The proposed algorithm comprises two primary stages: the blood vessel segmentation and clinical features extraction stages. In the blood vessel segmentation stage, a fully automated segmentation algorithm was proposed and named a trainable filters algorithm to detect the blood vessels in the retinal fundus images accurately. The current algorithm has an image enhancement pre-processing procedure to address the problems of blurring, uneven lighting, and low contrast of the retinal fundus image, and promotes the early diagnosis of several eye pathologies. Several comprehensive experiments were carried out to assess the performance of the developed fully automated segmentation algorithm in detecting the retinal blood vessels using two extremely challenging fundus images datasets, namely, the DRIVE and HRF datasets. Initially, the accuracy of the developed algorithm was evaluated in terms of adequately detecting the retinal blood vessels. In these experiments, five quantitative performance measures were calculated to validate the efficiency of the proposed algorithm, including the Acc., Sen., Spe., PPV, and NPV measures, and compared with current state-of-the-art vessel segmentation approaches on the DRIVE dataset. The results obtained showed a significant improvement by achieving an Acc., Sen., Spe., PPV, and NPV of 99.55%, 99.93%, 99.09%, 93.45%, and 98.89, respectively. Then, the efficiency and reliability of the proposed algorithm in extracting valuable and helpful clinical features were also evaluated by conducting extensive experiments. Statistically notable correlations between the manual and automated estimations of the adopted four clinical features were obtained using the proposed algorithm on both datasets (DRIVE and HRF). We would like to advise researchers to focus on multi-scale methods and try to combine these with our proposed algorithm due to the high quality of the results we produced in the segmentation domain.