Introduction

Segmentation of medical images is an essential process in the field of medical image analysis. It is crucial for accurate disease diagnosis, effective treatment planning, and thorough postoperative assessment1. Accurate image segmentation aids doctors in precisely identifying and locating lesions, thus enhancing diagnostic accuracy and treatment efficacy. In medical imaging, multi-threshold image segmentation has garnered significant attention for its capability to divide images into multiple regions of interest2. By determining multiple thresholds, the gray levels of an image are segmented into several parts, each corresponding to different tissues or structures. However, traditional multi-threshold segmentation methods often face challenges such as high computational complexity, prolonged processing times, and susceptibility to local optima when handling complex images.

In recent years, swarm intelligence optimization algorithms have been used and enhanced for multi-threshold image segmentation to tackle thesedifficulties3. For instance, the crossover-enhanced optimizer4, an enhanced artificial electric field algorithm with crossover mechanisms and a novel velocity update procedure, significantly improves multi-level threshold optimization in image segmentation, outperforming alternative methods in benchmark and real-world applications. An enhanced Snake Optimization algorithm integrated with opposition-based learning5 significantly improves global optimization and multilevel image segmentation for liver disease from CT scans, outperforming recent metaheuristic algorithms and demonstrating high efficiency and accuracy in CAD systems. The AOA-HHO algorithm6 combines the strengths of the arithmetic optimization algorithm (AOA) and Harris hawks optimizer (HHO) to enhance multilevel thresholding image segmentation, achieving superior thresholds, segmentation accuracy, PSNR, SSIM, and execution time compared to AOA, HHO, and other meta-heuristic algorithms. The CRWOA algorithm7, enhancing the whale optimization algorithm with adaptive parameter adjustment, roulette selection, combined mutation, and similarity removal, significantly improves local search ability, exploration-exploitation balance, and population diversity, outperforming other algorithms in convergence and segmentation quality in multilevel threshold segmentation of grayscale images. The transient search naked mole-rat optimizer8, combining transient search optimizer with the naked mole-rat algorithm and incorporating a novel stagnation phase and self-adaptive parameters, outperforms competitive methods in multilevel threshold segmentation, as demonstrated by superior mean and standard deviation values, and validated by statistical tests and convergence profiles.

Swarm intelligence optimization algorithms mimic collective behaviors in nature, leveraging cooperation and information sharing among individuals to solve complex optimization problems. These algorithms, known for their simple structures, strong global search capabilities, are suitable for solving various nonlinear, high-dimensional, and multimodal optimization problems. The JAYA algorithm9, a novel swarm intelligence optimization technique, has shown remarkable efficacy across numerous applications due to its straightforwardness and efficiency. This method enhances solutions by steering individuals towards the optimal solution while moving them away from the suboptimal one, thereby progressively refining the solution quality. However, despite its notable success in various optimization scenarios, JAYA encounters difficulties such as a tendency to get trapped in local optima and a slower convergence rate when applied to complex, high-dimensional medical image segmentation tasks. To address these issues, we propose the GBJAYA algorithm based on the Gaussian bare-bone strategy, which enhances global search capability and diversity by introducing Gaussian distributed random number update strategies, effectively avoiding local optima and accelerating convergence speed. The GBJAYA algorithm effectively combines the simplicity of the classic JAYA algorithm with the enhanced search capability provided by the Gaussian bare-bone strategy, ensuring diversity during individual position updates through Gaussian distribution randomness.

To evaluate the effectiveness of GBJAYA, its performance was compared with 10 fundamental algorithms and 10 enhanced algorithms. The experimental results were assessed using the Wilcoxon signed-rank test10 and the Friedman test11. A comprehensive analysis and comparison of the experimental findings indicated that GBJAYA enhances search capabilities, accelerates convergence, increases precision, and better avoids local optima. Furthermore, the GBJAYA algorithm was applied to the multi-threshold segmentation of two types of medical images, employing a 2D histogram-based 2D Kapur’s Entropy combined with non-local means as the objective function. This application confirmed its effectiveness and advantages in medical image processing. The results demonstrate that the GBJAYA algorithm significantly improves segmentation performance for multi-threshold medical image segmentation, showcasing notable benefits in solution quality. The primary contributions and innovations of this paper include:

  • Developed GBJAYA algorithm, which leverages the Gaussian bare-bone strategy to improve the global search capability and diversity of the traditional JAYA algorithm.

  • Confirmed the efficacy and benefits of the GBJAYA algorithm in practical medical image processing by applying it to the multi-threshold segmentation of COVID-19 chest X-ray images and breast cancer images.

  • Demonstrated the GBJAYA algorithm’s high stability and accuracy in handling high-dimensional, complex optimization problems, effectively avoiding local optima and accelerating convergence.

  • Experimental results indicate that the GBJAYA algorithm significantly enhances segmentation capability for multi-threshold medical image segmentation.

The paper is organized as follows: Firstly, Sect. 2 introduces the fundamental concepts and applications of non-local means and 2D Kapur’s Entropy, and Sect. 3 details the basic principles of the JAYA algorithm, including its operational steps and characteristics. Then, Sect. 4 discusses the Gaussian bare-bone strategy and outlines its specific implementation details within the GBJAYA algorithm, and Sect. 5 presents several comparative experiments to illustrate the performance advantages and practical applications of GBJAYA. Finally, Sect. 6 summarizes the key research findings of the study and outlines future research directions and plans.

Related works

Multi-level image segmentation method

Multi-threshold image segmentation12 is an image processing method that segments an image into multiple regions with different gray characteristics by selecting multiple thresholds on the image histogram. The basic principle is to determine a set of appropriate thresholds to divide the image into multiple regions. Suppose the gray level range of a grayscale image is \(\:[0,\:L-1]\), where \(\:L\) is the number of gray levels. The goal of multi-threshold segmentation is to find thresholds \(\:{T}_{1},{T}_{2},\dots\:,{T}_{n}\) to divide the image into \(\:n\) regions. The pixel values of each region fall within the ranges 0~\(\:{T}_{1}\), \(\:{T}_{1}\)~\(\:{T}_{2}\),., \(\:{T}_{n}\)~\(\:L-1\). Multi-threshold image segmentation usually starts with the image’s gray histogram, which represents the frequency of each gray level in the image. By analyzing the histogram’s shape, possible threshold positions can be preliminarily determined. The core of selecting thresholds is to find the gray levels that best segment the different regions. Common methods include Otsu’s method13,14 and entropy-based algorithms15,16,17,18. These methods determine the optimal threshold set through various criteria and optimization algorithms, searching for the optimal solution by maximizing inter-class variance or information entropy19. Once the threshold set is determined, the image is segmented into several regions by these thresholds. Each pixel is assigned to the corresponding region based on its gray value, representing different components in the image.

Multi-threshold image segmentation has many significant advantages in the field of image processing. First, compared to single-threshold segmentation, multi-threshold segmentation can capture more details and complex structures in the image, providing higher segmentation accuracy. This is particularly important in applications where subtledifferences and complex structures need to be identified. Second, multi-threshold segmentation is applicable to various types of images, whether grayscale or color images, achieving effective segmentation through appropriate threshold selection methods. This makes it widely applicable in different application scenarios. Additionally, many multi-threshold segmentation methods can automatically determine the optimal threshold set, reducing the dependence on manual intervention, and improving the automation and efficiency of the segmentation process. This is significant for applications that need to process large volumes of images, such as medical image analysis and remote sensing image processing. Multi-threshold segmentation methods select thresholds through global optimization algorithms or information theory criteria, which can overcome the influence of noise and image variations to a certain extent, providing more effective segmentation results. Finally, multi-threshold segmentation can divide an image into multiple regions through multiple thresholds, with each region containing rich information, facilitating subsequent feature extraction and analysis. This is especially useful in target detection and recognition in complex scenarios.

Overall, multi-threshold image segmentation holds an important position in the field of image processing and computer vision. Its principle is based on the distribution of gray or color levels in the image, segmenting the image into multiple regions by selecting multiple thresholds, thereby capturing finer details and complex structures in the image. Multi-threshold segmentation methods boast high precision, strong adaptability, high automation, good stability, and rich information content, making them widely applied and valued in fields such as medical image processing, remote sensing image analysis, and industrial inspection. With the enhancement of computing power and the development of optimization algorithms, multi-threshold image segmentation technology will continue to advance and play a crucial role in even broader domains.

Non-local means for 2D histogram

The Non-Local Means 2D Histogram (NLM-2DH) method combines the denoising capabilities of the Non-Local Means (NLM) technique with the advantages of a 2D histogram, providing a powerful tool for image processing tasks that require both effective noise reduction and precise image feature description. The principle begins with using the NLM algorithm for denoising the image. The NLM algorithm computes the weighted average of each pixel by searching for similar patches in the image, thereby eliminating noise while preserving details and textures. This denoising method, based on the global similarity of the image, effectively suppresses noise without losing important information.

After denoising, a 2D histogram is constructed based on the denoised image20. The 2D histogram not only considers the grayscale information of the image but also incorporates spatial features (such as gradients and textures), thereby statistically representing these joint distributions in a two-dimensional space. Specifically, as shown in Fig. 1, one axis represents the grayscale values of the image, while the other axis represents the spatial feature values. By statistically counting the number of pixels in the image that simultaneously have specific grayscale and spatial feature values, the 2D histogram can more comprehensively reflect the structure and characteristics of the image. This method significantly enhances the feature representation capability and processing accuracy in image processing tasks.

Fig. 1
figure 1

The 2D plan view of the histogram structure used in the thresholding process.

The main features of the Non-Local Means 2D Histogram (NLM-2DH) method are its noise robustness and high-precision feature description capability. Firstly, the application of the NLM algorithm significantly reduces noise in the image, making the subsequent construction of the 2D histogram more accurate and reliable. Secondly, the 2D histogram provides information on joint distributions, allowing for a detailed description of complex structures and textures within the image. This combined approach not only performs well in processing images with significant noise but also has clear advantages in preserving image details and improving the accuracy of feature descriptions.

The advantages of the NLM-2DH method are evident in several aspects. First, it enhances the effectiveness of image segmentation tasks. In image segmentation, the NLM-2DH method can more precisely delineate target regions by accurately describing the grayscale and spatial features of the image, achieving excellent results even in noisy conditions. Secondly, the NLM-2DH method offers rich image information, combining the benefits of denoising and feature description, leading to more comprehensive and precise processing results. Finally, this method has wide applicability, suitable for various types of image processing tasks, including medical image analysis and remote sensing image processing, handling noise and details effectively. In summary, the NLM-2DH method provides an innovative approach in image processing by integrating advanced denoising techniques with powerful feature description tools, enabling both effective noise reduction and precise image feature characterization.

2D Kapur’s entropy

2D Kapur’s Entropy21 is an image segmentation method based on entropy theory, whose core idea is to determine the optimal segmentation threshold by maximizing the entropy of the image. Combining this method with a Non-Local Means (NLM)-based 2D histogram can significantly improve segmentation capability. The NLM-based 2D histogram first denoises the image using the NLM algorithm, which calculates the weighted average of each pixel by utilizing similar patches within the image, effectively removing noise while preserving details. On the denoised image, a 2D histogram is constructed, including both the original grayscale values and the denoised grayscale values. This histogram is formed by counting the joint distribution of different grayscale values and denoised grayscale values, providing a more comprehensive reflection of the image’s structure and features.

Specifically, in the NLM-based 2D histogram, one axis represents the grayscale values of the original image, and the other axis represents the grayscale values of the denoised image using the NLM method. By counting the frequency of each pair of grayscale value combinations, a 2D histogram is formed, reflecting the noise and detail features in the image. The 2D Kapur’s Entropy method achieves image segmentation by finding the threshold combination that maximizes the entropy value of the 2D histogram. Let the pixel point\(\:\:(i,\:j)\) in the 2D histogram be denoted, and the entropy value is defined as follows:

$$\:H\left(s,t\right)=-\sum\:_{i=0}^{{s}_{1}}\sum\:_{j=0}^{{t}_{1}}\frac{{P}_{ij}}{{P}_{1}}\text{ln}\frac{{P}_{ij}}{{P}_{1}}-\sum\:_{i={t}_{1}+1}^{{s}_{2}}\sum\:_{j={t}_{1}+1}^{{t}_{2}}\frac{{P}_{ij}}{{P}_{2}}\text{ln}\frac{{P}_{ij}}{{P}_{2}}-\dots\:-\sum\:_{i={s}_{L-2}+1}^{{s}_{L-1}}\sum\:_{j={t}_{L-2}+1}^{{t}_{L-1}}\frac{{P}_{ij}}{{P}_{L-1}}\text{ln}\frac{{P}_{ij}}{{P}_{L-1}}$$
(1)
$$\:\text{w}\text{h}\text{e}\text{r}\text{e}\:{P}_{1}=\sum\:_{i=0}^{{s}_{1}}\sum\:_{j=0}^{{t}_{1}}{P}_{ij},\:{P}_{2}=\sum\:_{i={t}_{1}+1}^{{s}_{2}}\sum\:_{j={t}_{1}+1}^{{t}_{2}}{P}_{ij},\:{P}_{L-1}=\sum\:_{i={s}_{L-2}+1}^{{s}_{L-1}}\sum\:_{j={t}_{L-2}+1}^{{t}_{L-1}}{P}_{ij}.$$

Therefore, \(\:\left\{{t}_{1},{t}_{2},\dots\:,{t}_{n-1}\right\}\)represents the set of thresholds for multi-threshold segmentation. By maximizing the entropy \(\:H\left(s,t\right)\), the optimal combination of thresholds can be found, achieving the best segmentation.

Using swarm intelligence optimization algorithms for multi-threshold image segmentation involves taking the 2D Kapur’s Entropy as the objective function and optimizing the threshold combination through collaborative search. These algorithms mimic the behavior of natural swarms, finding the global optimal solution through the cooperative actions of multiple individuals. Initially, a set of initial solutions is randomly generated within the search space, with each solution representing a possible combination of thresholds. Then, by evaluating the fitness value of each solution, which corresponds to the 2D Kapur’s Entropy value, the threshold combinations are gradually optimized. Through continuous iterative updates until the convergence conditions are met, the optimal threshold combination is eventually output, achieving efficient and precise image segmentation.

In summary, the 2D Kapur’s Entropy method based on the NLM-2DH, by combining advanced denoising techniquesand powerful feature description tools, provides an innovative method in image processing that effectively denoises while precisely describing image features. The use of swarm intelligence optimization algorithms further optimizes the segmentation thresholds, achieving efficient and precise multi-threshold image segmentation.

An overview of JAYA

The JAYA algorithm, proposed by Rao et al., is a metaheuristic algorithm that follows the principle of continuous improvement, where individuals continuously move away from the worst individual and towards the best individual. Unlike other algorithms, JAYA does not require specific algorithm parameters and only involves two common parameters: population size and the total number of iterations. For specific problems, simply adjusting these two parameters is sufficient, avoiding the performance instability caused by excessive parameter tuning. Additionally, compared to other optimization algorithms, JAYA’s design is simpler, making it easier to understand and implement. This means that under the same operating conditions, JAYA requires fewer resources and less time.

The central concept of the JAYA algorithm revolves around directing the evolution of the entire population through the selection of its best and worst individuals. In each iteration, every individual updates its position based on these selected extremes within the current population. Specifically, individuals move towards the position of the best individual and away from the position of the worst individual. This approach aims to optimize the overall objective function by leveraging the guidance provided by these extreme values. This mechanism not only accelerates the convergence speed but also improves the accuracy of the search. Furthermore, the simplicity and efficiency of the JAYA algorithm make it perform excellently in solving complex optimization problems. Due to the absence of complex parameter adjustments, JAYA can be flexibly applied in different scenarios and is easy to combine with other optimization methods, further enhancing its optimization capabilities. Its broad applicability and stable performance make it a powerful tool for solving practical engineering problems. Overall, the JAYA algorithm is not only innovative in theory but also demonstrates its strong optimization capability and efficiency in practical applications. Its design philosophy and operating mechanism provide new ideas and methods for the research and development of optimization algorithms.

To gain a deeper understanding of the operational mechanism of the JAYA algorithm, the following section will delve into its fundamental mathematical principles. Consider an objective function \(\:f\left(x\right)\) where \(\:x\:\) is comprised of variables in \(\:D\) dimensions. Let \(\:{X}_{i}^{j}\) denote the value of the \(\:jth\) variable of the \(\:ith\) candidate solution. Thus, the locations of candidate solutions can be represented as \(\:{\:X}_{i}=({X}_{i}^{1},{X}_{i}^{2},{X}_{i}^{3},...,{X}_{i}^{d})\). Among these solutions, \(\:{X}_{best}\) signifies the best individual, while \(\:{X}_{worst}\) represents the worst individual. The adjustment of variable \(\:{X}_{i}^{j}\) is expressed as follows:

$$\:{{X}_{i}^{j}}^{{\prime\:}}={X}_{i}^{j}+rbest\times\:\left({X}_{b}^{j}-\left|{X}_{i}^{j}\right|\right)-rworst\times\:\left({X}_{w}^{j}-\left|{X}_{i}^{j}\right|\right)$$
(2)

where the values of the \(\:jth\) variable in the optimum solution, denoted as \(\:{X}_{bj}\), and the worst solution, denoted as \(\:{X}_{w}^{j}\), are provided. The variable \(\:{{X}_{i}^{j}}^{{\prime\:}}\) represents the updated individual in this context. Let \(\:rbest\) and \(\:rworst\) represent two independent random variables that follow a uniform distribution inside the interval [0,1]. The equation denoted as Eq. (2) illustrates the influence of \(\:rbest\times\:\left({X}_{b}^{j}-\left|{X}_{i}^{j}\right|\right)\) on the current solution’s tendency towards the current optimum solution. Conversely, \(\:rworst\times\:\left({X}_{b}^{j}-\left|{X}_{i}^{j}\right|\right)\) depicts the impact of the current solution’s trend away from the current worst solution. The acceptance or determination of the revised solution is contingent upon its functional value.

The search technique used by JAYA algorithm involves iteratively seeking an optimum solution while simultaneously avoiding the worst option. This approach enables JAYA to progressively converge towards the optimal solution, hence resulting in improved quality of the results. The algorithmic representation of the JAYA structure is shown in Algorithm 1.

Algorithm 1
figure a

Pseudo-code of JAYA.

Proposed GBJAYA

Gaussian barebone Idea

The Gaussian Barebone strategy is a powerful technique that effectively addresses complex optimization challenges by combining the advantages of Gaussian distribution and barebone strategy22,23,24. Unlike traditional methods that rely on predefined search paths, the barebone strategy simplifies the optimization process by directly using objective function values to update solutions. The introduction of Gaussian distribution enriches the exploration of the solution space, enhancing optimization efficiency. In practice, this strategy first generates random solutions and iteratively improves them through candidate solutions guided by the mean and standard deviation of the current solutions. The update of solutions depends on the comparison of objective function values. This method cleverly balances exploration and exploitation dynamics, promoting rapid convergence while avoiding the trap of local optima.

In this study, the Gaussian Barebone strategy has been integrated into the classical JAYA algorithm to enhance both its convergence speed and solution quality. The primary objective of incorporating the Gaussian Barebone strategy is to enable individuals within the population to select the most appropriate direction, thereby mitigating premature convergence to local minima. Within the framework of JAYA, the decision-making process is influenced by a probability coefficient \(\:CR\). Specifically, when this probability is lower than \(\:CR\), the Gaussian distribution is employed to update new positions. Conversely, when the probability exceeds \(\:CR\), the differential evolution concept is utilized to generate new positions. Both approaches—Gaussian function and differential evolution—utilize the current position and the best-known position to compute new positions. The Gaussian Barebone strategy significantly enhances convergence speed and optimization capability, characterized by efficient computation and high precision. This enhancement aligns closely with the objective of identifying the most suitable solution within the JAYA search process.

Through this improvement, the performance of the JAYA algorithm in solving complex optimization problems is significantly enhanced, not only accelerating the convergence speed but also improving the quality of solutions. This improved strategyeffectively prevents premature convergence and entrapment in local optima, demonstrating its great potential and broad applicability in practical applications. The Gaussian bare-bone is described as follows:

$$\:Gauss=N\left(\mu\:,\sigma\:\right)$$
(3)
$$\:\mu\:=({X}_{best}^{j}+{X}_{i}^{j})/2,\:\:$$
(4)
$$\:\sigma\:=\left|{X}_{best}^{j}-{X}_{i}^{j}\right|,$$
(5)
$$\:DE={X}_{best}^{j}+rand\left(\right)\times\:({X}_{1}^{j}-{X}_{{i}_{2}}^{j})$$
(6)
$$\:Tposition=\left\{\begin{array}{c}Gauss,\:\:\:\:\:\:\:\:\:if\:rand\left(\:\right)<CT,\:\:\:\:\\\:DE,\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:otherwise,\:\:\:\:\:\:\:\:\:\:\:\:\end{array}\right.$$
(7)

where N (\(\:\mu\:\), \(\:\sigma\:\)) represents a Gaussian random variable, where \(\:\mu\:\) is the mean and σ is the standard deviation. The rand generates a random number within the range [0, 1]. The variables \(\:{i}_{1}\) and \(\:{i}_{2}\) are distinct random variables ranging from 1 to \(\:N\), each differing from the parameter \(\:i\). Notably, within GBJAYA, updates are conducted according to the Gaussian bare-bone strategy, aiming to enhance the diversity of the population. This augmentation contributes to the exploration capability of the optimizer. Although Eq. (7) reflects a balance between exploration and exploitation, it fundamentally differs from the ε-greedy strategy. While ε-greedy applies to discrete action selection with fixed probability switching, our method targets continuous optimization by generating new solutions via Gaussian distribution and adaptively guiding the search using population statistics, thus enhancing diversity and global search efficiency.

The proposed GBJAYA

The GBJAYA algorithm represents an innovative enhancement of the traditional JAYA algorithm, aimed at improving global search capabilities and convergence speed through the integration of a Gaussian barebone strategy. Originating from swarm intelligence, the classic JAYA algorithm employs straightforward rules for updating individual positions, guiding them towards optimal solutions while steering clear of inferior ones. Despite its simplicity and ease of implementation, the JAYA algorithm often struggles with complex optimization tasks, frequently becoming ensnared in local optima, thereby constraining its global search efficacy. To counteract this limitation, GBJAYA introduces a Gaussian distribution strategy during position updates, injecting randomness and diversity into the search process. This strategic enhancement significantly bolsters the algorithm’s ability to conduct thorough global searches and accelerate convergence speed. Key attributes and benefits of the GBJAYA algorithm are exemplified in the ensuing discussion.

Firstly, through integration of the Gaussian barebone strategy, the GBJAYA algorithm introduces Gaussian distributed random numbers in updating individual positions, thereby enhancing randomness and diversity in the search process to avoid local optima. Secondly, the Gaussian distribution approach preserves individual differences while leveraging the current optimal solution to guide updates, thus accelerating convergence speed. Moreover, despite the incorporation of the Gaussian barebone strategy, GBJAYA maintains the simplicity of the classic JAYA algorithm, ensuring ease of implementation and application. The pseudocode for GBJAYA is outlined below:

Algorithm 2
figure b

Pseudo-code of GBJAYA.

In addition, to assess the practical feasibility of the proposed GBJAYA algorithm, we conducted a preliminary analysis of its computational complexity and resource requirements. Let \(\:D\) denote the problem dimension, \(\:P\) the population size, and \(\:I\) the maximum number of iterations. The overall time complexity of GBJAYA can be expressed as\(\:\:O(I\times\:P\times\:D)\). In each iteration, the algorithm performs position updates based on the best and worst individuals, which involves linear operations with complexity \(\:O\left(D\right).\) The introduction of the Gaussian bare-bone strategy adds random sampling from a Gaussian distribution, but this operation incurs minimal computational cost and does not change the overall complexity class of the algorithm. In practice, the computational time is primarily influenced by the complexity of the objective function. In this study, the objective function—based on 2D Kapur’s entropy combined with the Non-Local Means method—includes 2D histogram construction and entropy computation, which are considered moderately complex. In our experiments, the GBJAYA algorithm demonstrated satisfactory computational efficiency on a standard image processing workstation equipped with an Intel Core i7 processor and 16 GB of RAM. In future work, we plan to further improve the runtime efficiency and explore GPU-based implementations to meet real-time processing requirements in clinical environments.

Code availability

The custom code for the algorithm proposed in this study has been archived and is publicly available at Zenodo: https://doi.org/10.5281/zenodo.15280714. The repository includes the complete implementation of the algorithm, along with instructions for reproducing the optimization process described in the Methods section. This archived version ensures permanent accessibility and complies with the journal’s code availability requirements.

Experiments and results

Experiment setup

In experiments utilizing the IEEE CEC2017 benchmark functions, the primary aim was to highlight the superior performance of GBJAYA. Table A1 in the supplementary material presents the IEEE CEC2017 benchmark functions, which include unimodal, multimodal, hybrid, and composite functions, covering a wide range of optimization scenarios from simple to highly complex. Unimodal functions (F1–F3) are designed to evaluate local exploitation ability, while multimodal functions (F4–F8) test the algorithm’s capacity to escape local optima. Hybrid functions (F9–F20) combine multiple basic functions to increase the structural complexity of the search space. Composite functions (F21–F30) further incorporate transformations such as rotation, translation, and scaling to simulate more realistic and challenging optimization environments. This benchmark suite places comprehensive demands on convergence speed, and precision, and is widely used to assess performance across diverse optimization tasks. Initially, comparative experiments were conducted where GBJAYA was pitted against 10 fundamental algorithms and 10 enhanced algorithms. To ensure the fairness and reliability of the results, all algorithms were tested under identical conditions, with a population size of 30 and a uniform maximum evaluation count of 300,000. Additionally, to minimize the impact of random variations, each algorithm was tested independently 30 times. The results were then analyzed and compared using the Wilcoxon signed-rank test10 and the Freidman test11. Detailed analysis and comparison of the experimental results demonstrated that GBJAYA exhibited significant improvements in search capability, convergence speed, convergence precision, and the ability to escape local optima.

In segmentation experiments using 10 X-ray images and 10 breast cancer images, the primary objective was to demonstrate that the GBJAYA could achieve superior segmentation results and exhibit strong adaptability acrossdifferent threshold levels. GBJAYA was compared with 10 other similar peers at both low threshold levels (4, 5, 6) and high threshold levels (12, 16, 20). In these experiments, two publicly available medical image datasets were used for validation. The first is the COVID-19 chest X-ray dataset, constructed by Cohen et al.25, which contains 679 frontal-view and 82 lateral-view images from patients in various clinical conditions. This dataset is widely used for lung region segmentation and disease-assisted diagnosis. The second is a breast cancer histopathological image dataset from Databiox, consisting of 922 H&E-stained tissue slice images, annotated according to three IDC (Invasive Ductal Carcinoma) grading standards26. It includes multiple magnification levels and rich structural details, making it suitable for multi-threshold segmentation of tissue regions. These two datasets represent radiological and histological imaging tasks, respectively, and provide a comprehensive basis for evaluating the adaptability of the proposed algorithm. The lung X-ray images are labeled as A to J in Fig. 2, and the breast cancer images are labeled as K to T in Fig. 3. Since the proposed multi-threshold segmentation operates in the grayscale domain, each RGB image was converted to grayscale using MATLAB’s rgb2gray(∙) function. This function applies a weighted combination of the R, G, and B channels, ensuring consistency with the 2D histogram-based thresholding framework adopted in our method. The population size for all segmentation methods was set to 20, and to minimize randomness, each test was independently conducted 30 times. The experimental results were evaluated using PSNR27, SSIM28, and FSIM29, with the evaluation results compared using mean, standard deviation, the Wilcoxon signed-rank test10, and the Freidman test11. It is important to note that the proposed GBJAYA-based multi-threshold segmentation is designed as a pre-processing or enhancement technique, rather than a full instance segmentation method. The goal is to highlight regional contrast and delineate coarse structural zones in a fully unsupervised manner, which can serve as an input or initialization for downstream biomedical image analysis tasks such as instance segmentation or classification. Detailed analysis of the experimental results confirmed that GBJAYA demonstrated excellent segmentation performance and strong adaptability across various threshold levels in multi-threshold image segmentation.

Fig. 2
figure 2

Representative COVID-19 lung X-ray image used as input for segmentation (not the output)25.

Fig. 3
figure 3

Representative RGB histopathology image of breast cancer tissue used as input, later converted to grayscale for processing26.

Benchmark function validation

Comparison with basic peers

To evaluate the performance of the algorithms on standard numerical optimization tasks, Table 1 reports the optimization results on the IEEE CEC2017 benchmark functions. For each function, two metrics are provided: AVG represents the average of the best objective values obtained over multiple runs, and STD denotes the standard deviation, reflecting the stability and convergence consistency of the algorithm. Since the CEC2017 functions are unconstrained continuous optimization problems, the goal is to minimize the objective value as much as possible. Therefore, lower AVG and STD values indicate better performance. 10 fundamental peers include hunger games search (HGS)30, slime mould algorithm (SMA)31, political optimizer (PO)32, salp swarm algorithm (SSA)33, Harris hawks optimization (HHO)34, grey wolf optimization (GWO)35, ant colony optimization for continuous domains (ACOR)36, multi-verse optimizer (MVO)37, RIME38, and JAYA9. The results show that GBJAYA performs excellently on most test functions, particularly demonstrating clear advantages in the mean and standard deviation metrics. In most test functions, GBJAYA exhibits the lowest mean values, showcasing its strong search capability in optimization problems and its ability to find results close to the global optimal solution in a relatively short time. Additionally, GBJAYA also shows the lowest standard deviation values, indicating high stability and consistency in its results, effectively avoiding local optima and demonstrating high performance.

Overall, the GBJAYA algorithm outperforms the other compared algorithms in terms of search capability, and convergence accuracy. The experimental results validate that GBJAYA offers significant advantages and has wide applicability in addressing complex optimization problems, establishing it as a highly effective optimization algorithm.

Table 1 Optimization results with fundamental peers on IEEE CEC2017 benchmark functions: AVG (average of best objective values across runs) and STD (standard deviation, reflecting algorithm stability and convergence consistency) are provided for each function.

Table 2 displays the analysis results obtained through the Wilcoxon signed-rank test. In this table, the symbol “+” indicates the number of functions (out of 30 test functions) where the GBJAYA algorithm outperformed other methods; the symbol “-” denotes the number of functions where GBJAYA underperformed compared to other methods; and the symbol “=” signifies that GBJAYA’s performance was comparable to other methods. “Mean” reflects the average ranking achieved by each method across all functions, while “Rank” represents the overall ranking. The results illustrate that the GBJAYA algorithm surpasses other compared algorithms in most cases, demonstrating its strong optimization capability and stability. Specifically, GBJAYA’s average ranking is 1.30, placing it first overall. Compared to the other 10 basic algorithms, GBJAYA performed exceptionally well across all 30 test functions, achieving a significant number of “+” symbols, which indicates its superior performance in the majority of tests. In contrast, the average ranking and overall ranking of other algorithms were lower than those of GBJAYA, underscoring its advantages in solving complex optimization problems.

In conclusion, the experimental outcomes presented in Table 2 highlight the superior performance of the GBJAYA algorithm in multi-threshold image segmentation. The results exhibit its impressive search capabilities, fast convergence rates, and effectively tackling a wide range of complex optimization challenges.

Table 2 The analysis results obtained through the Wilcoxon signed-rank test.

Figure 4 illustrates the ranking results of GBJAYA and 10 other comparable algorithms based on Friedman analysis. It is clear from the figure that the GBJAYA algorithm excels, achieving the lowest average ranking score of 2.28, which is significantly better than the other algorithms. This underscores GBJAYA’s superior overall performance. In comparison, other algorithms such as JAYA, RIME, MVO, ACOR, and GWO have ranking scores of 9.68, 4.45, 4.75, 5.26, and 7.05 respectively, highlighting GBJAYA’s distinct advantage in multi-threshold image segmentation problems. Figure 5 presents the convergence curves of GBJAYA and other algorithms for the test functions F5, F7, F9, F14, F16, F20, F23, F26, and F30. By analyzing these convergence curves, it is clear that the GBJAYA algorithm generally converges faster and achieves better final objective function values. This demonstrates that GBJAYA has strong search capabilities and high convergence precision when solving complex optimization problems. Particularly on functions F7, F14, and F20, GBJAYA’s performance is outstanding, with its convergence curves significantly better than those of other algorithms, validating its balanced ability in global and local search and its overall optimization performance.

Fig. 4
figure 4

The ranking results of GBJAYA and 10 other peers after Friedman analysis.

Fig. 5
figure 5

The convergence curves of GBJAYA and other basic peers.

Comparison with SOTA peers

Table 3 presents the mean and standard deviation results of the GBJAYA algorithm in comparison with ten state-of-the-art (SOTA) optimization algorithms. These include double adaptive random spare reinforced whale optimization algorithm (RDWOA)39, slime mould algorithm with Gaussian kernel probability and new movement mechanism (MGSMA)40, Cauchy and Gaussian sine cosine optimization (CGSCA)41, sine cosine algorithm with linear population size reduction (LSCA)42, hybrid symbiotic differential evolution moth-flame optimization (DSMFO)43, chaotic mutative moth-flame-inspired optimizer (CLSGMFO)44, evolutionary biogeography-based whale optimization (EWOA)45, hybridizing grey wolf optimization (HGWO)46, ant colony optimizer with grade-based search (GACO)47, and bat algorithm based on collaborative and dynamic learning of opposite population (CDLOBA)48 on the IEEE CEC2017 benchmark tests.

The results of the comparison indicate that the GBJAYA algorithm demonstrates substantial superiority across multiple test functions. In particular, it excels on complex functions where its mean and standard deviation outperform those of other algorithms. This showcases GBJAYA’s enhanced search capabilities and stability in these test functions. Additionally, GBJAYA performs exceptionally well in solving complex optimization problems, achieving the lowest mean and standard deviation in most functions, which further confirms the effectiveness and reliability of the algorithm.

Table 3 Optimization results with SOTA peers on IEEE CEC2017 benchmark functions.

Table 4 further validates the performance advantages of GBJAYA through the Wilcoxon signed-rank test. The Wilcoxon signed-rank test results indicate that GBJAYA significantly outperforms other algorithms on most of the 30 test functions. Specifically, GBJAYA demonstrates high performance and consistency in multiple tests, proving its strong adaptability across different types of optimization problems. The ranking results also show that GBJAYA ranks among the top in overall performance, further highlighting its significant advantages in optimization performance.

Table 4 The Wilcoxon signed-rank test results of GBJAYA and SOTA peers.

Figure 6 shows the Friedman ranking results of various algorithms on different benchmark tests. The chart indicates that GBJAYA consistently ranks at the top in most benchmark tests. Specifically, GBJAYA’s ranking is significantly higher than other algorithms in the majority of test functions, demonstrating its overall advantage in various optimization tasks. The Friedman ranking results further support the experimental data in Tables 4 and 5, confirming GBJAYA’s outstanding performance in different optimization problems.

Fig. 6
figure 6

The Friedman ranking results of various algorithms.

Fig. 7
figure 7

The convergence curves of various algorithms on nine test functions.

Figure 7 shows the convergence curves of various algorithms on nine test functions (F5, F7, F8, F10, F12, F14, F20, F28, and F30). Analysis of these convergence curves reveals that GBJAYA exhibits faster convergence speeds and better final objective function values in most test functions. This indicates that GBJAYA has stronger search capabilities and higher convergence accuracy when dealing with complex optimization problems. For instance, in functions like F7, F14, and F20, GBJAYA’s convergence curves are significantly better than those of other algorithms, demonstrating its superior balance between global and local search capabilities and overall optimization performance.

In summary, GBJAYA performs exceptionally well across various test environments, with smaller means and standard deviations, indicating its search capabilities and result stability in optimization problems. Additionally, GBJAYA shows high performance and adaptability in multiple benchmark tests, further proving its effectiveness and reliability in handling complex optimization issues. The Friedman ranking results and convergence curve analysis consistently support these conclusions, confirming GBJAYA’s comprehensive advantages as a powerful optimization algorithm.

Experiment on medical images

In this section, the segmentation efficacy of GBJAYA on COVID-19 X-ray images was evaluated across various threshold levels. The assessment covered both low thresholds (4, 5, and 6) and high thresholds (12, 16, and 20). The segmentation methods involved include different evolution (DE)49, ABC50, MVO37, HHO34, cluster guide particle swarm optimization (CGPSO)51, improved WOA (IWOA)52, slime mould algorithm with bee foraging mechanism (ASMA)53, and Gaussian barebone Salp swarm algorithm with stochastic fractal search (GBSFSSSA)22 and multi-strategy improved social group optimizer (SRDSGO). The experimental results show that GBJAYA performs well at different threshold levels, demonstrating its adaptability in handling complex image segmentation tasks.

Performance evaluation indicators

To comprehensively analyze the experimental results, this paper employs three standard evaluation methods: PSNR27, SSIM28, and FSIM29.

PSNR serves as a crucial metric for assessing image quality, typically used to quantify image distortion during compression and transmission. A higher PSNR value indicates better image quality and less distortion. It is calculated by comparing the ratio of the maximum signal power to the noise power between the original image and the segmented image.

SSIM, on the other hand, is a quality evaluation metric that focuses on structural information. It assesses image quality by analyzing the luminance, contrast, and structural similarity between two images. A SSIM value closer to 1 indicates greater similarity between the images and higher overall image quality. SSIM’s emphasis on structural details makes it particularly effective for evaluating the quality of image segmentation.

FSIM is a quality evaluation metric based on feature similarity. It measures the similarity of images by comparing low-level features such as gradients and phase consistency. The higher the FSIM value, the higher the similarity between the two images at the feature level, and the better the image quality. FSIM performs particularly well in handling complex images and is therefore widely used in evaluating image segmentation quality.

Table 5 provides detailed descriptions of these evaluation methods. This study utilizes the evaluation results obtained from PSNR, FSIM, and SSIM, and compares them using mean, variance, Wilcoxon signed-rank test, and Friedman test. Based on extensive experimental comparisons, GBJAYA demonstrates significant effectiveness in multi-threshold image segmentation. Evaluation results from PSNR, SSIM, and FSIM underscore GBJAYA’s substantial advantages in improving segmentation capability and image quality, making it particularly suitable for complex image segmentation tasks.

Table 5 The definitions and explanations of the three evaluation metrics.

It is worth noting that the multi-threshold image segmentation method adopted in this study is an unsupervised grayscale region partitioning approach and does not rely on pixel-level ground truth segmentation labels. Therefore, commonly used supervised evaluation metrics such as the Dice coefficient, Jaccard index, ASD, and HD95 are not directly applicable to this task. Instead, we employ three no-reference or weak-reference image quality assessment metrics—PSNR, SSIM, and FSIM—to evaluate the differences between the segmented image and the original image in terms of pixel fidelity, structural preservation, and feature similarity. These metrics reflect the visual quality and structural information retention of the segmentation results. Such evaluation methods have been widely adopted in multi-threshold image segmentation tasks, especially in medical imaging scenarios where ground truth labels are unavailable. Additionally, the original scores for eachmethod have been provided in the supplementary material to enhance the transparency and comparability of the evaluation results.

Experimental results on COVID-19 X-ray images

In the supplementary materials, Tables A2–A4 detail the mean and standard deviation results across all segmentation methods using the three performance evaluation metrics (PSNR, SSIM, FSIM). The analysis reveals that GBJAYA frequently achieves the highest mean values and lowest variance across different threshold levels, indicating superior segmentation performance in most scenarios. Particularly at higher thresholds (e.g., levels 16 and 20), GBJAYA excels, underscoring its effectiveness in complex image segmentation tasks. Tables 6, 7 and 8 display the results of the Wilcoxon signed rank test for further evaluation of PSNR, SSIM, and FSIM. These tables consistently show GBJAYA ranking first across all threshold levels in terms of PSNR, SSIM, and FSIM. In the majority of cases, other segmentation methods did not surpass GBJAYA’s performance, highlighting its superior average performance and statistical significance advantages.

Table 6 The results of the Wilcoxon signed-rank test for further analysis of PSNR.
Table 7 The results of the Wilcoxon signed-rank test for further analysis of SSIM.
Table 8 The results of the Wilcoxon signed-rank test for further analysis of FSIM.

Furthermore, Fig. 8 display the Box plot results from the Friedman test, providing additional analysis of PSNR, FSIM, and SSIM. Across all evaluation scenarios, GBJAYA consistently demonstrates superior performance, underscoring its capability to achieve high-quality segmentation of COVID-19 X-ray images. These findings highlight GBJAYA’s numerical excellence and its consistent high performance across diverse evaluation metrics.

Figures 9 and 10 depict the convergence curves of all methods in both 6-level and 20-level threshold segmentations. These curves illustrate GBJAYA’s adeptness in avoiding local optima during segmentation. Particularly at higher threshold levels (e.g., level 20), GBJAYA exhibits faster convergence and greater stability in performance, further validating its efficacy in addressing complex optimization challenges.

Fig. 8
figure 8

Box plot results of the Friedman test for the overall analysis of PSNR, FSIM and SSIM.

Fig. 9
figure 9

The convergence curves of all methods at the 6-level threshold segmentation.

Fig. 10
figure 10

The convergence curves of all methods at the 20-level threshold segmentation.

Finally, Figs. 11 and 12 present the segmentation results for image A under 6-level and 20-level multi-threshold configurations, respectively. It is important to clarify that the objective of this study is unsupervised multi-threshold image segmentation, which partitions a grayscale image into a fixed number of discrete intensity regions based on optimized thresholds. As a result, the output images are piecewise constant, with pixel values mapped to a limited set of grayscale levels (e.g., 7 levels for 6 thresholds). However, for visualization purposes, some of the segmentation outputs in Figs. 11 and 12 were rendered using grayscale interpolation or standard display techniques, which may give the visual impression of continuity. This effect is solely due to rendering; the actual outputs remain discrete in nature, as clarified in the updated figure captions. These visualizations help illustrate the layered segmentation behavior of the proposed GBJAYA method. While they do not replace quantitative metrics, they demonstrate that GBJAYA can effectively separate structural regions, even in challenging cases such as COVID-19 chest X-rays. This supports the method’s potential as a general-purpose unsupervised segmentation approach, suitable for further integration into more advanced biomedical image analysis pipelines.

Fig. 11
figure 11

The specific segmentation results for image A at the 6-level threshold segmentation. (Note: While the image appears continuous, it comprises discrete grayscale regions segmented by optimized thresholds. This qualitative visualization highlights the contrast separation achieved by GBJAYA.).

Fig. 12
figure 12

The specific segmentation results for image A at the 20-level threshold segmentation.

Experimental results on breast cancer images

In this section, to further validate the effectiveness of the proposed GBJAYA algorithm, we conduct multi-threshold image segmentation experiments on breast cancer images. The performance of GBJAYA is compared against ten existing state-of-the-art methods. The supplementary materials (Tables A5–A7) present quantitative evaluation results based on three widely used image quality assessment metrics: PSNR, SSIM, and FSIM. In these tables, the best results among the compared methods are highlighted in bold. A careful analysis of the results reported in Tables A5–A7 reveals that GBJAYA achieves the highest number of bolded (i.e., best) results across various threshold levels. This consistent superiority strongly indicates that, compared to the competing methods, GBJAYA offers a more effective solution for multi-threshold image segmentation tasks.

Furthermore, statistical significance testing was conducted using the Wilcoxon signed-rank test, and the results are reported in Tables 9, 10 and 11. These results provide additional evidence of GBJAYA’s superior performance. Specifically, GBJAYA consistently ranks No.1 across all considered threshold levels for each evaluation metric, demonstrating its overall dominance in performance. Moreover, the average rank of GBJAYA is approximately 1.2 in most cases, indicating its strong performance, particularly under higher threshold levels. The “+/–/=” notation in the tables, which summarizes the number of wins, losses, and ties against each baseline method, further supports this conclusion. Collectively, these findings suggest that GBJAYA is not only statistically superior to existing approaches but also provides a highly competitive and reliable solution for multi-threshold segmentation in medical image analysis.

Table 9 The results of the Wilcoxon signed-rank test for further analysis of PSNR.
Table 10 The results of the Wilcoxon signed-rank test for further analysis of SSIM.
Table 11 The results of the Wilcoxon signed-rank test for further analysis of FSIM.

In addition, Table 12 presents the fitness values—specifically, the two-dimensional (2D) Kapur’s entropy values—achieved by each method for segmenting different images at various threshold levels. These entropy values serve as an objective measure of segmentation quality, where higher entropy generally indicates better segmentation performance. The highest entropy values for each case are highlighted in bold to denote the best-performing method.

From the distribution of bolded values in Table 12, it is evident that GBJAYA achieves the highest number of top-performing results across all tested images. Notably, for threshold levels of 12, 16, and 20, GBJAYA consistently outperforms all other methods, obtaining the best entropy values in every case. This further confirms the superiority of the proposed method. To further evaluate the generalizability of the proposed method, Fig. 13 presents a representative segmentation result on breast cancer histopathological image L at the 20-threshold level. The image demonstrates that GBJAYA can successfully separate tissue regions of varying intensity and texture, even in high-resolution, structurally complex histological data. Similar to the X-ray segmentation, the output is composed of discrete grayscale regions, though the rendering may appear continuous due to display settings. This visual result, together with the corresponding quantitative metrics, supports the method’s potential to generalize across different medical imaging modalities.

In summary, these findings reinforce the conclusion that GBJAYA provides a highly effective solution for multi-threshold segmentation of complex medical images. Its ability to consistently achieve superior results, particularly at higher threshold levels, highlights its strong segmentation potential and practical applicability in challenging image analysis scenarios.

Table 12 2D kapur’s entropy values at different threshold levels on breast cancer images.
Fig. 13
figure 13

The 20-level segmentation result of breast cancer histopathology image L.

Conclusions and future works

This paper introduces GBJAYA, an enhanced JAYA optimization algorithm utilizing the Gaussian bare-bone strategy, tailored for multi-threshold medical image segmentation. GBJAYA was rigorously compared with 10 basic and 10 improved algorithms on IEEE CEC2017 benchmark functions, showcasing superior search capability, convergence speed, accuracy, and ability to avoid local optima. Experimental results across various functions indicated GBJAYA’s strong performance with lower mean values and reduced standard deviations, underscoring its search capabilities and stability. In medical image segmentation experiments, GBJAYA demonstrated outstanding performance across different threshold levels, achieving high-quality segmentation results. Statistical analyses using PSNR, FSIM, and SSIM metrics, supported by Friedman and Wilcoxon tests, validated GBJAYA’s superiority. Convergence curve analysis highlighted GBJAYA’s swift convergence and stable performance at higher thresholds, effectively preventing local optima. In summary, GBJAYA combines theoretical excellence with practical adaptability, establishing itself as an advanced method for multi-threshold image segmentation.

While the proposed GBJAYA method shows promising segmentation performance, current evaluations rely on image-level metrics (PSNR, SSIM, FSIM), which do not fully reflect structural or clinical relevance. Future work will incorporate structure-aware and clinically meaningful metrics where annotations are available. Additionally, per-image inference time was not reported due to the MATLAB/CPU-based prototype. We plan to optimize the implementation (e.g., GPU acceleration) and evaluate runtime efficiency under consistent conditions. Extending GBJAYA to diverse pathological images also holds potential to enhance medical diagnosis and clinical utility.