A level-set method for inhomogeneous image segmentation with application to breast thermography images

Various level-set methods have been suggested for segmenting images with intensity inhomogeneity as local region-based models. The challenge in these methods is segmenting the inhomogeneous images with smooth edges. These methods cannot properly segment regions with smooth edges in inhomogeneous images. This paper presents a new local region-based active contour model called local self-weighted active contour model. In the proposed method, a novel different weighting technique is applied. In this model, the weight of each neighbour pixel in the energy function is set by a function of its intensity and not its geometrical distance regarding the central pixel as previous methods. Considering this, the presented approach can segment regions with smooth edges in the presence of inhomogeneity as breast thermography images. The experimental results of applying the model on heterogeneous images containing synthetic images and medical images, especially breast thermography images, are compared with well-known local level-set methods which show the perfect capability of the model. The segmentation results were evaluated using the F-score, accuracy, precision and recall criteria. The results show values of 0.8, 0.62, 0.73 and 0.82 for the average accuracy, F-score, precision and recall criteria on the segmentation of breast thermography images, respectively.


INTRODUCTION
Image segmentation is a challenging issue in computer vision and image analysis [1]. Segmentation of medical images has been considered in recent years [2] which helps the physician to analyze the image more accurately. The main challenge in the segmentation of medical images by different modalities is the extraction of interesting areas in the presence of intensity inhomogeneity. Intensity inhomogeneity appears in all modalities and arises due to imaging condition and imaging device which seriously affect the segmentation accurately. So, many methods have been suggested to solve the problem [3]. Segmentation methods can be divided into two categories. First, methods that require a training phase as deep learning methods, hidden Markov models, neural networks, and so on [3]. The accuracy of these methods depends on the dataset, the number of training images, their ground truth and the quality of the training process. Second, methods that do not have a training stage. The advantage of these methods is that they do not require an extensive database and operate independently on an This is an open access article under the terms of the Creative Commons Attribution License, which permits use, distribution and reproduction in any medium, provided the original work is properly cited. © 2020 The Authors. IET Image Processing published by John Wiley & Sons Ltd on behalf of The Institution of Engineering and Technology image. Since this article aims to segment breast thermography images, and we do not have an extensive database available, we use the second category methods.
Among these methods, active contour models (ACMs) have been employed broadly since they were introduced [4]. The original ACMs idea is that there is an initial contour around an object and evolves to get real borders of that, by minimizing an energy function. Various ACMs propose to segment medical images from various modalities [5][6][7][8]. Extensive research in this area addresses intensity inhomogeneity and uses local region-based ACMs. In addition to intensity inhomogeneity, noise and smooth edges are other challenges of medical images segmentation. Local region-based methods can deal with intensity inhomogeneity and noise in the medical images segmentation of different modalities based on these energy functions. In these methods, the importance of smooth edges in defining the energy function is ignored.
Recently, breast thermography images with both intensity inhomogeneity and smooth edges have been widely used to diagnose the related diseases [9]. The existing ACMs for the segmentation of inhomogeneous images cannot segment breast thermography images because of the smooth edges. These methods consider smooth edges as inhomogeneity and fail to extract abnormality regions with smooth edges. Therefore, we present a new ACM that succeeds in segmenting inhomogeneous images with smooth edges. This paper proposes a local region-based ACM, called local self-weighted active contour (LSW-AC) model, to segment inhomogeneous images. The main contribution of our research is the definition of a new weighting function in a new energy function. The new weighting function results in the extraction of smooth edges, and the new energy function leads to proper segmentation in the presence of inhomogeneity intensity. In previous methods, the distance of a pixel from its neighbours is used to adjust the effect of the neighbour pixel on its energy function. In this model, each neighbour pixel's effect on the energy is based on its intensity and not on its distance from the center pixel. For example, to extract a bright region, a high-intensity pixel gains higher weight. This weighting function results in an excellent performance to extract smooth edges in the presence of inhomogeneity. To prove this, the results of the LSW-AC model are compared with the well-known levelset methods for inhomogeneous image segmentation, such as the region-scalable fitting energy (RSF) model, the local intensity clustering (LIC) model, the local Chan-Vese model (LCV) model, the local statistical ACM (LSACM), the adaptive local fitting (ALF) model and the entropy weighted fitting (EWF) model on medical images. The simulation results verify the effectiveness of the proposed method.
In summary, the main significance of our method over other local region-based methods is its high ability to segment heterogeneous images with smooth edges. Some local regionbased methods are not successful in segmenting heterogeneous images, such as the RSF model, and some of them, such as the LSACM method, succeed in segmenting heterogeneous images by properly adjusting the parameters. But all of them are poor at segmenting breast thermography images that have very smooth edges in the presence of heterogeneity. The more successful methods in this category, in breast thermography images, segment only the areas that have more distinct edges. The proposed method not only has the ability to segment medical images with heterogeneity that the edges of the target areas are strong, but also, due to the defined weight function, it is very strong in segmenting breast thermography images that have areas with very smooth edges in the presence of heterogeneity.
Generally speaking, the main properties of the LSW-AC model are summarized as follows: 1. The proposed method successfully segments inhomogeneous images and has acceptable performance compared to other related methods. 2. The main advantage of the presented method is that it can properly segment objects with smooth edges in inhomogeneous images. To show this superiority, this paper used breast thermography images, and the results are quantitatively evaluated to show the remarkable capabilities of the approach.
3. One of the important advantages of the model is that the type of regions to be specified, whether dark or bright, can be adapted by setting a parameter . In the previous methods, each pixel where its neighbours have different intensities  inside and outside the contour denotes as the boundary and  curve stop there; thus, all edges of the image are extracted. However, for images having both dark and bright regions of interest, the segmentation faces a severe problem.
The remainder of this paper is organized as follows. In Section 2, we review ACMs used in image segmentation. In Section 3, the concepts and formulation of the level-set models are discussed. In Section 4, the proposed LSW-AC model is presented. The results and discussions are covered in Section 5, and the paper is concluded in Section 6.

RELATED WORK
The pioneering work of Osher and Sethian [10] introduces the level-set method for image segmentation based on ACMs. The main idea of the level-set method is the evolution of a curve which is expressed by a zero-level set with a highdimensional function, in accordance with minimizing an energy function. In recent years, level-set methods are combined with neural-network-based methods in image segmentation for more accuracy. We briefly introduce some of these methods. In [6], performance of a local region-based ACMs is improved by using a prior information term that is derived from U-Net. In [11], a deep learning method is employed to acquire the initial contour, then a level-set method is used to evolve that initial contour and then segment medical images. In [12], at first, a deep learning method is employed for tumor segmentation in medical images, and then a level-set method improves the segmentation results. In [13], a level-set model with a deep prior method is proposed for image segmentation based on the priors learned by fully convolutional networks. In these methods, traditional level-set methods that are sensitive to initial contour placement are used, and a deep learning method is employed to compensate for this drawback. Our method is not sensitive to the initial contour placement; thus, we do not need prior information. On the other hand, these methods have a training phase and therefore require a large database, but we do not have a large enough database. Therefore, this paper tackles the task of segmentation of inhomogeneous images, especially in the presence of smooth edges with ACMs without any prior knowledge. In the following, we discuss related ACMs and do not consider the methods such as deep learning that require the learning stage. In Figure 1, a category of image segmentation methods appropriate to this study is shown. We refer the reader to a recent comprehensive overview of Le et al. [14] for an extensive analysis of such methods. The ACMs, based on the region information or the gradient information in the energy function, are divided into the edgebased models [4,15,16] and the region-based models [17][18][19][20]. The edge-based models [4,15,16] use image gradients as a stop factor in the energy function. Since these methods are FIGURE 1 Segmentation methods sensitive to noise, intensity inhomogeneity and the initial contour placement, they do not succeed in the segmentation of images with weak edges and intensity inhomogeneity. Since this paper aims to segment regions with smooth edges, these models are not proper to our goal. In comparison with the edgebased models, the region-based models use the statistical information of regions instead of gradients to define the energy function. Therefore, they improve the defect of edge-based models and are less sensitive to the initial contour placement and noise. Using image information, region-based models can be classified into two categories: global models [20,21] and local models [17][18][19][22][23][24][25][26][27][28][29][30][31][32][33][34].
The global models use the whole intensity information of the image for contour evolution, so they are not sensitive to the initial contour placement. One of the most famous global models is the Chan-Vese (CV) model [20]. In these models, the evolutionary curve stops at weak edges, and they are at least imperceptive to noise and the initial contour placement. Because of the homogeneity assumption in each region, probably the heterogeneity images cannot be segmented. To solve the heterogeneous intensity problem in level-set methods, many improvements have been suggested, whose main idea is using local intensity information [17][18][19][22][23][24][25][26][27][28][29][30][31][32][33][34]. Since our test images are heterogeneous, we have to use local models. These models are introduced as follows.
In local models, the severity of intensity is assumed to be non-uniform in the whole image and uniform in a local region. In the energy function, local intensities' information is used to improve the accuracy of noisy and heterogeneous image segmentation. Li et al. [25] suggested local active contour with RSF model that uses the average of intensities as local image intensity information in the CV model. So it can deal with intensity inhomogeneity. However, the RSF model is very sensitive to the initial contour placement and adjustments of parameters, because it only uses local information. The local likelihood image fitting method [26] and the local Gaussian distribution fitting energy model [27] were offered to improve the RSF performance. In fact, these methods [26,27] use the Gaussian distribution with different means and variances to describe local image intensities. These models have a more accurate performance than the RSF model in the presence of inhomogeneity and noise. Due to the assumption of Gaussian distribution in the local area, the area with smooth edges gets a low variance and is chosen as inhomogeneity.
Li et al. [28] suggested the LIC model that acts as a local clustering k-means method. The LIC model is concerned with local information; therefore, the flexible location of the initial contour is used to control the intensity heterogeneity. This model handles the slow change of inhomogeneity well and extracts strong edges, while it cannot properly segment images with smooth edges and inhomogeneity intensity. Since this model does not take into account variance in different areas, it may lead to undesirable segmentation and also be sensitive to the choice of parameters. Zhang et al. [29] proposed the LSACM that uses Gaussian distributions with different means and variances to model the extremely heterogeneous object. According to the variances information, the intensities' information is mapped to statistical information, which decreases the overlapping among objects and background intensities. This model has better performance in the presence of intensity inhomogeneity because of using the local variance in addition to the local mean in the energy function. However, according to the assumption of Gaussian distribution for intensity in a local area, the effect of farther neighbour pixels is low, so it cannot deal with smooth edges. Ma et al. [22] proposed an ALF model. In this model, first, for each pixel in the original image, a rectangular window with its centre on that pixel is made. Then, an image block corresponding to the pixels in the window is estimated, and the square difference between them is taken as the energy loss for the current pixels. Generally, local models can properly segment heterogeneous images. However, these models are sensitive to the initial contour placement, and an inappropriate initial contour can result in weak segmented results.
Wang et al. [31] proposed a model of entropy weight connections, named EWF model. They introduced a heterogeneous entropy descriptor, and entropy-weighted energy function based on measuring the difference between the input image and three suitable local images. This model can segment heterogeneous images based on the average local intensity using local image intensity information. However, this model is sensitive to the initial contour placement and cannot effectively deal with severe intensity inhomogeneity. Peng et al. [32] recently proposed a local mean and variance (LMV)-based ACM to segment medical images with inhomogeneity. The LMV model considers the distribution of intensity belonging to foreground and background regions as Gaussian distributions with varying means and variances. Since both local mean and variance are considered, this model can deal with images with intensity inhomogeneity. On the other hand, because the weighting function in this model is uniform and the effect of all neighbour pixels is equal, this model cannot deal with inhomogeneous images with smooth edges. However, our proposed LSW-AC model due to the specific weighting function can successfully segment inhomogeneous images with smooth edges.
Other kinds of level-set methods for intensity inhomogeneity [23,24,30,33,34] combine the global and local intensity information of each pixel to segment heterogeneous images. In these methods, the energy function is a weighted combination of two terms, based on local and global intensity information. Actually, global information is used to prevent contour from being in the local minimum, and local information is used to overcome the inhomogeneity problem. In [30], the LCV model was proposed, and it was suggested to combine a local term and a global term to segment the heterogeneous images. The global term in the LCV model is the same as the CV model, and the difference between the local average image and the original image is calculated as local information. As a result, the contrast between the object and background intensities is improved. The LCV model can be assumed as the CV model that operates on an image, which is a combination of the original image and the local average image. Therefore, it is difficult for the LCV model to segment the image with intensity heterogeneity satisfactorily.
Fang et al. [33] proposed a hybrid ACM for segmenting medical images with noise and intensity inhomogeneity. This model synthesizes both global and local information. The energy function contains a local energy term and a global energy term with an adaptive weight. This model is powerful in dealing with inhomogeneity. Since it regards the effect of neighbour pixels in the local energy term by uniform distribution, this method fails to deal with smooth edges in the presence of inhomogeneity. In [34], a region-based ACM containing a global term and the RSF model as a local term is proposed. Due to the global term, this model has outstanding performance to solve the initialization sensitivity problem. Because of the RSF model, this model does not perform well with smooth edges in inhomogeneity.
Generally, all hybrid methods, due to using a global term relative to the local method, have low sensitivity to the location of the initial contour. The important issue in these methods is the optimal weight among global and local terms. In other words, the performance of these methods is under the influence of the participation rate of global and local terms in the calculation of energy function. We refer to a recent comprehensive overview [35] for more study on the level-set methods for image segmentation with intensity inhomogeneity.

LEVEL-SET METHODS
In ACMs, evolving contour C moves towards the target boundaries in a minimization process of an energy function in the level-set framework. Let I be an image comprising N × M pixels that are indexed as x = {1, 2, … , N } and y = {1, 2, … , M }, and Ω shows the image domain. Intensity at pixel In these methods, contour C partitions image domain Ω into two distinct regions: Ω in as inside C region and Ω out as outside C region. In the level-set formulation, contour is Heaviside function [20] and is defined as The challenge is to define the proper energy function according to different features of the image. The two most famous models that use regional information to define the energy function are the global region-based CV model and the local regionbased RSF model. Since the proposed method is a region-based model, these models are reviewed in detail in the following.

Chan-Vese model
Chan and Vese [20] proposed a global region-based ACM (CV model) that segments a piecewise constant image into two disjoint regions by contour C . The energy function of the CV model (E CV ) is where in and out are constants that approximate the global average intensity of image I inside and outside the contour C . , , 1 and 2 are fixed positive parameters. Ω in , Ω out and pixel x are defined in previous. The first two terms regularize terms controlling the smoothness of the evolving contour, and the other two terms are data terms that attract the contour towards the object boundaries.
Utilizing the Heaviside function in (1), the energy function E CV ( in , out , C ) in terms of the level-set function is reformulated as where is the Dirac delta function and is defined as the derivative of Heaviside function H . The main advantages of the CV model are its less sensitivity to noise, weak edges and initial contour placement, but it fails to segment the images with intensity inhomogeneity.

RSF model
To overcome the drawbacks of the CV model in the segmentation of images with intensity inhomogeneity, Li et al. [25,36] utilized local image intensity information into the CV model and proposed the RSF model. The energy function of the RSF model (E RSF ) for pixel x is defined as where 1 and 2 are fixed parameters. Pixel y is neighbour of pixel x. g is a Gaussian kernel with the standard deviation with a localization property that g (x − y) decreases and approaches to zero as y goes away from the centre point x. f 1 (y) and f 2 (y) are the locally weighted intensity means around pixel y inside and outside C and defines as follows: where pixel z is neighbour of pixel y. M 1 ( ) = H ( ) and M 2 ( ) = 1 − H ( ) and H is Heaviside function in (1). In this model, the local intensity information is utilized to deal with intensity inhomogeneity problems, but it is sensitive to the initial contour and may stop in local minima. It is noteworthy that not only the effect of f 1 (y) and f 2 (y) on E RSF x is affected by the distance x from y, but also each neighbour pixel z is weighted by its distance from centre y in f 1 (y) and f 2 (y). In the proposed method, we present a new weighted function to improve the performance of local region-based models, such as the RSF model.

Method description
In this section, the proposed LSW-AC model is presented, in which the total energy functional E T is made of two fragments: the new local self-weighted region fitting term or data term, E D , and the regularization term, E R . Thus, the overall energy function can be described as For the definition of E D , first, we define the local energy function for pixel x, as E LSW x . Since segmentation of regions in the presence of intensity inhomogeneity is one of the main goals of this research, the energy function for pixel x should be derived from local information around it. So we proposed where I is the image to be segmented, and f in and f out are local criteria which approximate the local intensities inside and outside the contour, respectively. is a constant value that should be positive/negative for bright/dark region extraction or vice versa. First, we assume for the bright region extraction, is set to be 1, and for the dark one, is set as −1.
There are three general rules to define energy function in ACMs: • Pixels whose energy value is zero are distinguished as a boundary. • For pixels that have to move from the inside to the outside contour or vice versa, their energy value should be positive. We call them 'improper pixels'. • For pixels that have to remain the inside or the outside contour, their energy value should be negative. We call them 'proper pixels'.
Suppose the goal of segmentation is to extract bright regions and is a positive value. Obviously, pixels that are satisfied in the condition Hence, the bright pixels should be inside the contour and the dark pixels outside. So the dark pixels inside the contour and the bright pixels outside the contour are improper pixels, and their energy values should be positive. On the other hand, if , the energy value of x should be positive. Therefore, for the inside contour pixels, the energy value is equal to −E LSW x , and for the outside contour pixels, it is equal to E LSW x . A similar description of dark region extraction is defined consequently. Hence, the E D can be rewritten as where E LSW x is defined in (7). If we assume in (7) is −1 for the bright region extraction and +1 for the dark region extraction, x d x. This paper set = +1 for the bright region extraction and = −1 for the dark region extraction.
f in (x) and f out (x) in (7) are two local criteria on neighbour regions of x. We propose a new weight function in f in (x) and f out (x) that makes the proposed method proper for the smooth edge extraction. We consider a simple rule to define the weight function for bright region extraction. In this situation, high-intensity regions should be inside the contour; therefore, high-intensity pixels get large weights, and low-intensity pixels take small weights. Therefore, we propose that each pixel be weighted by its intensity value. In this way, the desired conditions are met. Consequently, f in (x) and f out (x) for bright region extraction are defined as where N x is the neighbour region of x. y is neighbour of x and I (y) is the intensity value of pixel y.
To extract a dark region, low-intensity regions should be inside the contour; hence, large weights are considered for lowintensity pixels and small weights for high-intensity pixels. To meet the conditions, we propose that each pixel be weighted with its opposite intensity value. Since I (x) ∈ [0, 1], then opposite of intensity value is 1 − I (x). Therefore, for dark region extraction, f in and f out are defined as For more explanation, consider Figure 2 in which the goal is to extract bright regions. According to (9), each inside-contour pixel is weighed with its own value; consequently, high-intensity local pixels in region A take large weights; accordingly f in , E D and convergence speed of contours increase. Thus, by appropriately choosing of f in , f out and in (7), the target regions (bright or dark) can be segmented.
Although energy function defined in (7) due to specific f in and f out in relations (9)-(12) can deal with smooth edges better than other local models, it may cause some limitations in situations as shown in Figure 3(b) and (c). In the three images of the first row of Figure 3, pixel x and its local neighbour area and evolving contour C are shown. Assume in all these images, based on relation (7), pixel x is detected to be on the . Note that, the above limitation exists for all local models; therefore, the performance of these methods depends on the neighbourhood radius. But in the proposed function in (7), this is more significant. To solve this problem, Equation (7) is modified as following: where (x) is a function in term of x which is introduced in the following. By adding the term (x) in the energy function (13), , the energy value will not be equal to zero and the evolving contour does not stop. On the other hand, in all images in Figure 3(a)-(c), energy value in relation (7) on pixel x is zero, while | f in − f out | is various. In Figure 3(a), where pixel x is on the edge, the term | f in − f out | is high, but in nonedge pixel x, it is low as Figure 3(b) and (c). Consequently, when | f in − f out | is high, should have low value for energy value in (13) to be zero. In the same way, when | f in − f out | is low, should be high value for energy value in (13) to be non-zero and evolving contour does not stop. Accordingly, (x) as a function of | f in − f out | is defined as following: where (x) is a function in term of x and is introduced in the following. (x) forces the contour to proceed in non-edge regions, but the important thing is direction of the motion. To clarify this, we use an example in Figure 4. In Figure 4 On the other hand, x 1 and x 3 are inside the contour and x 2 and x 4 are outside the contour, so from Equation (8), it is clear that where E D x is the data term of energy function that is defined in Equation (8) in pixel x. Using Equations (15) and (16), we have From a practical point of view, x 1 and x 3 do not belong to the target regions; hence, it is necessary to assign these pixels to the region outside the contour. In addition, pixels x 2 and x 4 , which belong to the target regions, are outside the contour, thus they should be assigned to the region inside the contour; as a result, their energy values E D x∈{x 1 ,x 2 ,x 3 ,x 4 } should be positive. Consequently, the following condition for (x) should be fulfilled: Subsequently, using Equations (14) and (18), we have For this, (x) is defined as where is a positive constant and c in represents the mean intensity inside the contour. In Figure 4 As a brief summary, since the proposed method is a local model, it is proper for segmentation of inhomogeneous images. If = 0 is considered, all pixels satisfying condition I (x) = f in (x)+ f out (x) 2 are indicated as boundary by energy function in (21). Obviously, this selection depends on the radius of neighbourhood. As the radius decreases, the number of pixels that satisfy the mentioned condition increases. Furthermore, with specific definition of f in and f out , fewer smooth edges are misclassified as inhomogeneity regions, in comparison with other local models. If ≠ 0 is considered, pixels that satisfy condition I (x) = f in (x)+ f out (x) 2 and also pixels that their | f in − f out | are low are not considered as boundaries. Therefore, with = 0, the smooth regions in inhomogeneous images are extracted, and with > 0, more determined bright or dark regions are extracted.

Level-set formulation
Since energy minimization can be solved by using the curve implicitly combined with a level-set function , we use the levelset method to minimize the proposed energy function. Applying the Heaviside function, the level-set formulation of energy function (6) using (8) is as follows: (21). In practice, the Heaviside function H in (1) is approximated by the following smooth function H [20]: where is a positive constant. The derivation of H is the smooth Dirac function as To regularize the level set function, two regularization terms illustrated in [36] are introduced as E R . Finally, the total energy function of the proposed model can be rewritten as where E LSW x is defined in (21). and are two constant parameters.
is a constant weight of curve length term∫ Ω ( )|∇ | d x, which is used to smooth the evolving contour.
is a constant weight of the regularization term∫ Ω (|∇ | − 1) 2 d x, which is used to keep the level set as a signal distance function to avoid re-initialization of the curve. The solution to the energy minimization with respect to by the gradient descendent method can be obtained by solving the following equation of the level set function : where ∇ is the gradient operator, and div() is the divergence operator. c in is the average intensity inside the contour as f in (x) and f out (x) are local criteria; therefore, we utilize a weighting function with a localization property K as where is the neighbourhood radius of a nominal pixel u, and N is the constant and indicates the number of pixels inside the neighbourhood radius. On the other hand, K (u) is an average filter with size 2 × 2 . So, for bright region extraction, we have and for dark region extraction, they are

Numerical implementation
The first step in segmenting an image with the proposed method is to initialize the level-set function . In this paper, the level-set function is initialized as where c 0 is a positive constant value. Then, in contour evolution, the level-set function is updated iteratively using where n is the iteration number; n is in iteration n or old ; and n+1 denotes new or in iteration n + 1. Δt is time step between two consecutive iterations, and t is obtained in Equation (26) by using n or in iteration n, so we call it Δ n . Finally, new or n+1 is updated by The convergence condition is where is a small positive constant [37]. The flow chart of the proposed LSW-AC method is shown in Figure 5.

EXPERIMENTAL RESULTS
In this section, the experimental results are presented. This paper used the following default setting of the parameters of the proposed method for all experiments: c 0 in Equation (33) is equal to 2, Δt in Equation (35) is set to 1 and in Equation (36) is equal to 0.1. in Equation (26) is set to 1 or −1 regarding user's target for bright or dark region extraction. The positive constant in Equations (23) and (24) to approximate the Heaviside function is set to 1 as in [20]. According to the practical situation, the values of and in Equation (26), and in Equation (28), should be adjusted. The effect of the parameter in Equation (26) on the performance of the proposed method is discussed in Section 5.4 in detail. The proposed method has been executed by Matlab R2013a on a computer with Intel(R) core(TM) i5 Duo 2.3 GHz CPU, 4G RAM and Windows 7 operating system.
A series of experiments are conducted to show the capability of the LSW-AC method. This method is utilized to segment synthetic images and medical images in two subsections. These experiments are employed to demonstrate the applicability and robustness of the LSW-AC method to deal with intensity inhomogeneity. Most notably, breast thermography image segmentation, in the subsection of medical images, can be extensively used to demonstrate the ability of the proposed method to deal with smooth boundaries in the presence of intensity inhomogeneity. Several typical level-set methods are selected for a performance comparison including the RSF model [25], LCV model [30], LIC model [28], LSACM [29], ALF model [22] and EWF model [31].

Experimental data
In this study, the proposed method and other comparative methods are applied to segment different images. The first category is synthetic images. The six most used images in relevant papers of this category are examined. These images are shown in  Table 1.
The third category of test images is breast thermography images. This paper utilized some breast thermography images from the IUT-OPTIC database [38]; this dataset contains 160 thermal breast images. The ground truths of 80 images of this dataset are extracted by an expert (MD. S. Taghizadeh who is a qualified specialist with over 16 years of experience in breast thermography image analysis). These 80 images are segmented in this study by the proposed method and other comparative methods. The resolution of these images is 127 dots per inch (dpi). The width of the images varies but the length of the images is almost the same. For example, the size of six breast thermography images, which are shown in Figures 14(a)-(c) and 15(a)-(c), are indicated in Table 1.

Experimental results on synthetic images
At first, to manifest the confirmation of the performance of the proposed method, the results of segmenting the synthetic images, that are different in inhomogeneity, are demonstrated. Figures 6 and 7 illustrate the results of segmenting by the LSW-AC method for six synthetic images, which suffer from different variation degrees of intensity inhomogeneity. The initial contours are shown by blue on each test image in the first rows, and the final segmentation results of the LSW-AC method are denoted by red curves and illustrated in the second rows. The results show that the LSW-AC method is able to present an acceptable segmentation of the synthetic images which have extra heterogeneity.

Segmentation results on medical images
Medical images have already been extensively employed to diagnose diseases. However, due to the influences of devices or illumination, there often exist intensity inhomogeneities in medical images. Hence, in this subsection, we show the capability of the proposed method to segment medical images that suffer from intensity inhomogeneity in two parts. In the first part, the effectiveness of our method on the segmentation of medical images from different modalities is determined. As discussed earlier, one of the main advantages of the proposed LSW-AC model is the capability to extract objects with obscure boundaries and intensity inhomogeneity. To obviously indicate this efficiency, in the second part, the breast thermography images which have the mentioned properties are segmented.

Segmentation results on medical images from different modalities
In Figures 8-13, the ability of the proposed LSW-AC model regarding a set of medical images from different modalities is demonstrated, and the comparisons of our method with four popular methods, i.e. RSF [25], LIC [28], LCV [30] and LSACM [29] are given. In each figure of Figures 8-13, the segmentation results of the RSF [25], LIC [28], LCV [30], LSACM [29] and LSW-AC models on a medical image are shown. The medical images in this experiment are two magnetic resonance angiogram images of blood vessels, a magnetic resonance image of the left ventricle of a human heart, a torso computed tomography image, a mammography mass image and a bone x-ray image. Those images have intensity inhomogeneity. Figures 8(f)-13(f) depict that the LSW-AC method is able to accurately segment all test images. To obtain a quick segmentation, the initial contours are overlaid on each image as shown in Figures 8(a)-13(a). It is obviously shown that the proposed method can reach accurately to the boundaries of all targeted objectives.

Segmentation results on breast thermography images
Breast cancer is the most commonly diagnosed cancer in women. Breast thermography reveals the thermal patterns of the breast [9]. Information regarding the warm and cold regions such as shape, size, the pattern of placement and borders can help detect abnormalities. The probability of abnormalities can be distinguished using the information of thermography images, such as the fact that a benign tumor has smooth boundaries and a malignant tumor has irregular shapes, or if a collection of vessels go to a warm hole, it may be a malignant case, and so on. Therefore, the extraction of warm and cold regions is a primary step to achieve this end. The breast thermography images have intensity inhomogeneity. Thus, local level-set methods are appropriate for the segmentation of these images. We selected 80 breast thermography images of the IUT-OPTIC database [38] that their ground truths are available, to show the superiority of our method over other methods. To verify the efficiency of the proposed algorithm, its performance is compared with five well-known local level-set methods as RSF model [25], LIC model [28], LSACM [29], ALF model [22] and EWF model [31] introduced previously. For all these models, the same initial contour settings were adopted.
To have an accurate segmentation, we have to select the appropriate value of in segmenting the breast thermography images. To adjust the parameters, we selected randomly six images of the IUT-OPTIC database. These images with their ground truths are displayed in Figures 14 and 15.
To compare the segmentation results quantitatively, four criteria of commonly used validation metrics including the precision, recall, accuracy and F-score are utilized.
where true positive (TP) and false positive (FP) denote the number of related and unrelated pixels selected as true regions by final contour, respectively, and false negative (FN ) and true negative (TN ) determine the number of related and unrelated pixels not selected by the final contour, respectively. Scientifically, precision is the fraction of selected regions that are true and recall is the fraction of the true region that are successfully selected. Fscore measure indicates the ability of the method to select true regions, and the accuracy measure shows its capability to select true regions and not select false regions. For each of the six images in Figures 14 and 15, segmentation results with different values of were obtained. For this purpose, the thermography images are segmented by the proposed method LSW-AC and the values of = {0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1}. In each case, for each image and each value of , the segmentation result is measured by the F-score criterion. Figure 16 shows the F-score criteria for all six tested images and all values of . As can be seen, the 0 ≤ < 0.2 range is an appropriate choice for reliable results.
Then, for a more accurate selection of in the range of 0 ≤ < 0.2 and also to get the optimal window size or in relation (28), the six images presented in Figures 14 and 15  In the next experiment, the results of the proposed method are obtained on the remaining 74 images from the 80 selected FIGURE 16 F-score criteria for all six tested images in Figures 14 and 15, and all values of images with the parameters = 0 and = 50. The segmentation results were evaluated using the F-score, accuracy, precision and recall criteria. The results show values of 0.8, 0.62, 0.73 and 0.82 for the average accuracy, F-score, precision and recall criteria on the 74 tested images, respectively. Here, we try to choose the proper value of parameters 2 and window size for other comparative methods for segmentation of breast thermography images. Note that 1 and 2 in all methods, except the EWF model [31], are the weights of the energy value of each pixel inside and outside the contour, respectively, as 1 and 2 in Equation (4) for RSF model [25]. The EWF model [31] does not have these parameters. We set 1 = 1 and adjust 2 to get more accurate results. Gaussian kernel in energy function of the RSF [25], LIC [28], LSACM [29], ALF [22] and EWF [31] methods has the standard deviation and the window size 4 + 1. In the first experiment, six tested images in Figures 14 and 15 are segmented with the RSF [25], LIC [28], LSACM [29], ALF [22] and EWF [31] methods with different values of = {4, 5, 6, 7, 8, 9, 10, 11, 12}. Then, each segmented image with each of the window size is evaluated with F-score criteria. The best window size for each method is chosen according to the average of F-score criteria in six tested images and is shown in Table 2. In this experiment, for RSF [25], LIC [28], LSACM [29] and ALF [22] models, 2 is set to 1. In the subsequent experiment, window size set to this best value and six tested images in Figures 14 and 15 are segmented with the RSF [25], LIC [28], LSACM [29] and ALF [22] methods with different values of 2 = [0.8 ∶ 0.01 ∶ 1.2]. Then, each segmented image with each of the 2 is evaluated with F-score criteria. The best 2 for each method is chosen according to the average of  F-score criteria in six tested images and is shown in Table 3.
In the next experiment, 74 remaining thermography images, which their ground truth is available, are segmented with the proposed method and other comparative methods with their proper parameters. Table 4 indicates the average value of accuracy, F-score, precision and recall criteria on the 74 tested images for comparative models and the proposed method. The rest of this subsection divides into two parts. First, the segmentation results of six images which are displayed in Figures 14 and 15 with a global initial contour are shown. The global initial contour extends in the whole image domain as in Figure 17. It is noteworthy that in the previous experiment, the segmentation results of the proposed method and all compared methods on 74 test images are obtained by this global initial contour. Second, local initial contours are located on target regions on six test images, and the segmentation results are shown.
The  The presented method has a high ability to segment the regions with inhomogeneity and smooth edges. In other words, it accurately detects the boundary of the regions that their intensity difference from the background is low. In comparison, other studied methods cannot correctly segment these images, but their performance in segmenting the images with distinct edges like FIGURE 19 Comparison experiments between five models and LSW-AC model for segmenting breast image illustrated in Figure 14(b)

FIGURE 20
Comparison experiments between five models and LSW-AC model for segmenting breast image illustrated in Figure 14(c)

FIGURE 21
Comparison experiments between five models and LSW-AC model for segmenting breast image illustrated in Figure 15(a)

FIGURE 22
Comparison experiments between five models and LSW-AC model for segmenting breast image illustrated in Figure 15  the breast thermography image in Figure 18 is better than the images with obscure areas and edges.
To compare time, the average number of iterations and the average of computational time for the results of all six images and six methods denoted in Figures 18-23 are shown in Table 5. Table 5 shows that the proposed method has an advantage in computational time over other models.
The corresponding precision, recall, accuracy and F-score values of the segmentation results of the sequence of six images with six methods in Figures 18-23 are illustrated in Figure 24. It is noteworthy that, images in Figures 18-23 are indicated as 'Img.1' to 'Img.6', respectively, in Figure 24. It is clear that our method has a stronger ability to segment the objects with smooth edges in the presence of inhomogeneity than other methods.
In the next experiment, to further reveal the ability of the proposed method, it is compared with five comparable models in local segmentation of an abnormality on breast thermography images. To this end, local initial contours located on target regions are utilized. The test images are shown in  [25], LIC [28], LSACM [29], ALF [22], EWF [31] and LSW-AC methods are reverberated. For similar conditions, in all methods, the window size is the same and equal to 40. For quantitative comparison, the corresponding accuracy, Fscore, precision and recall values of the segmentation results of all images with six methods shown in Figures 27-32 are illustrated in Figure 33. Notice that images in Figures 27-32 are indicated as 'Img.1' to 'Img.6' in Figure 33, respectively. The results of this experiment confirm the superiority of our model over other models in the segmentation of breast thermography images.

5.4
Discussion about the parameter  Selected breast thermography images for testing with local initial contour. First row: initial contours. Second row: ground truth

FIGURE 26
Selected breast thermography images for testing with local initial contour. First row: initial contours. Second row: ground truth

FIGURE 27
Comparison experiments between five models and LSW-AC model for segmenting breast thermography images with local initial contour indicated in Figure 25(a)

FIGURE 28
Comparison experiments between five models and LSW-AC model for segmenting breast thermography images with local initial contour indicated in Figure 25(b)

FIGURE 29
Comparison experiments between five models and LSW-AC model for segmenting breast thermography images with local initial contour indicated in Figure 25(c)

FIGURE 30
Comparison experiments between five models and LSW-AC model for segmenting breast thermography images with local initial contour indicated in Figure 26(a)

FIGURE 31
Comparison experiments between five models and LSW-AC model for segmenting breast thermography images with local initial contour indicated in Figure 26 (b) corresponding are illustrated in each column. Bright regions of a breast thermography image with set = 1 and various are extracted in more detail in Figure 34, and also dark regions (with set = −1) of this image are extracted in Figure 35. Figure 34 shows that by increasing the value of , the sensitivity of the proposed method to smooth edges decreases, and more distinct edges are extracted. This is due to the fact that when = 1, with increasing the value of , the energy function forces bright regions with more difference in local neighbours inside and outside the contour to belong to the inside contour. In addition, when = −1, by increasing the value of , more absolute dark regions are extracted (as shown in Figure 35). Unfortunately, should be adjusted manually, but our method has acceptable performance even with = 0. In proving this, all results of the LSW-AC model in Figures

Robustness analysis for initialization
To demonstrate the LSW-AC model robustness under different initialization, the performance of this method in segmenting two real blood vessel images with different initial contours is evaluated, and the results are illustrated in Figures 36 and 37.
The different initial contours are denoted by red, and shown in Figures 36(a)-(e) and 37(a)-(e). Despite the great difference among these initial contours, the corresponding segmentation results depicted in Figures 36(f) and 37(f) are all capable of accurately capturing the object boundaries and are almost the same. In synthetic and medical images from different modalities, which are examined in Sections 5.2 and 5.3.1, the performance of all methods is dependent on the initial contour. If the wrong initial contour is placed, despite increases in the epoch and changes in the other parameters, the segmentation is failed. This properties is bold in the RSF model [25]. The LIC [28], LCV [30] and LSACM [29] models are less sensitive than the RSF model [25] to the initial contour and the proposed method is much less sensitive than other methods, as confirmed in Figures 36  and 37.
In the segmentation of breast thermography images, the proposed method is non-sensitive to the global initial contour. We examined some global initial contours and the result of our method is the same. The proposed method is less sensitive than other methods in the local initial contour. If no part of the initial contour does not place on the target object, the segmentation is failed. The RSF [25] and the ALF [22] models are very sensitive to both local and global initial contours; with a small change in the initial contour, the results will also change, but in any case, an The LIC [28], LSACM [29] and EWF [31] models are less sensitive to global initial contour and very sensitive to local initial contour. If more than half of the initial contour does not place on the target object, the segmentation is failed.

Discussion
Here, the usability, limitations and strategies to reduce the uncertainty of the proposed method, and the advantages and disadvantages of other compared methods, are discussed. Since the proposed method has a high ability to segment heterogeneous images with smooth edges, it can segment breast thermography images well and extract the boundaries of abnormal regions and vessels in these images. According to experts, accurate extraction of abnormal regions and blood vessels in these images helps to diagnose the disease.
The results show the independency of the proposed method to window size in the segmentation of the breast thermography image. The applied method offers excellent results with just the first part of data term in energy function. On the other hand, this method offers excellent results with parameters = 0, = 0 and = 0. In fact, the strength of the proposed method is due to the new weighting method in the definition of f in and f out . The results also confirm the insensitivity of the proposed method to the initial contour in the segmentation of these images; and it is less sensitive than the compared methods in the segmentation of other images. However, in the segmentation of other images, such as synthetic and other medical images, it depends on the proper choice of ; and also is sensitive to the initial contour, although it is less sensitive than the compared methods. To reduce uncertainty, it is necessary to define depending on the statistical information of the image or get it by adaptive methods using learning images in future works. Obviously, the value will be different for different databases.
In the following, we discuss the advantages and disadvantages of the proposed method over the compared methods. The RSF model [25] is more sensitive than other methods to the initial contour and the adjustment of parameters. Also, the window size affects the results drastically. This method extracts more areas than other methods in breast thermography images and stops at more smooth edges, but most of the selected areas are not meaningful, which are increased by decreasing the window size. The LIC model [28] is very sensitive to the window size, but it is less sensitive to the initial contour than the RSF model [25] and extracts more definite edges. In the segmentation of the breast thermography images, although LIC model do not extract meaningless areas, but cannot extract smooth edges too. If the image regions have a certain brightness level difference, despite the heterogeneity, it succeeds in their segmentation but fails in the segmentation of thermography images due to their smooth edges.
The LCV model [30] is not sensitive to the initial contour because it acts as a global model. It is similar in performance to the LIC model [28] but weaker in segmenting images with severe heterogeneity and smooth edges. The LSACM model [29] performance depends on the initial contour but not as much as the RSF model [25]. This model is more successful than the LIC [28] and LCV [30] models in segmenting heterogeneous images, but the results strongly depend on the window size; and it is not as good as the proposed method for extracting smooth edges. The ALF model [22] performance is as same as the RSF model [25]. It is sensitive to initial contour and adjusting parameters, and extract meaningless areas. The EWF model [31] performance with the global initial contour is better than other methods, except for the proposed method. This model is sensitive to the local initial contour. Although the EWF model [31] performance in segmenting the inhomogeneous images is acceptable, the proposed method is more successful in extracting the exact boundaries of regions with obvious edges in heterogeneous images.

CONCLUSION
This paper proposed a local region-based ACM named LSW-AC method to segment images with intensity inhomogeneity. This method is based on a local weighted average descriptor. According to this proposal, the energy value of the centre pixel is a weighted function of its neighbour's intensity. This makes the algorithm able to segment regions with smooth edges in inhomogeneous images; the sensitivity of the proposed method to smooth edges can be controlled by adjusting a parameter.
To show the capability of the algorithm, it was applied to the breast thermography images. The other advantage of the proposed method is that in other local level-set models, all edges in the image are extracted regardless of the purpose of segmentation; yet, in the proposed method, the goal of segmentation (dark or bright region extraction) can be chosen by the user. The LSW-AC model is compared with the well-known level-set methods for inhomogeneity image segmentation, such as the RSF [25], LIC [28], LCV [30], LSACM [29], ALF [22] and EWF [31] models on synthetic images and medical images. The proposed method successfully segments images with intensity inhomogeneity and has admissible performance in comparison with other methods in this field. The main superiority of the LSW-AC model is its capacity to segment the breast thermography images which contain ambiguous objects in the presence of intensity inhomogeneity. The segmentation results are quantitatively evaluated by the accuracy, F-score, precision and recall criteria. The results show values of 0.8, 0.62, 0.73 and 0.82 for the mean accuracy, F-score, precision and recall measures on the segmentation of breast thermography images, respectively. Simulation results verify the effectiveness and superiority of the method.