Fuzzy Divergence for Lung Radiography Image Enhancement

. Segmentation is one of the inferential applications for detecting patterns in digital images, which has been widely used in the health area. Thresholding, a type of segmentation, consists of separating the gray groups of an image, through one or more thresholds applied to the histogram. Thus, we used the gray tone with the lowest Fuzzy Divergence found to apply the enhancement method, through membership values. This paper presents a method to assist physicians in interpreting lung radiography images, especially in the pandemic caused by COVID-19, when enhancing lung images. In addition, we consulted with a group of medical experts who saw an improvement in image quality, providing the perception of detail in the enhanced image compared to the original image.


INTRODUCTION
Image segmentation is one of the inferential applications for pattern detection, mainly in the health area, as it becomes important in diagnostic analysis, is widely used for image treatment in tomography [11], microscopy [19], magnetic resonance [15] and lung x-ray [10].The lung is the organ responsible for gas exchange and blood oxygenation; it has a spongy consistency, is highly vascularized, covered by the pleura [7].
The pandemic caused by COVID-19 has spread rapidly and the gold standard for diagnosis is the Reverse Transcription-Polymerase Chain Reaction (RT-PCR) test, which does not always detect the disease, opting for tests to identify virus associated damage [1].
Internal factors can interfere with digital image acquisition devices (resolution, beam opening, focus, luminance) and external factors (image acquisition process devices).However, there are situations in which it is necessary to have more defined images, such as radiographs that need more details than the images captured by the equipment.
And one form of image segmentation can be performed according to some options related to thresholding.Here, we choose the Fuzzy Theory due to gray level imprecision and ambiguity regarding gray gradient limits.
In this article, we chose the method of Chaira and Ray [4] regarding the minimization of Fuzzy Divergence, used to determine the ideal gray level for the thresholding imposed in the application of Gamma Probability Distribution to perform the enhancement of x-ray lung images to emphasize the sharpness of the gray gradient of the image for diagnostic.This paper is organized as follows, besides this introductory section: in Section 2, the concepts necessary to understand the method used will be presented; in 3, the results achieved and discussions; and in the Section 4 the conclusions and future perspectives of this work.

DIGITAL IMAGE ENHANCEMENT
A digital image can be represented as a M × N matrix, where each cell represents a pixel.With 8bit gray scale images, the value of each pixel can vary from 0 to 255 at one frequency occurrence.The Figure 1 presents an image in matrix form, with the highlighted pixel being accessed by the indices [2,4].Thus, it is possible to obtain the frequency of each pixel, consequently, the histogram can be generated, which consists of the visualization of a frequency distribution, which can be characterized as unimodal or multimodal with a better balance between brightness and contrast, improving the visualization.
Trends Comput.Appl.Math., 24, N. 4 (2023) Gonzalez, Woods and Eddins [9] create the histogram of a digital image that allows getting the probability function of gray levels as a function of relative frequency: where: k is the intensity which, for a grayscale image of 8 bits, can vary between 0 and 255; n k , number of pixels in the image with the gray level k; n, total amount of intensity tones; P(k), the sum of the probabilities of all elementary events, ∑ k p k will be equal to 1 (one) [2].
Image equalization consists of verifying adherence to a probability distribution referring to the histogram feature to obtain membership values according to the Extension Principle in the fuzzification step, in order to enable the use of divergence methods.

Fuzzy Logic and The Fuzzy Extension Principle
In 1965, Zadeh [18] began his studies in Fuzzy Logic, whose idea came from the observation that the technological resources of the time, that were not only incapable of automating activities related to problems of an industrial, biological or chemical nature, but also could not understand ambiguous situations that could not be processed [17].
Zadeh used the multivalued logic of the Polish Jan Lukasiewicz [17] for the adoption of membership functions [12], in which a variable can have values in a scalar interval [0, 1] that identifies the degree of null and complete membership, respectively, where the range values represent the intermediate degrees of membership of the object in relation to the set, and zero and one show exclusion and full association, respectively [3].
In this paper the usual Histogram Equalization technique will not be addressed, nor the proposal of the Otsu method, the fuzzy proposal becomes innovative when using the Extension Principle according to the continuous gamma probability distribution, which allows to calculate the image of a object inferring the degree of relevance of the Fuzzy Theory [20].

Gamma distribution as a Membership Function
The Gamma is one of the continuous distributions in the probability area, and is also an extension of the exponential density function, often used in models that use positive values greater than zero [13].It's general density function f (x) is: Where: • α, shape parameter; • v, location parameter; • β , scale parameter; and • Γ, formula of the gamma function: ∞ 0 u α−1 e −u du When v = 0, β = 1, the Gamma Distribution assumes the formula below, also known as the Standard Gamma Distribution: When v ̸ = 0, β = 1, and α = 1, the gamma distribution described in Equation (2.2) will assume the following formula, also known as the Exponential Distribution:

Image Enhancement from the Perspective of Fuzzy Segmentation
The membership function, described in the Subsection 2.2, must be treated according to the concept of Thresholding, a method used to separate the background region from the region (µ 0 ) of the object (µ 1 ) of an image, Equations (2.5) and (2.6), respectively: and • f : pixel gray level; • t: threshold, according to the amount of gray levels; • count( f ): number of pixels of a certain level f ; and • L: total gray levels of the image.
For threshold purposes, each pixel in an image has a relationship with the background object or regions.If the pixel belongs to the object, it has a close relationship with the region, that is, what corresponds to the distance between the gray level and the average of the pixel levels in the region [5].
Through a threshold, given an image A with dimensions M × N with L levels of gray.Let f i j be the gray level of the pair (i, j) referring to the pixel of the image A and µ( f i j ) the membership value of this pair, varying between 0 and 1, where µ( f i j ) = 1 denotes maximum membership and µ( f i j ) = 0 denotes non-membership.
Trends Comput.Appl.Math., 24, N. 4 (2023) Based on the region (2.7) and object (2.8) equations, we have: and The normalization constant c is used to guarantee that the gray level belongs in the range [0, 1] and assumes the inverse of the difference between the maximum and minimum values of the set of gray levels referring to the image (Equation (2.9)) which: f min and f max are the minimum and maximum gray levels in the image, respectively.This constant is used to obtain memberships according to the threshold t.
Although thresholding is easy to apply, it may be difficult to detect the probability distribution adhering to the histogram configuration, causing undesirable highlights in the sense of preserving brightness and limiting contrast.
To illustrate, as presented in [9], Figure 2 shows two images ((a) and (c)) with different hue concentrations (light and dark) and their respective histograms ((b) and (d)).It is observed that the tonality of the images influences their histograms, due to the occurrence of the gray levels of the pixels [6].We can see that the graphic of the images a and c have asymmetries to the right and to the left, respectively, that is, it exhibits a tendency to concentrate the gray levels of the pixels in smaller values (lower brightness) and larger values (higher values luminosity).There are some ways to find the threshold.For this paper, we use the threshold through the Fuzzy Extension Principle, which is based on minimizing the Fuzzy Divergence by the membership function through the Gamma Density Distribution [4], whose explanation we can see in the Subsection 2.4.

Fuzzy Divergence
Pal and Pal [14] used Shannon's Classic Informational Theory [16] to segment an image using Fuzzy Exponential Entropy, while Fan and Xie [8] opted for Fuzzy Divergence of Fuzzy Exponential Entropy using an uni-dimensional array.This option was extended to an image represented by a matrix M × M with L distinct levels of gray with probabilities (p 0 , p 1 , p 2 , ..., p L−1 ), where the Exponential Entropy was defined as:   The Fuzzy Entropy for an image A of size M × M is defined as: which: • n = M2 ; • i, j = {0, 1, 2, ..., M − 1}; • µ A , the membership value of the image's pixels; and • f i, j , the (i, j) − th pixel of the image A.
In [4], for two images A (region) and B (object) in the (i, j) − th pixel of the image, the discrimination information µ A ( f i, j ) and µ B ( f i, j ) is given by : which: µ A ( f i, j ) and µ B ( f i, j ) are membership values of the (i, j)-th pixel of the images A and B. Thus, the discrimination between image A and image B can be given as: Similarly, the discrimination between the image B and the image A can be given as: So, the total fuzzy divergence between A and B is given by:

RESULTS AND DISCUSSIONS
We implemented the method proposed by this paper using the Python programming language under the Google Colab platform1 , being chosen because of the practicality of the coding organization that provides, besides the ease of installing the libraries.
We ran tests on CPU Intel Core i7 1.8GHz, 16GB RAM, Nvidia GeForce 940MX GPU, Linux Ubuntu 18.04 LTS OS.In the experiments, we select 37 images of lung radiographs, taken from the dataset of the Kaggle 2 , comprising 11 images of a lung with viral infection caused by COVID-19, 8 images of lung with bacterial pneumonia, 12 images of lung with fungal pneumonia, and 6 images of healthy lungs.We selected these images according to the following criteria: • it should show the lung entirely since the diagnosis is conceived as a function of the scope and location of the onset of the disease; • at least 128 shades of gray.This criterion is necessary because there is a need for better details for diagnosis.Images with the frequency of gray levels below this value were discarded; • the selection of images favored the diversity of places that suffered from pulmonary diseases.
From these images, both one healthy lung and one affected lung were shown, although not from the same individual.The goal was to assess the improvement in image visualization, which facilitates the diagnostic assessment.We detail the information of the selected files in Table 2, which presents the file record of each radiograph used, the year of examination and the country of origin.
After selecting the images, we proceeded with the execution of the enhancement method, being performed for each image threshold in order to verify the gray level that presents the smallest associated divergence.It is important to clarify that no type of pre-processing or manipulation was performed on the selected images.
In Table 2 you can find the discrimination by: Image identification (ID), the smallest fuzzy divergence value found and the gray tone (threshold) that best associates the image details, results that were got by the Fuzzy Extension Principle using the Gamma Density Distribution.
At the same time, the results were compared according to the threshold calculated using the Otsu Method, and the results converged to the 37 images, although, in this text, only four images with different characteristics were presented, shown in the Figures 4, 5, 6 and 7 with their respective histograms.
It is important to emphasize that the relationship between the fuzzy divergence and the lowest threshold was not characterized for all images, since the divergence of all pixels in the processed image was taken into account.
It is noteworthy that the figures have different dimensions, which can change the degree of divergence, as observed in Figure 8, scatter plot referring to the 37 images that associate fuzzy divergence with a threshold (gray tone).We observed that most images showed divergence equal to or less than 20000 and in the other divergence ranges, the number of images was smaller, corresponding to approximately 24% of the test set, which emphasizes the quality of the method.
There are some issues with the images of radiographs acquired from internet banks.The images provided do not have the same resolutions, in addition to the parameters and capture equipment used and conversion and/or processing techniques not being the same.One way to deal with this is to define a protocol for capturing these images, using similar equipment and parameters in order to attest to the quality of the method.
We carried out a consultation with a group of medical specialists who assessed, according to their expertise, an improvement considered significant in the image's quality to aid in the diagnosis, providing the perception of greater details in the highlighted image compared to the original image.Some images were captured while the patients were hospitalized and intubated, which may alter the radiography image.In these cases, there is inconsistent enhancement due to the contrast established by the electrodes connected to it.

CONCLUSION
The feasibility of the method refers to the use of a computer with internet access, as the Google Colab platform works in the cloud.For an image with a resolution close to 800 × 600 pixels, 200KB, the method took approximately four minutes to get the pixel divergences and find the lowest associated threshold, a runtime considered reasonable in using it for lung image enhancement.We believe that in local execution we can optimize this time through parallel and distributed algorithms.
This work presented a method that can assist medical diagnoses in interpreting lung radiography images, especially in the pandemic caused by COVID-19, when performing lung image enhancement, one of the principal method used for diagnosis.
As future projections, we intend to carry out the method execution using images from the most recent period.Furthermore, it is intended to adapt the method that generate multimodal histograms.
The aim is to develop, based on what we have discussed, neurofuzzy algorithms that automate diagnosing lung diseases.The proposed method, when developed on a collaborative platform, aims to democratize knowledge and is available to the academic community.

Figure 1 :
Figure 1: Image representation as a matrix of 8 × 9 dimensions.

Figure 3
Figure 3 presents the low contrast image (a), showing a histogram (b) with a trend towards symmetry, although a valley is visualized on the left.In the high-contrast image (c), the histogram (d) shows a uniform distribution, with the higher and lower gray levels showing expressiveness of occurrence.

Figure 2 :
Figure 2: Bright and dark images and yours respective histograms.

Figure 3 :
Figure 3: Low and high contrast images and yours respectives histograms.

Figure 4 :
Figure 4: Pulmonary radiography according to COVID-19-associated viral involvement and respective enhanced image.

Figure 5 :
Figure 5: Pulmonary radiography according to bacterial involvement and respective enhanced image.

Figure 6 :
Figure 6: Pulmonary radiography according to fungal involvement and respective enhanced image.

Figure 7 :
Figure 7: Healthy lung radiography and respective enhanced image.

Figure 8 :
Figure 8: Scatter plot between fuzzy divergence and gray level (threshold) that had the smallest divergence value of each image.

Table 1 :
Information about images used in the experiments.We chose images that represents countries around the world.

Table 2 :
Fuzzy divergence and threshold of each enhanced image.