Hemorrhage segmentation in mobile-phone retinal images using multiregion contrast enhancement and iterative NICK thresholding region growing

Figure 1 shows the framework of KMMRC-INRG. It includes three main steps. preprocessing, candidate generation, and classification. KMMRC and INRG are novel algorithms proposed in this work. The details of the algorithms are provided in the later sections. The following describes the details of each step.

Figure 1:
Figure 1:

Main processes of the KMMRC-INRG method.

A. Preprocessing

As the green channel of the image can help detect better dark components such as hemorrhages17:00, we convert the image’s green channel to grayscale and use it as an input. Preprocessing includes two main tasks. First are the contrast enhancements, which are performed locally and globally. The second is noise removal.

Local contrast enhancement is first applied to improve local contrast because the background has areas with different lighting conditions, such as illumination and shadows. We proposed a: K-means multiregion contrast enhancement (KMMRC) algorithm to improve the uneven lighting background. The: K:means: algorithm:18:00 is used to divide the background into: K: regions based on intensity. A linear edge enhancement algorithm then enhances the contrast of each region. The pseudoalgorithm is provided in Algorithm 1.

figure a:

The functions used in the algorithm are defined as follows.

IMG2HSV(I) takes the input image I: and extracts and returns the hue (H:), saturation (S:), and brightness (V:) matrices of: I:.

KMeanSegment:(V, K) takes a brightness matrix V: and an integer: K: as inputs. Based on brightness values, it divides V: into: K: submatrices: V:1:V:2:…, V:K: of which: V:1:+: V:2:+: +: V:K: =: V: .

MeanMatrix:(V) takes a brightness matrixV: as an input. It finds the average values ​​in a matrixV: and returns a matrix of the same dimension as:Vof which all elements hold the value of the computed average.

HSV2IMG(H, S, V) takes the matrices hue ( H:), saturation ( S:), and brightness ( V: ) as inputs. It constructs and returns an image from the input matrices H, S, and: V.

Our empirical observations show that: K: = 5 and: (beta =1.5) give the best performance. We then apply contrast-limited adaptive histogram equalization (CLAHE)19:00 to the image to smooth the false edges resulting from local contrast enhancement. To remove the noise and smoothen the image, we apply average filtering20:00 to the resulting image.

B. Candidate generation

We used the contrast-enhanced images from the previous step as input. In this step, the hemorrhage candidates from the contrast-enhanced images are created. To obtain the hemorrhage candidates, we performed blob segmentation and vessel removal. The blob segmentation is performed by using the proposed iterative NICK thresholding region growing (INRG) algorithm. The pseudoalgorithm of INRG is shown in Algorithm 2.

figure b:

The INRG algorithm uses the following functions.

NT:(I) takes an image: I: as an input and returns a set of: (x, y)coordinates of points that pass the NICK threshold in Eq. (1).

$$tau (x,y)=avgleft(x,yright)+kappa sqrt{frac{(sum left({V}^{2}left(x,yright )right) – av{g}^{2}left(x,yright))}{N}},$$


where: (avgleft(x,yright)) is a local average at: (left(x, yright)), (Vleft(x,yright)) is the intensity at: (left(x, yright)), N:is the number of points in the area, and: (kappa) is a parameter in the range [−0.2, −0.1]. From the experiment, we find that: (kappa) = −0.2 and N = 9025 yield the best result.

replace(I, A, c) takes an image: I: a set of points A: and a value: c: as inputs. It replaces the values ​​of points A: in: I: with c.

AvgG:(I, A) takes an image: I:and a set of points A: as inputs and returns the average green values ​​of all points in: A:.

Note: (cup) is a union operator. Our empirical observations show that: n:= 3 and: (delta =0.1) give the best performance.

The algorithm first calculates the initial regions of the candidate blobs by searching for pixels that are salient compared to their local backgrounds using NICK thresholding (NT)21,22:. To better extract a region with nonuniform intensity, the algorithm expands the region by replacing the intensity in the regions with its average. Then, the algorithm reapplies NICK thresholding. It repeats until the region’s growth rate is less than a convergence constant. The program repeats at most n-1: times to ensure a complete exit. Figure 2 shows the areas of hemorrhage candidates using the INRG algorithm at different iterations until it converges.

Figure 2:
Figure 2:

Images of blob regions at different iterations of INRG. The original images (a:) and regions obtained from the INRG algorithm from the first iteration until it converges (b–d).

Long and thin blobs are usually vessels. The algorithm detects these blobs by considering the axis length ratio of the fitted ellipse’s major and minor axes. From an empirical experiment, the ratio of 6.4 gives the optimal solution; it is assumed to be a blood vessel and is removed.

C. Feature extraction and classification

The hue-saturation-value (HSV) color space is used in the feature extraction process, as hemorrhages are usually rich in color, have low saturation, and have low brightness. Additionally, HSV is more resistant to external lighting than RGB. The:H:,S:and:V:values ​​are used as features extracted from each candidate.

Blob’s feature data and correct class answers (hemorrhagic and nonhemorrhagic) are trained and tested using fivefold cross-validation. Figure 3 depicts all processes from the beginning until hemorrhages are obtained.

Figure 3:
Figure 3:

Illustration of overall processes to obtain hemorrhage. original image (top left), after applying KMMRC to adjust local contrast (top right), after conversion to a grayscale of the green channel and global contrast enhancement using CLAHE (second row-left), after noise filtering using average filter (second row -right), after region segmentation using INRG algorithm (third row-left), after vessel removal (third row-right), and after classification (bottom).