# Artificial Intelligence Approach for Early Detection of Brain Tumors Using MRI Images
## 2 Materials and Methods
### Methods
#### 2.2.2 Segmentation Algorithm  
Classical image processing techniques such as threshold-based, region-based, and clustering algorithms are frequently used in the segmentation of brain tumors. For segmentation, various techniques are employed in brain imaging, including spatial techniques, clustering-based techniques, histogram shape-based techniques, entropy-based techniques, and object attribute-based techniques. Techniques for threshold-based segmentation can be local or global. Although local is based on the histogram of a particular area of the image, global is based on the histogram of the entire image. There are two categories for threshold method types: bi-level threshold and multilayer threshold. Based on the intensity values and/or statistical properties (variance, entropy, objective function) of the histogram, multilevel can construct various thresholds, such as tri-level or quad-level, separating the pixels into multiple classes. **Threshold-based segmentation**  
An old and straightforward technique called threshold-based segmentation analyzes the brightness of pixels with a given grey level to identify different parts of the brain. The two types of thresholding techniques are global and local thresholding procedures. The Otsu technique, for instance, divides image pixels into two groups: the background and the foreground (objects) [8]. On the other hand, local thresholding only affects a limited portion of the image. Moreover, prior information about the contents of the image is necessary in order to choose the optimum threshold value. For instance, the intensity histogram and other statistical data could be utilized to determine the threshold value for various brain regions. The approaches of [PERSON] [8] and [PERSON] [9] are well recognized for achieving a good threshold; each of them suggests a different objective function that needs to be maximized in order to find the ideal threshold values. Both methods make use of the histogram to calculate the mean, variance, and related objective functions. The number of levels or classes is set by the operator. The method used by [PERSON] is a nonparametric thresholding technique that uses the largest variance value among the several classes as a segmentation criterion for images. According to [8; 9], the intensity levels from a grayscale image are used to determine the probability distribution of the intensity values from the image's histogram. In the case of RGB images, it is necessary to apply separation into single-component images. The Otsu's objective function is:  
\[\text{J(th)}=\text{max}\,\left(\delta^{2}\left(\text{th}\right)\right)\,\text {with}\,\,0\,\,<\,\,\text{th}\,\,<\,\,\text{L}-1. \tag{1}\]  
The variance of the class is represented by \(\delta^{2}\), where th stands for the threshold value. In our example, L stands for the image's highest possible gray level, which is 255. The initial algorithm divides images into two categories. For multi-level segmentation, it was expanded to calculate multiple thresholds [15]. Another nonparametric method for determining suitable threshold values is [PERSON]'s method [9]. It is based on the entropy and probability distribution of the image histogram. The approach's objective is to identify the appropriate threshold for raising overall entropy. The degree of separation between classes in an image is indicated by its entropy. In this regard, the optimal threshold value distinguishes the classes properly when the entropy reaches its maximum value. Multilevel threshold based on harmonic search optimization (HSO)  
The problem with both bi-level and multi-level classification is determining the threshold values that correctly identify the classes. Bi-level divides the image into two classes, whereas multi-level is used to segment complex images and can produce multiple thresholds, such as tri-level or quad-level, splitting the pixels into multiple classes based on the intensity values and/or statistical parameters (like mean and variance). The Harmony Search Algorithm (HSA) [30; 38].