Active contours driven by local and global fitted image models for image segmentation robust to intensity inhomogeneity

This paper presents a region-based active contour method for the segmentation of intensity inhomogeneous images using an energy functional based on local and global fitted images. A square image fitted model is defined by using both local and global fitted differences. Moreover, local and global signed pressure force functions are introduced in the solution of the energy functional to stabilize the gradient descent flow. In the final gradient descent solution, the local fitted term helps extract regions with intensity inhomogeneity, whereas the global fitted term targets homogeneous regions. A Gaussian kernel is applied to regularize the contour at each step, which not only smoothes it but also avoids the computationally expensive re-initialization. Intensity inhomogeneous images contain undesired smooth intensity variations (bias field) that alter the results of intensity-based segmentation methods. The bias field is approximated with a Gaussian distribution and the bias of intensity inhomogeneous regions is corrected by dividing the original image by the approximated bias field. In this paper, a two-phase model is first derived and then extended to a four-phase model to segment brain magnetic resonance (MR) images into the desired regions of interest. Experimental results with both synthetic and real brain MR images are used for a quantitative and qualitative comparison with state-of-the-art active contour methods to show the advantages of the proposed segmentation technique in practical terms.


Introduction
Image segmentation is an important stage in image processing and computer vision [1]. Intensity inhomogeneity is one of the well-known problems in image segmentation, which arises from the imperfections of the image acquisition process or due to external interferences. It manifests as a smooth intensity variation across the image that complicates the segmentation of the objects contained in it. For instance, in medical image analysis, segmentation and registration stages are highly sensitive to spurious variations of image intensity. Therefore, the complexity of intensity inhomogeneity can lead to false results and assumptions that can be critical a1111111111 a1111111111 a1111111111 a1111111111 a1111111111 for decision making by both doctors and radiologists. This is why numerous methods for intensity inhomogeneity correction have been proposed in the past [2].
Thus, intensity inhomogeneity correction is often a pre-processing stage necessary for achieving better image segmentation. In turn, correct segmentation makes intensity inhomogeneity correction rather trivial. Actually, both intensity inhomogeneity correction and segmentation can be viewed as two intertwined processes. In segmentation-based intensity inhomogeneity correction methods, both processes are merged such that they benefit from each other.
The techniques that aim to avoid intensity inhomogeneity in the image acquisition process are known as prospective methods. They are only capable of correcting intensity inhomogeneity caused by the imaging device, not being able to segment the objects affected by intensity inhomogeneity. On the other hand, techniques that can correct an image and also segment the objects affected by intensity inhomogeneity are called retrospective methods. Retrospective methods are further classified according to the image segmentation method they apply into: filtering methods [3,4], surface fitting methods [5,6], histogram-based methods [7,8], and active contours [9][10][11][12][13][14][15]. Segmentation-based methods [10][11][12] are the most versatile, since they unify segmentation and bias correction in a single framework. In these methods, segmentation and bias correction are applied in conjunction to benefit from each other.
Edge-based active contour methods typically use image gradient information to define an inflating balloon force that is used in the curve evolution process [20]. However, in case of intense noise or weak edges, edge-based active contours can hardly converge to the right contours. Therefore, edge-based methods are not suitable for that kind of images.
Alternatively, region-based active contour methods use statistical and curvature information from the image in the formulation of the energy functional. They can be further characterized into global [22][23][24][25][26] and local [27][28][29][30][31][32][33][34] methods. Mumford and Shah [22] devised a global region-based active contour method by assuming image homogeneity. Thus, traditional active contour methods based on [22], such as the active contours without edges (ACWE) method [23], cannot segment images with intensity inhomogeneity. These methods usually compute intensity averages over the whole image. Therefore, they cannot deal with small changes between distinct regions nor segment objects with weak or blurred boundaries. On the other hand, local-based methods [27,28] are able to distinguish small changes between the background and the foreground. Therefore, they are suitable for intensity inhomogeneous images.
A region-based active contour model able to process image information in local regions was proposed by Li et al. in [27,28]. The major contribution of that work was the introduction of a local binary fitting (LBF) energy with a kernel function that enables the extraction of accurate local image information. Therefore, that model can be used to segment images with intensity inhomogeneity, which overcomes the limitation of piecewise constant models [23]. Fig 1(a) shows that a traditional region based active contour method (such as ACWE) is unable to segment an image with an intensity inhomogeneous object. However, a local active contour method (such as LBF) is able to properly segment such object as shown in Fig 1(b). Taking Fig 1 as a reference, it can be concluded that active contour methods which use local statistical information of an image are able to produce fairly acceptable segmentation results in the context of intensity inhomogeneity.
A region-based active contour model with a variational level-set formulation for image segmentation was presented in [29]. It uses local intensity means for computing the level-set curve. Local image intensities are described by local Gaussian distributions (LGD) to guide the motion of the contour toward the object boundaries. Therefore, it can be used to segment images in the presence of intensity inhomogeneity and noise. In particular, the model is able to distinguish regions with different intensity variances.
A local active contour model for segmenting images with intensity inhomogeneity was proposed by Zhang et al. in [30]. Local image information is used to define a local image fitting (LIF) energy functional, which can be interpreted as a constraint on the differences between the fitting image [27,28] and the original image. Furthermore, a new method is used to regularize the level-set function by using Gaussian kernel filtering after each iteration. In addition, re-initialization of the level-set curve is not required.
In [25], a region-based active contour method is formulated by using a global signed pressure force (SPF) function in the energy function. The global SPF function is defined by using global intensity means from the ACWE model [23]. A Gaussian kernel is used to regularize the level-set and prevent re-initialization.
Alternatively, a region-based active contour method is formulated in [31] in the context of intensity inhomogeneity by utilizing local intensity means. It uses an SPF function based on a local fitted image in its energy formulation in order to segment images with intensity inhomogeneity. A Gaussian kernel is used to smooth the level-set function after every step. Therefore, this method does not require re-initialization.
A variational level-set approach for bias correction and segmentation (VLSBCS) for images corrupted with intensity inhomogeneity was proposed by Li et al. in [9,10]. The computed bias field is intrinsically ensured to be smooth by the data term in the variational formulation, without any additional effect to maintain the smoothness of the bias field.
A local statistical active contour model (LSACM) for image segmentation in the presence of intensity inhomogeneity was proposed by Zhang et al. in [11,12]. The inhomogeneous objects are modelled as Gaussian distributions of different means and variances, and a moving window is used to map the original image into a new domain in which the intensity distributions of inhomogeneous objects are still Gaussian but better separated. The means of the Gaussian distributions in the transformed domain can be adaptively estimated by multiplying the bias field with the original signal within the window. A statistical energy functional is then defined for each local region, which combines the bias field, the level-set function, and the constant approximating the true signal of the corresponding object.
The present paper proposes a new region-based active contour method that incorporates both local and global fitted images in the energy functional. The local term helps segment objects with intensity inhomogeneity, whereas the global term accelerates the evolution of the contour over smooth homogeneous regions. The new energy functional is formulated with the assumption that the local fitted image from [30] can be divided into two different local and global components. In the gradient descent solution of the proposed energy functional, both local and global signed pressure force (SPF) functions are introduced. The local SPF function is formulated by using local image differences and deals with inhomogeneous regions. In turn, the global SPF function is formulated by using the global image difference in order to segment homogeneous regions while reducing the convergence time of the level-set curve. The replacement of the local and global image differences by their respective SPF functions makes the gradient descent solution more stable. Finally, a Gaussian kernel is used to regularize the level-set curve, which also avoids the computationally expensive re-initialization. In this paper, the proposed two-phase model is also extended to a four-phase model in order to successfully segment a brain MR image into three regions: white matter (WM), grey matter (GM) and cerebrospinal fluid (CSF) regions, which is not possible with a two-phase model. Experiments with both synthetic and real images demonstrate that the proposed method yields better segmentation results and offers bias-corrected images with more detail than state-of-the-art methods.
This paper is organized as follows. The theoretical foundations are discussed in section 2. The proposed method is described in section 3. Experimental results and comparisons are shown in section 4 using both synthetic and real brain magnetic resonance images as a practical application scope. Quantitative analysis is presented in section 5 using a public database of brain anatomical models [37]. Finally, conclusions and further research lines are given in section 6.

Mumford-Shah energy model
In the image segmentation problem, Mumford and Shah proposed an active contour method to find an optimum piecewise smooth approximation function u of an image. Let I: O ! R 2 , where u varies within each sub-region O i of the image domain smoothly, and rapidly or discontinuously across the boundaries of O i in order to approximate a closed curve C & O along the object boundary. They proposed the following energy functional: where L(C) is the length of the curve C, and μ and v ! 0 are fixed parameters. The unknown contour C and the non-convexity of the above energy functional make it difficult to minimize it. Some alternative methods were later proposed to simplify or modify the above functional, as described below.

Chan-Vese model
Chan and Vese [23] proposed an active contour method based on the Mumford and Shah model [22]. Let I: O ! R 2 be an input image, ϕ: O ! R 2 a level set, and C a closed curve corresponding to the zero level set: C = {x 2 O|ϕ(x) = 0}. The following energy functional is defined: where μ ! 0, v ! 0, (λ 1 , λ 2 )>0 are fixed parameters and H (ϕ) is the regularized version of the Heaviside function: Parameter controls the smoothness of the Heaviside function. For ! 0, the Heaviside function is the ideal unit step function. Parameter μ scales the Euclidian length of the curve C in (Eq 2), which is used to regularize the contour. In turn, parameter v scales the area term in (Eq 2), which is used to compute the area of the region inside C. Constants m 1 and m 2 approximate the image intensities inside and outside contour C, respectively. By minimizing the above energy functional with respect to ϕ through steepest gradient descent [38], the following gradient descent flow is obtained: where δ (ϕ) is the regularized Dirac function: In addition to specifying the smoothness of the Heaviside function (3), parameter also controls the width of the Dirac function. For ! 0, the Dirac function is the ideal unit impulse. By minimizing (Eq 2) with respect to m 1 and m 2 while keeping ϕ constant, m 1 and m 2 are defined as: ; The data fitting term − λ 1 (I − m 1 ) 2 + λ 2 (I − m 2 ) 2 in (Eq 4) plays a key role in the curve evolution. Parameters λ 1 and λ 2 weight the first and the second term, respectively. In most cases, λ 1 = λ 2 and v = 0 when the image is smooth and the signal-to-noise ratio is low. Parameter μ is a scale factor. If it is low enough, small objects are likely to be extracted. Alternatively, if it is high, big objects can be detected [23]. Obviously, m 1 and m 2 in (Eq 6) are related to the global properties of the image contents inside and outside curve C, respectively. However, such a global image segmentation is not accurate if the image intensity inside and/or outside the curve is inhomogeneous.

Local Binary Fitted (LBF) model
Li et al. [27,28] proposed the LBF model by embedding local image information in the energy functional. LBF is able to segment images with intensity inhomogeneity. The basic idea is to introduce a Gaussian kernel function to define the LBF energy functional as follows: where (λ 1 , λ 2 ) > 0 are fixed parameters, I: O ! R 2 is an input image, K σ is a Gaussian kernel with standard deviation σ, and f 1 and f 2 are two smooth functions that approximate the local image intensities inside and outside curve C, respectively.
In LBF, C & O can be represented by the zero level-set of a Lipschitz function ϕ: O & R. Minimizing the energy functional E LBF with respect to ϕ, the gradient descent flow is defined as follows: where e 1 and e 2 are defined as follows: In (Eq 8), parameters λ 1 and λ 2 weight the two integrals over the regions inside and outside curve C, respectively, which are defined in (Eq 9). In most cases, λ 1 = λ 2 . Functions f 1 and f 2 are the local intensity means inside and outside curve C, which are computed in a local neighbourhood: Functions f 1 and f 2 in (Eq 10) represent weighted averages of image intensities in a Gaussian window inside and outside the curve, respectively. In that way, the LBF model can handle images with intensity inhomogeneity.
The standard deviation σ of the Gaussian kernel plays an import role in practical applications. It behaves as a scale parameter that controls the region-scalability from the small neighbourhood to the whole image domain [28]. It must be properly chosen according to the images. A too small σ may cause an undesirable result, whereas a too large σ will yield a high computational cost.
In order to guarantee a stable evolution of the level-set function, the distance regularized term defined in [21] is incorporated into (Eq 8). Moreover, the Euclidean length term is used to regularize the zero contour of ϕ. Finally, the total variational formulation is as follows: where γ is a scaling parameter of the distance regularized energy penalization term that controls the energy leakage and μ is a scaling parameter of the Euclidian length of the curve.

Local Image Fitted (LIF) model
In [30], a local image fitting energy functional is proposed in which the difference between the fitted image and the original image is minimized as follows: where I LFI is the local fitted image defined as: where ), and f 1 and f 2 are local intensity means in the given image (Eq 10). H (ϕ) is the regularized version of the Heaviside function (3). Using the calculus of variations and steepest gradient descent [38], E LIF in (Eq 12) is minimized with respect to ϕ to yield the corresponding gradient descent flow: where δ (ϕ) is the regularized Dirac function (11).

Variational Level-Set approach for Bias Correction and Segmentation (VLSBCS)
In [9,10], a variational level-set method for the segmentation and bias correction of images corrupted with intensity inhomogeneity is formulated. In this method, the computed bias field is ensured to be smooth exclusively through the data term defined in the energy functional formulation. This method is based on an image model commonly used to describe images with intensity inhomogeneity: where I(x) is the input image with intensity inhomogeneity, J(x) is the image to be restored without intensity inhomogeneity, b(x) is the bias field, which represents the modulation of the restored image with the intensity inhomogeneity, and n(x) is noise. The model assumes that the being a sub-region of O. In traditional active contour methods, the image domain O is assumed to be divided into N disjoint regions, O i , i = 1, 2, . . .., N, based on the input image I(x). However, due to the intensity inhomogeneity caused by the bias field b(x), the measured intensities are not separable by using traditional intensity-based segmentation methods.
In [9,10], a K-means clustering method based on the minimization of the following objective function is proposed: where b(x) is the approximated bias field and c i is the computed intensity mean in the presence of intensity inhomogeneity for each of the phases of the two-phase active contour method (i = 1, 2). Term b(x)c i can be considered to be the approximation of the means m i of the clusters corresponding to each of the phases of the two-phase active contour method: Directly minimizing the above energy functional with the partition fO i g N i¼1 as a variable is not feasible. Therefore, multiple level-set functions are used to represent a partition fO i g N i¼1 . In the simplest case of N = 2, the image domain is partitioned into two regions {O 1 , O 2 }. These regions are separated by the zero-level contour of a function ϕ, that is, O 1 ffi {ϕ > 0} and O 2 ffi {ϕ< 0}. Using the Heaviside function H , the energy E in (Eq 16) becomes: where M i is the characteristic function of a given image based on the regularized Heaviside function (3). When the image domain is partitioned in two regions . By taking the Gateaux derivative (the first order functional derivative) [38] of the energy E, the following expressions for b(x) and c i are obtained: bðxÞ ¼ For N = 4, the image is partitioned into four regions

Local Statistical Active Contour Model (LSACM)
In order to segment and correct bias in an intensity inhomogeneous image a local statistical active contour model is devised in [11,12], in which the inhomogeneous objects are modelled as Gaussian distributions of different means and variances. The means of the Gaussian distributions are adaptively estimated by multiplying the bias field by the original signal within a Gaussian window. Let I: O ! R 2 be the input image, F: O ! R 2 a level set function, which yields a closed curve C = {x 2 O|F(x) = 0}, b(x) is the approximated bias field, c i and σ i are intensity means and variances, respectively. F is a function of one level set ϕ for a two-phase segmentation and F is a function of two level sets (ϕ 1 , ϕ 2 ) for four-phase segmentation. Based on the above assumptions, an energy functional is defined as: where K β (x, y) is a Gaussian kernel with a standard deviation β. For N = 2, the energy functional in (Eq 20) acts as a two-phase active contour method (with one level set). The two characteristic terms are: M 1 (F) = H (ϕ) and M 2 (F) = 1 − H (ϕ)). In turn, for N = 4, the energy functional in (Eq 20) acts as a four-phase active contour method (with two level sets ϕ 1 and ϕ 2 ). The four characteristic terms are defined as: ). In (Eq 20), bias correction b(x), intensity means c i and variance σ i are defined as: bðxÞ ¼

Proposed method
The generally accepted assumption on intensity inhomogeneity is that it manifests itself as a smooth spatially varying function that alters image intensities that otherwise would be constant for a same object regardless its position in an image. In its simplest form, the model assumes that intensity inhomogeneity is multiplicative or additive, that is, the intensity inhomogeneity field multiplies or adds to the image intensities. Most frequently, the multiplicative model has been used as it is consistent with the inhomogeneous sensitivity of the reception coil of magnetic resonance imaging devices. Therefore, a multiplicative model has been considered for the bias field estimation. Let I: O ! R 2 be the input image with intensity inhomogeneity, J(x) the restored image without intensity inhomogeneity, b(x) the bias field approximated with a Gaussian distribution, and n(x) additive noise (Eq 15). J(x) is assumed to be constituted by k piecewise constant image components. I(x) can thus be represented as: where c i are intensity means computed for the piecewise regions fO i g N i¼1 and M i is the characteristic function of each region.
In order to segment intensity inhomogeneous images, the following energy functional is defined: where E LGFI (ϕ) is a term based on a local and global fitted image, which will be explained later in this section. μ ! 0 and v ! 0 are fixed parameters. L g (ϕ) and A g (ϕ) are length and area terms, respectively [21]: The energy functional A g (ϕ) is introduced to speed up the curve evolution. It is the area of the region O À 0 ¼ fðx; yÞj0ðx; yÞ < 0g [21]. A g (ϕ) can be viewed as the weighted area of O À 0 . In (Eq 27), g(I) is a positive monotonously decreasing edge indicator function ranging in [0, 1]: E LGFI is defined according to the following reformulation of (Eq 12): Two-phase active contours formulation In (Eq 29), let I bLFI (x) be a two-phase bias local fitted image and I GFI (x) a global fitted image, using a level set ϕ, which are defined as: where c 1 and c 2 are local intensity means and m 1 and m 2 are global intensity means of the given image as defined in Eqs (19) and (6), respectively. M 1 = H (ϕ) and M 2 = (1 − H (ϕ)), where H (ϕ) is the regularized Heaviside function (3). Models based on global intensity means are not sufficient to solve intensity inhomogeneity segmentation problems. In turn, models based on local intensity means have a very high time complexity. Using both local and global fitted images, the proposed method is able to tackle the intensity inhomogeneity problem with a reduced time complexity. As discussed earlier, an energy functional only based on a global fitted image cannot segment images with intensity inhomogeneity since global intensity means are computed under the assumption that the input image is homogeneous. Therefore, the bias field b(x) from (Eq 18) is only introduced in the local fitted image difference.
By using calculus of variations and steepest gradient descent [38], E LGFI in (Eq 29) is minimized with respect to ϕ, leading to the corresponding gradient descent flow (refer to the appendix for a detailed derivation): @0 @t ¼ ððIðxÞ À I bLFI ðxÞÞðm 1 À m 2 Þ þbðxÞðIðxÞ À I GFI ðxÞÞðc 1 À c 2 ÞÞd ð0Þ; where b(x) is the bias field defined in (Eq 18), and {m 1 , m 2 } and {c 1 , c 2 } are global and local intensity means defined in Eqs (6) and (19), respectively. The above gradient descent flow is not stable around object boundaries. Moreover, it does not yield proper segmentation when the boundaries between inhomogeneous objects and the background are undistinguishable. (I − I bLFI ) (m 1 − m 2 ) and (I − I GFI ) (f 1 − f 2 ) generate large values that cross a maximum threshold resulting in an unstable contour. Therefore, (I − I bLFI ) and (I − I GFI ) are replaced by local and global signed pressure force (SPF) functions, which normalize values to [-1,1] to obtain a smooth version of the gradient descent flow: where the proposed local and global SPF functions are defined as: By using the calculus of variations and steepest gradient descent, the solution of E g,LGFI from (Eq 25) using Eqs (26) and (27) is: The two scaling parameters λ 1 and λ 2 in Eqs (33) and (36) are used to tune the model to different types of images.

Four-phase active contours formulation
In (Eq 29), let I bLFI (x) be a four-phase bias local fitted image and I GFI (x) a global fitted image, using two level sets F(ϕ 1 , ϕ 2 ), which are defined as: where  H (ϕ 2 )), which are the characteristic terms that partition a given image into four segments. b(x) is the bias term defined for the four-phase energy functional. c 1 , c 2 , c 3 and c 4 are local intensity means from VLSBCS [9,10] and m 1 , m 2 , m 3 and m 4 are global intensity means from the multiphase level set framework (MLSF) [24], which is a multiphase extension of the two-phase energy functional defined by Chan-Vese [23]. By substituting the four-phase fitted equations in (Eq 29) using steepest gradient descent [38] the following solutions are obtained for ϕ 1 and ϕ 2 (for detailed formulation see appendix B): Four-phase local and global SPF functions can be obtained by substituting I bLFI and I GFI from Eqs (37) and (38) in Eqs (34) and (35), respectively. By replacing the four-phase local and global fitted differences with their respective SPF functions, Eqs (39) and (40) are updated as follows: The SPF functions defined in Eqs (34) and (35)  Since the local SPF function uses local intensity means, it is able to distinguish small changes at the boundaries of intensity inhomogeneous objects. Since the local intensity means are computed in a local neighbourhood, the positive and negative values are distributed close to the inner and outer boundaries of the image contours. In the rest of the image, the SPF function becomes zero. In Fig 3, white shows negative values of the local SPF function, black shows positive values of the local SPF function, and blue represents the region where the local SPF function becomes zero.
In contrast, the global SPF function is unable to segment intensity inhomogeneous regions, since global intensity means are computed all over the image. It has positive and negative values inside and outside the region of interest, and is zero at its boundary, as shown in Fig 2. In level-set methods, it is essential to initialize the level-set function ϕ as a signed distance function (SDF) ϕ 0 . If the initial level-set function is significantly different from the SDF, re-initialization schemes are unable to re-initialize the function to the SDF. In the proposed formulation, not only is the re-initialization procedure completely eliminated, but the level-set function ϕ no longer needs to be initialized as an SDF. The initial level set function ϕ 0 is  LGFI models based active contour for intensity inhomogeneous image segmentation PLOS ONE | https://doi.org/10.1371/journal.pone.0174813 April 4, 2017 13 / 34 defined as: where ρ is a positive constant, O 0 is the inner region of the initial contour, O is the image domain and @O 0 refers to the initial contour. The stages of the proposed method can be summarized as: 1. Initialize the level-set function ϕ to ϕ 0 using (Eq 43) and the bias field to b(x) = 0.

Calculate L SPF (I) and G SPF (I) using Eqs
5. Solve the partial differential equation (PDE) of ϕ using (Eq 36).
6. Regularize the level-set function ϕ at time t by applying a Gaussian kernel G χ , i.e. ϕ = G χ Ã ϕ, where χ is the standard deviation of the regularizing Gaussian kernel.
7. Check whether the regularized level-set function is stationary. If not, iterate from step (c).
The steps described above correspond to the two-phase segmentation algorithm. However, for the four-phase algorithm, these steps are replaced with the variables corresponding to two level sets using their respective definitions and solutions.

Results and comparisons
The proposed method was implemented using MATLAB and run on a 3.4 GHz Intel Core-i7 with 16 GB of RAM, testing it on both synthetic images and real brain magnetic resonance (MR) images of 250 × 250 pixels with 256 grey levels (8bpp). The parameters used for all experiments in this section are shown in Table 1. Fig 4 shows the result of the proposed segmentation method and the comparison with the different state-of-the-art methods that have been tested. In this experiment, we used an image with a single homogeneous object and then progressively changed its intensity distribution to a point at which it is even difficult to manually segment it, thus making the object inhomogeneous.
The first column shows the five input images with the initial contour, whereas the segmentation results are shown using LIF [30] in the second column, LBF [27,28] in the third column, LGD [29] in the fourth column, VLSBCS [9,10] in the fifth column, LSACM [11,12] in the sixth column and the proposed method in the last column, respectively. Visual inspection clearly shows that both the proposed method and LBF provide the best segmentation results. LIF also yields acceptable segmentation results, although the final contour in this method is not quite smooth along the object boundaries. Segmentation results of both LSACM and LGD show that they are not able to strictly find the object boundary. Moreover, the contour in LGD is also stuck in the background, which is undesirable. VLSBCS properly segmented the first two images, but its segmentation results are not acceptable for the last three images. In LGD, σ was set to 10 for all experiments in Fig 4, since with a small value of σ, this method is unable to segment the objects in all images. For all the examples in Fig 4, the parameters of all methods were kept constant. The only change is the initial position of the level set. Fig 5 shows the experiments conducted with synthetic images with different types of region properties. The first column shows the input images with their respective initial contours. In the first row, both the object and the background are homogeneous. In the second row, the background is homogeneous while the object is inhomogeneous. In the third row, the background is inhomogeneous while the object is homogeneous. In the fourth row, both the background and the object are inhomogeneous. In the last row, the background is homogeneous and there are different inhomogeneous regions with one of the regions having an extra inhomogeneous region within it.
The second column shows the segmentation results with LIF [30]. Notice that it is not able to accurately segment the last image. Although this method is able the segment the objects in the first four images, the results are not acceptable because the contour is not quite smooth along the boundaries of the objects. The segmentation results with LBF [27,28] are shown in the third column. This method is only able to properly segment the first image, while the segmentation results are not acceptable for the other images. The fourth column shows the segmentation results using LGD [29]. This method is able to properly segment the first image. As for the second image, the contour is not quite smooth along the boundary of the object. Although it is able to segment the objects in the third and fourth images, some undesirable contour is stuck in the background. Furthermore, this method is not able to segment the nested inhomogeneous object in the fifth image.
The fifth column shows the segmentation results using VLSBCS [9,10]. This method is able to properly segment the first, second and fourth images. It can segment the object in third image. However, some undesirable contour is stuck in the background. Moreover, this method is not able to properly segment the fifth image. The sixth column shows the results with LSACM [11,12]. This method is able to properly segment the third and fourth images. Although it is able to segment the objects in the first and second images, the final contour is not smooth and does not properly follow the object boundaries. Moreover, this method is unable to segment the nested inhomogeneous object in the fifth image. The last column shows the segmentation results using the proposed method, which is able to properly segment all images. Table 2   In Fig 6, the segmentation and bias correction results using the proposed method (third row) are compared with the ones computed with VLSBCS [9, 10] (first row) and LSACM [11,12] (second row) using real brain MR images as a practical application. The first column shows the input image with the initial contour. The second column shows the final contours for each method. The third column shows the estimated bias field. Finally, the last column shows the bias-corrected image. The proposed method can segment more detailed regions than the other methods, as highlighted by the green arrows in the second column. Moreover, the bias-corrected image using the proposed method has more details than the ones computed with the other methods, as highlighted by the red circles in the fourth column. The corrected image obtained using the proposed method also has more details in the nose area.
In Fig 7, the segmentation results and bias correction using the proposed method (third row) are compared with the ones computed with VLSBCS [9, 10] (first row) and LSACM [11,12] (second row) using real brain MR images. The first column shows the input image with the initial contour. The second column shows the final contours. The third column shows the computed bias field. Finally, the last column shows the bias-corrected image. The results show that the proposed method can segment more detailed regions than the other methods, as highlighted by the green arrows in the second column. Moreover, the bias-corrected image using the proposed method has more details than the ones computed with the other methods, as highlighted by the red circles in the fourth column. Fig 8 shows the effect of the position of the initial level set on the segmentation for all the tested methods. The first column shows the input image with different initial level sets, whereas the segmentation results with LIF [30] are shown in the second column, with LBF [27,28] in the third column, with LGD [29] in the fourth column, with VLSBCS [9,10] in the fifth column, with LSACM [11,12] in the sixth column and with the proposed method in the last column. These results show that the proposed method is not affected by the position of the initial level set and yields the segmentation with the best accuracy. In contrast, the segmentation results of all the tested state-of-the-art methods are affected by the position of the initial level set.  Table 3 shows the number of iterations and CPU time for all the tested methods when applied to the example in Fig 8. The proposed method yields the best performance in the examples shown in rows 2 and 4. It took 2.48 and 1.42 seconds to obtain the final contours for rows 2 and 4, which is significantly lower than the time required by the other methods. In turn, LGD has the best performance for the example in row 1. Thus, LGD took 3.3 seconds while the proposed method took 5.15 seconds to obtain the final contour. In turn, LIF yields the best performance for the example shown in row 3. LIF took 3.86 seconds while the proposed method took 16.06 seconds to obtain the final contour. Fig 9 shows the segmentation result on a synthetic image, which contains three different regions with intensity inhomogeneity, both without noise and after applying additive Gaussian noise. Fig 9(b) and 9(d) show that proposed method is able to properly segment intensity inhomogeneous objects without and with noise, respectively. Fig 9(e) shows the central row intensity profile of the input synthetic image with both clean and noisy data along with the final contour. It shows that the resultant contour followed the object boundaries perfectly. Fig 10 shows some segmentation results by applying the proposed method to different intensity inhomogeneous noisy images. Although noise affected the crispness of edges in the input data, the proposed method is able to yield acceptable segmentation results.

Quantitative analysis
The segmentation of brain MR images into disjoint regions based on white matter (WM), grey matter (GM) and cerebrospinal fluid (CSF) is a well-known problem in brain image analysis. Due to the geometric complexity of the human brain cortex, manual slice-by-slice segmentation is cumbersome and time consuming [1]. Thus, numerous methods have been devised to solve such problems. Active contours are quite popular in this context. Because of the complex intensity inhomogeneous regions, brain MR images are hard to be successfully segmented with high accuracy [39]. Therefore, this is a good test bench to test the proposed method in a practical application and compare it with other state-of-the-art methods.

Two-phase active contours
This section shows segmentation results for all tested two-phase active contour methods using 2D brain MR images from a public database of 20 brain anatomical models [37]. All images have 250 × 250 pixels and 8 bits per pixel.  Active contour methods behave differently for different types of images. Because the images used in this section have different characteristics compared to the ones used in results and comparison section, the parameters had to be tuned in order to obtain the best possible segmentation results. The parameters used for all experiments in this section are shown in Table 4.
In order to partition a brain MR image into WM and GM regions, the segmentation result is split into two regions based on two phases: ϕ> 0 and ϕ< 0. The WM and GM regions represent the brain region, which is the region of interest, while the regions outside the brain (e.g., skull, fat and vacuum) can be taken as irrelevant regions. Therefore, we manually extracted the brain area to segment the WM and GM regions, removing the other irrelevant regions out of the brain. Fig 11 shows the WM and GM regions computed from the two phases of the proposed method and the comparison with the ground truth (GT). In the first row of Fig 11, the first image shows the input image with the initial contour. The second image shows the final contour using the proposed method. The third image shows a manually defined brain mask. The main purpose of the brain mask is to extract the brain region in order to carefully analyse and compare the segmented WM and GM regions with their respective ground truths. The last image in the first row shows the final contour after scaling with the brain mask. Let ϕ(x, y) be the final computed contour shown in the second column of the first row, and m(x, y) the manually defined brain mask shown in the third column of the first row. The scaled final contour ξ(x, y), which is shown in the last column of the first row, is computed as ξ(x, y) = ϕ(x, y) m(x, y). In the second row of Fig 11, the first image shows the WM region computed from the positive phase (ξ> 0) of the final contour scaled with the brain mask. The second image shows the GM region computed using the negative phase (ξ< 0) of the scaled final contour. In the  second row, the third and fourth images show the ground truths of the WM and GM regions, respectively. Fig 12 shows the accuracy analysis of the region of interest in the brain MR images. A total of 100 2D slices from 20 brain anatomical models [37] were used. Five 2D slices from every patient were considered. The WM and GM regions for all methods were computed as depicted in Fig 11. The segmentation accuracy corresponding to the WM and GM regions presented in Fig 12 was obtained as: Where A is the computed WM or GM region after brain scaling and B is the ground truth for that region. Different methods can behave differently based on the type of images. Therefore, five slices from each patient were used and average accuracies for those slices were computed to obtain a representative value for each case. Fig 12 and Table 5 show that the proposed method yields the best segmentation accuracy in most cases for both the WM and GM regions.

Four-phase active contours
A two-phase method is limited to segmenting images into two regions, which is its big weakness in its application to brain MR image segmentation. In the last subsection, all of the twophase tested methods are evaluated for WM and GM region segmentation. However, the segmented GM region was a combination of GM and CSF regions, resulting into a high amount of false positives. In this subsection, the four-phase model of the proposed active contour method is evaluated along with the state-of-the-art four-phase active contour methods with respect to the segmentation accuracy of WM, GM and CSF regions. All methods are tested using the same brain MR image database mentioned in the previous subsection with the same image size and intensity. The parameters used for the proposed method are: λ 1 = 2, λ 2 = 2, μ = 5, σ = 3, χ = 0.45, ρ = 1 = 1.5 and Δt = 1. In brain MR images, WM, GM and CSF regions represent the brain, which is the region of interest. The regions outside the brain (e.g., skull, fat and vacuum) can be assumed to be irrelevant regions. In order to remove those unwanted regions, it is necessary to strip the skull from the brain MR image using a manually drawn brain mask. A brain mask is used as shown in Fig  11, although it is used for the four-phase method. Let ϕ 1 (x, y) and ϕ 2 (x, y) be the final computed contours for two level sets, m(x, y) be the manually defined brain mask and ξ 1 (x, y) and ξ 2 (x, y) scaled final contours with the brain mask which are computed as: ξ 1 (x, y) = ϕ 1 (x, y)m (x, y) and ξ 2 (x, y) = ϕ 2 (x, y)m(x, y). By using the proposed method, the four regions are computed as follows: . In brain MR images, R 1 , R 2 and R 3 regions usually refer to WM, GM and CSF regions, respectively, and R 4 is an empty region, which is discarded. Fig 13 shows the accuracy analysis of the regions of interest (i.e., WM, GM and CSF regions) in the brain MR images. A total of 100 2D slices from 20 brain anatomical models [37] were used. Five 2D slices (namely 150, 175, 200, 225 and 250) from every patient were considered. The WM, GM and CSF regions are segmented using MLSF, VLSBCS, LSACM and the proposed methods. The accuracy of WM, GM and CSF regions for the mentioned four-phase active contour methods are computed using (44). In (44), A is the computed WM, GM or CSF region and B is the respective ground truth. Fig 13 and Table 6 show that the proposed method yields the best segmentation results for GM and CSF regions. In turn, MLSF method yields the best segmentation results for the WM region with an accuracy of 92.52%. The proposed method yields an accuracy of 91.02% for the WM region, which is 1.5% less than the one with the MLSF method. LSACM and VLSBCS methods yield unsatisfactory segmentation results compared to both the proposed and the MLSF method. Table 6 also shows the CPU time comparison between the evaluated methods. It shows that MLSF is the quickest among the compared four-phase active contour methods. It took an average of 15.12 seconds to get the final segmentation result. In turn, the proposed method took an average of 19.01 seconds to fully converge, which is approximately 4 seconds more than the MLSF method.

Comparison with brain MR image segmentation softwares
In this section, the segmentation results of the proposed method are compared with three alternative open source brain MR image segmentation softwares: SPM [40,41], LSF [42,43] and BrainSuite [44,45] using the Brain Web database. In order to compare the segmentation results, the brain region was extracted by stripping the skull using a brain mask. Fig 14 shows a skull stripped brain region and the visual comparison of the segmented regions with their  LGFI models based active contour for intensity inhomogeneous image segmentation respective ground truth. It shows that all the compared methods yield similar segmentation results from a qualitative point of view. Table 7 shows the segmentation accuracy of the evaluated methods using two similarity metrics. Both the mean and standard deviation of the evaluated metrics are considered for all three brain regions, i.e., WM, GM and CSF. These similarity metrics are the Jaccard index [46]   and the Dice coefficient [47], which are frequently used when the ground truth of the regions of interest is available. These similarity metrics are defined as: where S is the segmented region and G its respective ground truth. Table 7 shows that the proposed method yields the best segmentation accuracy using both similarity measures for all three brain regions, i.e., WM, GM and CSF. For the GM region, if we consider the mean error (standard deviation) then the Dice coefficient computed using SPM is 0.95, which is the same as the proposed method. However, SPM yields a Jaccard index of 0.91, which is 0.01 more than the Jaccard index computed by the proposed method.

Conclusion
This paper proposes a new region-based active contour method for image segmentation and bias correction by using an energy functional based on both local and global fitted images. In order to minimize that energy functional, the square image fitted difference is formulated by using The energy functionalboth local and global fitted differences. In the gradient descent solution, both the local and global image differences are replaced by local and global signed pressure force (SPF) functions. Finally, a Gaussian kernel is applied to regularize the curve at each step and avoid the computationally expensive re-initialization.
The main contribution of this paper is the formulation of a new energy functional from the LIF method [30] and the modification of the attained gradient descent solution with new SPF functions based on local and global fitted images to make the solution more stable. Qualitative and quantitative analysis show that the proposed method yields significantly better segmentation results and correction of homogeneous regions than alternative state-of-the-art methods. MR images have been used as a practical test bench.
One of the drawbacks of a local fitted region-based active contour method is its high time complexity. In future work, we aim to formulate a new region-based active contour method by Table 7. Segmentation accuracy of WM, GM and CSF regions for the proposed method and the evaluated brain segmentation softwares.