## 2 Materials and Methods
### Preprocessing  
Preprocessing is one form of image enhancement tailored to the specific needs of a dataset and approach. It includes trimming and augmentation to improve a system's performance. Cropping removes unnecessary elements from an image, while augmentation increases the quantity of images to enhance the outcomes of denoising algorithm training. In this paper, preprocessing involved converting images to grayscale, applying a Contrast Adaptive Histogram Equalization (CLAHE) filter and utilizing the Bayes wavelet transform (BWT) to remove unwanted noise and fine-tune the brightness and contrast levels. Additionally, cropping and normalizing were applied. Figure 1 illustrates the preprocessing phase in block B, and the used steps are presented below. The wavelet transform is indeed widely used for compression and noise reduction in image processing. One common preprocessing step before applying the discrete wavelet transform (DWT) is to use a noise reduction tool on the original image. This helps in improving the quality of the image data before further analysis or processing, especially in scenarios where noise may degrade the accuracy or visual clarity of the image. This step aims to reduce noise from MRI data. Subsequently, the DB3 wavelet can be used to decompose the image. The noise standard deviation is then employed to determine the threshold(s) for wavelet detail coefficients. The choice of wavelet can include any of options provided by pywt.wavelist. In this case, the chosen type of wavelet was bior6.8. The method parameter determined the type of denoising to be performed. The soft thresholding setting was utilized to find the best match for the original image provided with additive noise. The Algorithm 1 for this technique is described below:  
```
- Convert the image into grayscale. - Transform the image into a floating-point representation. - Assign the standard deviation of the noise to sigma. - Compute the noise standard deviation of the image. - Specify the Bayes Shrink technique as a parameter. - Set the thresholding type to soft mode. - Configure the number of wavelet decomposition levels set to 3. - Choose Biorthogonal 6.8 as the wavelet type. - Rescale the predicted noise standard deviation if rescale_sigma = True. ```  
**Algorithm 1**Noise removal  
Figure 1: Proposed method (**A**) Dataset, (**B**) Pre-processing, (**C**) Segmentation, (**D**) Post-Processing, (**E**) Classification Model. * Contrast optimization based on Contrast Limited Adaptive Histogram Equalization (CLAHE)  
CLAHE, or Contrast Limited Adaptive Histogram Equalization, is an image enhancement technique used to improve the contrast of an image. Unlike traditional histogram equalization methods that operate on the entire image, CLAHE works on small regions or tiles within the image. This localized approach prevents over-amplification of the contrast in regions with varying intensities, leading to more balanced and visually pleasing results. This technique is an enhanced version of Adaptive Histogram Equalization (AHE) with the added benefit of limiting contrast amplification, which helps in avoiding artifacts and maintaining natural-looking enhancements. Unlike AHE, CLAHE operates on tiled regions of the image rather than the entire image, thus eliminating artificial boundaries by blending neighboring tiles using bilinear interpolation. In our study, CLAHE was employed to enhance image contrast. When utilizing CLAHE, two parameters should be noted, the ClipLimit parameter, which determines the threshold for constraining contrast (with a default starting value of 3), and the tileGridSize parameter, which controls the size of each row and column of tiles (set to 8 \(\times\) 8 in our case). This method's Algorithm 2 is outlined below:  
* Normalize the input array (image) to preserve values within the specified range (0 to 255). * Convert the output to an 8-bit unsigned integer. * Create a CLAHE object with the provided parameters:
* Set the clipLimit to 3.0 to limit the improvement of contrast.