# Using an Artificial _Physarum polycephalum_ Colony for Threshold Image Segmentation
## 3 Methodology
### Performance Measurement
_Jaccard_ index ranges from 0 to 1, where a value of 1 indicates a perfect overlap or the greatest similarity, but a value of 0 indicates no spatial overlap or an absolute mismatch. Fifth, the Sorensen Dice coefficient (_Dice_) is similar to Jaccard's coefficient but is the double overlap region divided by the total number of pixels in two images. The _Dice_ and _Jaccard_ are positively correlated and are easy to reach a consensus assessment. For example, they both may determine model \(A\) is better than model \(B\) in segmentation performance, or vice versa. The calculation equation is as follows:  
\[Dice=\frac{2|A\cap B|}{|A|+|B|}=\frac{2|A\cap B|}{|A\cup B|+|A\cap B|} \tag{10}\]  
where \(A\) is the segmented image with additive noise and \(B\) is the benchmark image. The numerator \(|A\cap B|\) calculates the overlap area of images \(A\) and \(B\), and the denominator \(|A\cup B|\) describes the fusion area of images \(A\) and \(B\). _Dice_ coefficient also ranges from 0 to 1, where a value of 1 indicates a perfect overlap or the greatest similarity, but a value of 0 indicates no spatial overlap or an absolute mismatch. Sixth, the Structural Similarity Index (_SSIM_) calculates a multiplicative combination of three image components, i.e., brightness, contrast, and texture. The _SSIM_ can describe the scene structure information on an image. For a gray image \(A\), the average gray level \(\mu_{A}\) can be calculated to estimate the brightness, so the brightness can be written as follows:  
\[\mu_{A}=\frac{1}{HV}{\sum_{i=1}^{H}{\sum_{j=1}^{V}{a_{ij}}}}, \tag{11}\]  
where \(H\) represents the image size in the horizontal direction, \(V\) represents the image size in the vertical direction, and \(a_{ij}\) is a pixel on the segmented image \(A\) with a pair of coordinates \((i,j)\). The measurement system removes the average grayscale value \(\mu_{A}\) from the image. For a digital image \(A\), standard deviation \(\sigma_{A}\) can be used as the contrast estimation value. \[\sigma_{A}=\sqrt{\frac{1}{HV-1}{\sum_{i=1}^{H}{\sum_{j=1}^{V}{\left({x_{ij}- \mu_{A}}\right)^{2}}}}} \tag{12}\]  
According to the brightness \(\mu_{A}\) in Equation (11) and the contrast \(\sigma_{A}\) in Equation (12), the texture can be expressed as their function. Therefore, the _SSIM_ can be calculated as follows:  
\[SSIM=\frac{\left({2\mu_{A}\mu_{B}+C_{1}}\right)\left({2\sigma_{A}\sigma_{B}+C_ {2}}\right)}{\left({\mu_{A}^{2}+\mu_{B}^{2}+C_{1}}\right)\left({\sigma_{A}^{2} +\sigma_{B}^{2}+C_{2}}\right)} \tag{13}\]where the average gray level \(\mu_{A}\) and \(\mu_{B}\) estimates the brightness, and the standard deviation \(\sigma_{A}\) and \(\sigma_{B}\) evaluates the contrast. The constant \(C_{1}\) is used to avoid instability of the evaluation system when the brightness approaches 0, often \(C_{1}=(K_{1}L)^{2}\). \(L\) is the grayscale level of the image, i.e., \(L=255\) for 8-bit grayscale images. \(K_{1}\) is a positive constant far less than 1. The constant \(C_{2}\) is used to avoid instability of the evaluation system when the contrast approaches 0, often \(C_{2}=(K_{2}L)^{2}\). \(L\) is the grayscale level of the image, and \(K_{2}\) is a positive constant far less than 1. In the experimental results of Section 5, the performance measurement indicators above are employed for objective evaluation and algorithm comparison, which can objectively verify the proposed APPC algorithm and compare the segmentation performance.