Introduction

Image segmentation is a process of separation of an image into distinct homogenous regions [1]. Quality of image segmentation directly affects success of analyzing and interpreting images. Segmentation of MR brain images is a critical task in clinical diagnosis [2], surgical planning [3], and treatment procedure [4]. However, an accurate segmentation is a persistent problem, mainly due to low tissue contrast and unclear boundaries caused by partial volumes. Manual segmentation of brain images is a process of determining by hand drawing the borders of different regions of interest straightly onto the raw images which is often performed by medical experts. Meanwhile, manual segmentation of MR images is labor-intensive, is time-consuming, and is prone to errors because of poor hand-eye coordination and operator interpretation [5]. The noticeable advantage of an accurate automatic segmentation of MR brain images lies in the elimination of human error during this procedure. Therefore, automatic segmentation of MR brain images according to tissue types of white matter (WM), gray matter (GM), and cerebrospinal fluid (CSF) has become an active area of research nowadays. Moreover, volumetric analysis of different regions of the brain may bring valuable information. In particular, volume calculation of gray and white matter is of major interest, such that brain tissue classification is vital in study of neurodegenerative disorders for instance Parkinson, Alzheimer, or post-traumatic syndrome [6].

Thresholding is a process of providing binary images out of grayscale ones by setting pixels with intensity below a known threshold to zero and pixels above that to one. Due to its simple comparison technique and computational efficiency, thresholding is considered to be one of the most popular techniques in performing image segmentation. In an image, if target and background are markedly distinct, histogram of the image will be bimodal and then valley bottom of histogram can be easily chosen as a threshold point. However, in most real images, there is not a noticeable mark between the target and the background. In this paper, a novel scheme of ant colony optimization (ACO) algorithm has been introduced to effectively obtain optimal threshold. Our proposed algorithm takes advantages of textural feature to define different direction probabilities. In order to enhance the accuracy, a two-stage post-processing based on homogeneity values is also implemented. To the best of our knowledge, it is the first work in segmentation of MR brain images by the use of meta-heuristic algorithms, which distinguishes between thalamus and white matter. The proposed method is tested on a set of MR brain images, and results are compared to K-means and expectation maximization (EM) and other meta-heuristic algorithms including artificial bee colony (ABC) [7] and particle swarm optimization (PSO) [8].

In this paper, an improved segmentation method of MR brain images by the use of ACO algorithm is presented. Firstly, a review of related work and an introductory presentation of ACO algorithm are given. Then, the proposed algorithm and its novelty are presented. Afterward, experimental results and performance evaluation are discussed in detail. Finally, the paper is concluded and possible further measures to alleviate image segmentation are discussed.

Related Work

Over the last decade, there has been an increasing attention in automatic image segmentation and numerous algorithms have been introduced. Advances made by automated segmentation methods decrease the time devoted to this process and make such methods practical [9]. Among these methods, thresholding is one of the most important tools in image segmentation. As the number of levels required increases, the computational time and complexity of thresholding problems impose significant challenge [10].

Thresholding methods can be classified into parametric and non-parametric types. In parametric approaches, the probability density function of each class is assumed to be a Gaussian distribution. Therefore, the objective is performing an efficient estimation of the parameters for having a best fit to the given histogram. It occasionally drives to a non-linear optimization problem, which is time-consuming to solve [11]. On the other hand, non-parametric approaches find an optimal threshold based on some discriminating criteria such as entropy, minimum error, and between class variance. Non-parametric methods are easier to implement and computationally more efficient [10].

Among non-parametric approaches, popular Otsu’s method [12] chooses the optimal threshold by maximizing the between-class variance and Kapur [13] finds the best thresholding using the entropy of histogram. These methods are capable of being easily implemented for multilevel thresholding, but their inefficient formulation makes these methods very time-consuming [10]. In medical images, intensity distribution of regions is usually very complex, and therefore, thresholding methods are challenging. Mostly, a combination of thresholding method with other methods such as fuzzy sets [14], recursive algorithms [15], and graph cuts [16] is employed. Meanwhile, to improve efficiency, heuristic methods have become better alternative ways.

Genetic algorithm (GA) is an evolutionary algorithm based on evolution theory. GA has been widely employed in solving hard combinatorial optimization problems. GA mainly uses two operators named crossover and mutation to evolve toward an ideal solution and employs fitness function to measure the quality of solutions [17]. GA, as a fast scheme for optimal thresholding, has been proposed by Yin [18]. The reported results were satisfactory and competitive to results of property-based algorithms. Then, Chang and Yan [19] introduced a thresholding technique by using a conditional probability entropy (CPE) based on Bayesian theory. In their work, GA has been employed to maximize the CPE in order to select the optimal thresholds. Tao et al. [20] applied GA in order to find the optimal combination of all the fuzzy parameters by maximizing the fuzzy entropy. To do that, membership functions of different parts of the image were described by fuzzy parameters. The optimal parameters are then used to define threshold values. In 2002, Fan et al. [21] proposed a parallel GA-based active model method and used it to segment the lateral ventricles in MR brain images. In their work, parallel GA is implemented to optimize the dynamic model-based object function. In order to segment T2-weighted MR brain images, Manikandan et al. [22] used real coded GA with simulated binary crossover and polynomial mutation-based multilevel thresholding.

PSO simulates the social behavior of bird flocking. PSO is composed of a population and member of the population called swarm and particles respectively. Initially, a population of random solution is generated and a random velocity is assigned to each particle. Each particle adjusts and updates the position regarding itself and its neighborhood. It has the ability to explore globally and locally [8]. To extend the effectiveness of Otsu’s method in multilevel thresholding, Zahara et al. [23] applied Otsu’s method with PSO and Nelder-Mead simplex search. Fan et al. [24] used a mixture Gaussian model to approximate the histogram. The Gaussian’s parameters were iteratively calculated by combining PSO with EM algorithm. Nakib et al. [25] proposed an MR brain image segmentation method. Their introduced method was based on two-dimensional survival exponential entropy and PSO. 2D histogram provided the means to benefit from spatial information, and PSO algorithm is applied to solve the problem of high computational time.

The artificial bee colony is an algorithm based on the behavior of honeybees. ABC consists of the three types of bees: employed bees, onlooker bees, and scout bees. Employed bees randomly explore food sources and return with estimation of nectar quantity. This explorative search information is shared with onlooker bees. The onlooker bees evaluate this information and select the food sources. Meanwhile, the scout bees perform a random search to find the new possible food sources [7]. ABC has been considered as an important area of research interests in multilevel thresholding. Cuevas et al. [26] explored the use of artificial bee colony algorithm to compute threshold selection for image segmentation. Histogram of an image was approximated through a Gaussian mixture model whose parameters were estimated by the ABC algorithm. Hancer et al. [27] introduced a novel image segmentation method based on ABC to separate brain tumors from MR brain images. To do that, artificial bee colony-based clustering method is chosen to segment the image. Then, thresholding is employed to extract tumor.

K-means is an unsupervised learning algorithm. This method intends to minimize an objective function which can be a chosen distance between a data point and the cluster center. In order to separate tumor objects in MR images, Wu et al. [28] applied histogram clustering and K-means clustering. The key feature of their proposed method is K-means with color-based segmentation algorithm that transformed grayscale MR images into a color image. Ng et al. [29] used K-means clustering and improved watershed algorithm for segmentation of medical images. Firstly, a primary segmentation is done by the use of K-means algorithm. Then, improved watershed segmentation algorithm is employed.

The EM is an iterative algorithm to find the maximum likelihood estimations for model parameters in the presence of incomplete or missing data. A method is introduced in [30] that used K-means and EM to provide CT image segmentation, which divided the brain into three different clusters including brain matter, CSF, and abnormal regions. Moon et al. [31] introduced an atlas-based segmentation technique. They used atlases to give a probabilistic tissue model. In the next step, the probabilistic tissue model and EM are employed to segment brain tumor by adjusting an atlas with patient-specific information about the position of tumor from different MRI modalities.

Homogeneity is largely associated with the local information obtained from an image and reveals the uniformity of a region. It plays a significant role in image segmentation since the output of image segmentation would be a few homogeneous regions [32]. Haralick et al. [33] introduced a classical attitude to describe textural features for image classification. Co-occurrence (C) matrix is the source of the homogeneity value. The gray value co-occurrence matrix is the two-dimensional histogram of the co-occurrence of gray values in an image. As a result, an image with 256 different intensity values has a co-occurrence matrix with 2562 elements. The matrix element cij (p) is the abundance of the co-occurrence of gray value i and gray value j in the image I defined as follows:

$$ p\left({I}_{x_1,{y}_1}=i,{I}_{x_2,{y}_2}=j\ |\left({x}_2,{y}_2\right)={N}^k\left({x}_1,{y}_1\right)\right) $$
(1)

where Nkindicates a fixed geometric relationship between image pixels such as the left horizontal neighbor. Next, 14 textural features were extracted and the angular second moment was chosen as a measure of texture homogeneity.

Cheng et al. [32] defined homogeneity as a composition of standard deviation and discontinuity of pixel intensities.

Standard deviation illustrates the contrast within a local region and discontinuity is a measure of sudden changes in gray levels and could be obtained by applying edge detectors to the corresponding region. In their work, Sobel operator was applied to calculate discontinuity. To achieve computational consistence, the standard deviation and discontinuity values were also normalized.

The homogeneity is shown as follows:

$$ H\left({g}_{ij},{w}_{ij}^{(1)},{w}_{ij}^{(2)}\right)=1-E\left({g}_{ij},{w}_{ij}^{(2)}\right)\times V\left({g}_{ij},{w}_{ij}^{(1)}\right) $$
(2)

where gij is the intensity of a pixel pij at the location (i, j) and \( {w}_{ij}^{(1)} \)and \( {w}_{ij}^{(2)} \) are the windows centered at (i, j) that used for the computation of variation and discontinuity respectively. E(i, j) is the magnitude of the gradient at location (i, j), and V(i, j) is the standard deviation of pixel pij. Homogeneity for any pixel of image has a value in the range of 0 to 1.

Ma et al. [34] proposed an innovative scheme for texture segmentation based on ACO for automatic IRIS image recognition. They defined different kinds of direction probability for artificial ants. They assumed direction probability vector that consist of three parts as follows:

$$ {p}^{\mathrm{dir}}={p_i}^1+{p_i}^2+{p_i}^3 $$
(3)

Here,\( {p}_i^1 \) is the predefined weight for all directions, which is attributed according to the distortion between the candidate direction and the original direction. \( {p}_i^2 \) is the set to accentuate the difference between gray levels of the ith cell f(i) and the center cell f(i). The third one, \( {p}_i^3 \), is also given by difference between the ith sub-image w(i) and the center sub-image w(0) as follows:

$$ {p}_i^2=\frac{1}{1+{\left|{f}_{(i)}-{f}_{(0)}\right|}^{\beta }} $$
(4)
$$ {p}_i^3=\frac{1}{1+{\left|d\left({w}_{(i)}.{w}_{(0)}\right)\right|}^{\gamma }} $$
(5)

Ant Colony Algorithm

In the early 1990s, ant colony optimization as a novel meta-heuristic algorithm for solving hard combinatorial problems was introduced by Dorigo et al. [35]. ACO is a member of meta-heuristic classes, which demonstrate satisfactory solutions to hard optimization problems in reasonable computational time.

The inspiring source of ACO is the observation of real ants’ behavior in the food searching process. According to biologists’ point of view, real ants have rudimentary visual sensory organs and communication skills and an individual ant may have a poor probability of longevity. However, ant colonies are able to perform complex task, which is far exceeding the capability of a single ant. Performing complex task is a proof of a highly structural social organization [36, 37].

A chemical substance called pheromone mediates an indirect form of communication between ants. The concentration of pheromone can accumulate or become weaker due to evaporation. When ants want to move in a search space, they tend to choose a path with a greater pheromone concentration. The more time it takes for an ant to travel a path, the more time it needs for pheromone to evaporate. As a result, the pheromone trails evaporate in longer path while pheromone concentration in a short path remains high. Pheromone concentration in shorter path accumulates faster as it evaporates. In the initial stage, ants are not directed by pheromone. Therefore, ants explore the space in a random manner. In further stages, with the direction of pheromone, the probability that an ant chooses the shorter path is significantly higher than that of a longer path. Finally, the process forms a positive feedback, such that almost all the ants choose the shortest path [38,39,40].

The pheromone model, as a probabilistic model, is a center core of an ACO algorithm. When artificial ants move in the search space, they use the pheromone model to generate solutions to the problem. During run time, pheromone values are updated based on the value of previously generated solutions. The aim of pheromone updating is concentrating the search procedure on the area with a high probability of containing a potential optimal solution. The procedure repeats until stopping criteria are reached [10, 35].

ACO has been already applied successfully to different combinatorial optimization tasks such as traveling salesman problem (TSP) [41], scheduling problem [42], vehicle routing problem [43], data mining [44], and face recognition [45]. Here, a novel scheme of ACO for segmenting MR brain images is presented.

Proposed Brain Image Segmentation Based on ACO

Since texture segmentation is an important area in pattern recognition, in this paper, a novel method for texture segmentation based on ACO is proposed. This method takes advantage of combining ACO and textural features. Between-class variance maximization is employed as proposed objective function. The details of the proposed algorithm are introduced as follows:

Step 1: Preprocessing and Extracting Textural Features

Preprocessing

In MR brain images, skull stripping is the method of separating brain from non-brain tissues and is considered to be one of the pre-processing steps in MR brain segmentation. Skull stripping is a challenging task, because of intensity similarities of brain and non-brain tissues and brain shape. To eliminate background, histogram analysis is performed. Then, a mask introduced by the use of morphological operation and two seeds of non-brain and brain regions were automatically determined. Based on general anatomy information, these seeds with two-dimensional region growing algorithm are expanded [46]. Figure 1 shows the result of skull stripping.

Fig. 1
figure 1

Results of skull stripping. a Original image. b Brain after removing the skull

Extracting Homogeneity

In order to calculate homogeneity of a pixel, (i, j), wij is used as a 3 × 3 window centered at (i, j) and \( {w}_{i_1{j}_1} \) is a 3 × 3 window centered at (i1, j1), where (i1, j1) is one of the eight nearest neighbors of (i, j). Table 1 shows position of (i1, j1) in different directions.

Table 1 Position of I(i1, j1) in different directions

Firstly, all possible gray values in the target area are normalized and mapped to the interval [0, 1]. Secondly, the average of all mapped difference values is calculated as follows:

$$ H=\frac{\sum \limits_{i=1}^3\sum \limits_{j=1}^3\left[1-{\left(\frac{\left|{w}_{ij}-{w}_{i_1{j}_1}\right|}{y_{\mathrm{max}}}\right)}^z\right]}{9} $$
(6)

The maximum possible gray value difference in target area is denoted by ymax. The exponent z controls the importance of certain difference values.

Besides, Hmin and Haverage are defined as follows:

$$ {H}_{\mathrm{min}}=\min \left({H}_{0^{\circ, }},{H}_{45^{\circ }},{H}_{90},{H}_{135^{\circ }},{H}_{180^{\circ }},{H}_{-{45}^{\circ }},{H}_{-{90}^{\circ }},{H}_{-{135}^{\circ }}\right) $$
(7)
$$ {H}_{\mathrm{average}}=\frac{\sum \left({H}_{0^{\circ, }},{H}_{45^{\circ }},{H}_{90},{H}_{135^{\circ }},{H}_{180^{\circ }},{H}_{-{45}^{\circ }},{H}_{-{90}^{\circ }},{H}_{-{135}^{\circ }}\right)}{8} $$
(8)

Step 2: Initialization

Generating Initial Solution

Firstly, a small memory is introduced to store the best solution. Then, two random gray values in the intensity range of target area are chosen and stored as best-so-far solution. For each ant in each iteration, the cost of the obtained result by the use of objective function is calculated and compared to the best-so-far solution.

Pheromone Distribution

The range of pheromone values is restricted to [φmin, φmax]. However, to serve the purpose of focusing ant’s energy in a target area, the amount of pheromone attributed to background and skull is zero. In each iteration, the best-so-far solution and candidates are allowed to deposit pheromones.

In order to allocate pheromone, a ramp function is employed. Based on a specific step in a pre-determined interval’s length, the pheromone is settled to pixels. Obviously, the closer the pixel’s intensity is to the value of best-so-far solution, the more pheromone is assigned. At the beginning, the pheromone of each pixel in the target area is assigned to a fixed value.

During every iteration, pheromone quantity reduces by a constant rate. Pheromone evaporation is defined by the following equation:

$$ {\varphi}_{\left(t+1\right)}=\left(1-\rho \right){\varphi}_{(t)} $$
(9)

where ρ is the evaporation rate. The amount of pheromone of pixels with intensity equals to best solution or its adjacent intensities increases by the use of a ramp function.

In the proposed algorithm, memory is not allocated to an individual ant, but a map is employed which indicates the class membership of each pixel. This approach sets the stage for a significant reduction in the number of iterations and number of ants. As a result, less computational time is required.

In this paper, four classes are assigned to make a distinction between three different types of brain tissues and background. In every iteration, all pixels are associated with a class label.

Initializing Ant Distribution

At the beginning, each ant is randomly placed on a pixel (x, y) in the target area with at most one ant on each pixel.

Step 3: Transition Probability Rule

When an ant moves, it selects a pixel in the eight nearest neighbors by considering two aspects: global pheromone distribution and homogeneity. In case, all neighboring pixels have the identical label as ant’s label or background; the ant starts to move randomly until placing in a pixel that at least one of the eight nearest pixels has a different label. This strategy improves the ability of ant’s exploration. In other words, in each iteration, all ants provide a competitive solution. The transition probability is given by Eq. 10:

$$ {\rho}_{ij}=\left\{\begin{array}{c}\frac{\tau_{ij\kern0.5em }^{\alpha }{\eta}_{ij}^{\beta }}{\sum {\tau}_{ij}^{\alpha }{\eta}_{ij}^{\upbeta}}\kern0.5em \mathrm{if}\ \left(i,j\right)\in I\kern0.5em \\ {}0\kern0.5em \mathrm{Otherwise}\end{array}\right. $$
(10)

Here, I presents the set of neighboring pixels. τij and ηijare the intensity of pheromone and homogeneity respectively.α and β are positive control parameters.

Step 4: Solution Construction

The intensity of current location and chosen pixels are candidates to be selected as optimal threshold. According to the nature of the problem, ants examine thresholds between these classes GM-WM, GM_CSF, and WM-CSF. In first two cases (i.e., GM-WM, GM_CSF), the intensity range of these classes is close. Hence, two possibilities are provided. The intensity of each pixel is assumed to be the optimal threshold and value of the generated solution is calculated. If pixels belong to WM and CSF, another possibility occurs. The other possibility is to consider intensities of both pixels as new solution for the problem. In each iteration for each ant, the value of the computed solution is compared to the best-so-far solution.

Step 5: Post-processing

Post-processing based on homogeneity values is performed in two stages. In both cases, if I(i, j) meets the homogeneity threshold criterion, wij is a 3 × 3 window centered at (i, j).

In the first stage, the pixels whose minimum homogeneity is more than a pre-defined high threshold (T) are recognized. Because of high homogeneity, it is expected that all pixels in wij are assigned to the same class; if not, the mode of wij classes will be allocated to any pixels in wij with different class labels.

In the second stage, the average homogeneity of pixels is analyzed. Pixels whose average homogeneity is less than a min(Haverage) + ω × min(Haverage) are taken into account. These candidates are probable to be weak edges with low homogeneity that are prone to errors. To make a distinction between weak and strong edges, a number of pixels in wij that their intensity difference with I(i, j) is less than a threshold are counted. In case it is more than four, the class of I(i, j) will be changed to the mode of the window. The major difference between these two stages is that in the first stage with high homogeneity candidates, the mode of label of wij is applied to all members of wij, while in second one with low homogeneity candidates, only the class of central pixel might be altered.

Thresholding methods are faced with some limitations. Deep gray matter, particularly thalamus, is visible in some real patient axial T1-weighted MR brain images. However, segmentation of MR brain images into three segments is not capable of detecting thalamus and recognizes it as WM. On the other hand, increasing the number of thresholds or segmenting WM to two classes leads to lower accuracy in other regions and over-segmentation. To solve this problem, the segmentation process performs two times. Firstly, a MR brain image is segmented into three regions and next, it is segmented into four classes, so in this case, the thalamus can be included as a member of an individual class. Then, based on anatomy information and location of thalamus in the central part of our MR brain images, a window in segmented MR brain image with four classes is defined to contain thalamus. The size of the window should be large enough to contain thalamus. However, by increasing the size of the window, the overall accuracy of the segmentation method decreases. In the next step, the window is mapped into the result of image that segmented with three classes. In the next step, the additional class, which contains thalamus, is labeled as gray matter. In order to evaluate the necessity of performing this procedure, comparing the standard deviation and mean intensity values of white matter located in the window and rest of it can be taken as decision factors.

Pseudo-code of the proposed algorithm is brought here:

figure a

In the proposed ACO algorithm, a different direction by the use of textural feature has been introduced. Since ants should provide a competitive solution in every iteration, under certain circumstances, they can move and not to be limited to eight nearest neighbors. As a result, capability of ant’s exploration has increased. Due to movement of ants on real image rather than solution space, the possibility of choosing a pixel with specific intensity correlates to its intensity frequency indirectly. To put in another way, the probability of choosing pixels which are more effective in results is higher. This issue sets the stage for higher convergence rate. Moreover, in this work, in case of necessity, thalamus detection is also performed to prevent misclassification of thalamus to WM.

To investigate the capability of the proposed algorithm, it is employed in more challenging dataset, which aims to extract tumor. The basic principles in the proposed algorithm remained unchanged. However, in the first step, an MR brain image segmented into five regions consists of background, WM, GM, CSF, and tumor. The method in [47] is used to obtain asymmetry. Then, asymmetry coefficient is computed for all regions. Obviously, the area with higher asymmetry value has the higher probability of being a tumor region. Since the target area is the tumor region, the image is converted in the binary format and morphological operations are applied on it. These fundamental operations are erosion and dilation that are described in terms of intersection and union of structuring element and an image.

Validation of MR Brain Image Segmentation

In medical image analysis, a grand truth is required to make a quantitative comparison and to validate different segmentation methods. Segmentation of real patient MR images is usually done by expert physicians. However, this method is highly subjective and depends on the operator so that even an expert may have difficulties to reproduce the same segmented images. Moreover, this method is very time-consuming and prone to errors. As a result, alternative validation methods have been introduced to tackle this problem. Phantoms and software simulations can be evolved to validate the accuracy of segmentation methods [48]. A realistic digital brain phantom or BrainWeb designed by Collins et al. [49] is one of the most favorite simulated brain databases. These databases contain a set of realistic MRI data volumes produced by an MRI simulator. T1-weighted images of 20 anatomical models of the normal brain were used with specific parameters: SFlash sequence with TR = 22 ms, TE = 9.2 ms, flip angle 40°, and 1-mm isometric voxel size. Each anatomical model consists of a fuzzy tissue membership volume. The proportion of tissue types presented in the voxel is in the range of [0, 1] and is demonstrated by voxel values [50].

The performance of the proposed algorithm in tumor detection has been assessed by the use of BRATS2012 training dataset, which contains skull-stripped multimodal MR images of low- and high-grade gliomas from simulated and real patient images. In order to compare results with BRATS grand truth, necrotic and edema were combined to form the tumor label and all other labels were ignored [51, 52]. To make quantitative comparison, 20 T1-weighted axial MR images of high-grade gliomas from simulated images are employed.

In order to evaluate efficiency of algorithms, the following parameters are computed:

$$ \mathrm{FPR}=\frac{\mathrm{FP}}{\mathrm{FP}+\mathrm{TN}} $$
(11)
$$ \mathrm{FNR}=\frac{\mathrm{FN}}{\mathrm{FN}+\mathrm{TP}} $$
(12)
$$ \mathrm{Accuracy}=\frac{\mathrm{TP}+\mathrm{TN}}{\mathrm{FP}+\mathrm{TN}+\mathrm{FN}+\mathrm{TP}} $$
(13)
$$ \mathrm{Sensitivity}=1-\mathrm{FNR}=\frac{\mathrm{TP}}{\mathrm{FN}+\mathrm{TP}} $$
(14)
$$ \mathrm{Specificity}=1-\mathrm{FPR}=\frac{\mathrm{TN}}{\mathrm{FP}+\mathrm{TN}} $$
(15)
$$ \mathrm{False}\ \mathrm{discovery}\ \mathrm{rate}\left(\mathrm{FDR}\right)=\frac{\mathrm{FP}}{\mathrm{FP}+\mathrm{TP}} $$
(16)
$$ \mathrm{Positive}\ \mathrm{predictive}\ \mathrm{value}\ \left(\mathrm{PPV}\right)=1-\mathrm{FDR}=\frac{\mathrm{TP}}{\mathrm{FP}+\mathrm{TP}} $$
(17)
$$ \mathrm{False}\ \mathrm{omission}\ \mathrm{rate}\ \left(\mathrm{FOR}\right)=\frac{\mathrm{FN}}{\mathrm{FN}+\mathrm{TN}} $$
(18)
$$ \mathrm{Negative}\ \mathrm{predictive}\ \mathrm{value}\ \left(\mathrm{NPV}\right)=1-\mathrm{FOR}=\frac{\mathrm{TN}}{\mathrm{FN}+\mathrm{TN}} $$
(19)
$$ {\mathrm{F}}_1=2\times \left(\frac{\mathrm{Precision}\times \mathrm{Sensitivity}}{\mathrm{Precision}+\mathrm{Sensitivity}}\right) $$
(20)

where FP, FN, TP, and TN stand for false positive, false negative, true positive, and true negative respectively. True positive and true negative are the number of pixels correctly assigned as desirable and undesirable subsequently. False positive and false negative are the number of pixels incorrectly assigned as desirable and undesirable respectively. Sensitivity computes the proportion of desired pixels that are correctly identified. Since sensitivity does not consider false positive, results of a high-sensitive test are reliable when it is negative. Specificity measures the fraction of undesired pixels that are correctly classified. Specificity does not take into account false negative. False discovery rate (FDR) is the ratio of FP in all detected pixels of a specific region. False omission rate (FOR) is the proportion of FN to all pixels detected as undesirable. Negative predictive (NPV) and positive predictive (PPV) values are the complements of FOR and FDR respectively. PPV is also called precision.

The F1 score is a weighted average of the precision and sensitivity. As a result, this score considers both false positives and false negatives. F1 score is in the range of [0, 1], and it reaches its best value at 1 and worst at 0.

Experimental Results

In the post-processing stage, parameters are defined as T = 0.95 and ω = 0.1. These numbers are chosen in consideration of targeting only remarkable homogeneous and low-level homogeneous pixels in two stages post-processing procedure. Table 2 shows the mean accuracy, false positive rate (FPR), and false positive rate (FNR) of different tissue types segmented by the use of the proposed ACO algorithm, ABC, PSO, K-means, and EM. Moreover, the percentages of FPR and FNR that belong to other classes have been determined. The obtained results indicate that the overall performance of the proposed algorithm is better than that of other current algorithms. For each segmented tissue, our algorithm performs better in terms of accuracy and F1 score and somehow is comparative to other methods in terms of precision and sensitivity. Meanwhile, ACO has a number of strength points in comparison with other algorithms such as inherent parallelism, positive feedback accounts for rapid discovery of good solutions, ability to be used in dynamic applications, and simplicity in implementation. Therefore, it is advantageous to use ACO compared to other brain image segmentation methods. In the proposed algorithm for each ant in each iteration, a feasible solution is provided. In all algorithms, the CSF region has the highest accuracy and the lowest accuracy that belong to GM sector. In comparison with GM and WM, CSF gains the maximum FNR and minimum FPR values in most of the algorithm. Hence, the lowest sensitivity and the highest specificity attribute to it. Predictably, significant proportion of FNR of the CSF region is due to misclassification into GM. Because of considerable overlapping in intensity values across GM and two other regions, GM has the highest FPR. Table 3 demonstrates the mean precision, FDR, and FOR of different tissue types by the use of the proposed ACO algorithm, ABC, PSO, K-means, and EM. Besides, the percentages of FDR and FOR that belong to other classes have been detected. Among these three different tissue types, WM has the minimum FDR and maximum FOR values that leads to the highest precision and lowest NPV. No single algorithm has the highest precision for all tissue types. Table 4 shows the F1 score of different tissue types by use of different algorithms. The proposed algorithm has the highest F1 score for all tissue types. Table 5 depicts the mean precision, sensitivity, accuracy, and F1 score of different algorithms in tumor detection. The proposed algorithm has the highest precision, accuracy, and F1 score, although EM algorithm gains the maximum sensitivity. In Tables 2, 3, 4, and 5, cells with the highest amount of accuracy, precision, sensitivity, and F1 score for each tissue type are  indicated by ‘**’. Besides, in Tables 2 and 3, to avoid misunderstanding, cells that show total FNR, FPR, FOR, and FDR are  indicated by ‘*’.

Table 2 Percentage of false positive and false negative rates and mean accuracy of different brain segmented regions using our proposed ACO algorithm, ABC, PSO, K-means, and EM
Table 3 Percentage of false omission and false discovery rates and mean precision of different brain segmented regions using our proposed ACO algorithm, ABC, PSO, K-means, and EM
Table 4 Mean F1 score of different tissue types by the use of our proposed ACO algorithm, ABC, PSO, K-means, and EM
Table 5 Mean precision, sensitivity, accuracy, and F1 score of tumor detection algorithm by the use of our proposed ACO algorithm, ABC, PSO, K-means, and EM

Figure 2 shows results of segmentation of MR brain images into white matter, gray matter, and cerebrospinal fluid. Figures 3, 4, and 5 show the segmentation of white matter, gray matter, and CSF achieved by the ACO algorithm as compared with PSO, ABC, K-means, and EM. To demonstrate the effects of post-processing, key areas have been magnified and the results are illustrated in Fig. 6. Figure 7 shows the obtained results of an example with thalamus detection. Different stages of tumor detection are displayed in Fig. 8. In Fig. 9, final results of tumor detection by the use of different algorithms are shown.

Fig. 2
figure 2

Results of brain segmentation. a Original image. b Divided to WM. c GM. d CSF using the proposed ACO algorithm

Fig. 3
figure 3

Results of brain segmentation extracting WM. Figures consist of a original image, b our proposed ACO, c ABC, d PSO, e K-means, and f EM

Fig. 4
figure 4

Results of brain segmentation extracting GM. Figures consist of a original image, b our proposed ACO, c ABC, d PSO, e K-means, and f EM

Fig. 5
figure 5

Results of brain segmentation extracting CSF. Figures consist of a original image, b our proposed ACO, c ABC, d PSO, e K-means, and f EM

Fig. 6
figure 6

Magnification of key areas demonstrating the effects of post-processing in our proposed algorithm

Fig. 7
figure 7

Results of thalamus detection and brain segmentation. Figures consist of a original image, b ACO using two thresholds, c ACO using three thresholds, and d combination of those two methods

Fig. 8
figure 8

Results of tumor detection in different stages. Figures consist of a original image, b segmentation of tumor by the use of ACO algorithm, c erosion, d dilation, e tumor region in original image, and f grand truth

Fig. 9
figure 9

Final results of tumor detection by the use of different algorithms. Figures consist of a original image, b our proposed ACO, c ABC, d PSO, e K-means, f EM, and g grand truth

Conclusion

Image segmentation is a critical step in a wide range of medical applications involving computer-aided measurements and diagnosis. This paper presents a new approach based on ACO for brain MR image segmentation. In the proposed ACO algorithm, textural feature for different direction probabilities has been introduced. Ant movement is not restricted to eight nearest neighbors. Therefore, ant’s exploration capability has increased. Moreover, in case of necessity, thalamus detection is also performed. Promising results of the proposed algorithm over PSO, ABC, K-means, and EM in healthy MR brain images and tumor detection were proven. In our future work, we intend to extend our approach on three-dimensional MR brain images.