# Using an Artificial _Physarum polycephalum_ Colony for Threshold Image Segmentation
## 3 Methodology
### Performance Measurement  
This subsection describes the evaluation indicators for the performance measurement of threshold image segmentation. These indicators can measure the segmentation performance from different aspects based on the original image, where the original image is a reference and the segmentation models from the same original image are subjected to the image noise. In the benchmark tests of Section 5, the indicators can help us compare the performance difference between the proposed APPC algorithm and the traditional artificial intelligence ones. First, the mean squared error (_MSE_) is a popular index to measure the difference between two images by computing the average sum of the squares between two images. The _MSE_ can evaluate the total difference of all pixels on two whole images, where a lower _MSE_ value means less difference between two images. The _MSE_ can be written as follows:  
\[MSE=\frac{1}{HV}\sum_{i=1}^{H}\sum_{j=1}^{V}\left(a_{ij}-b_{ij}\right)^{2}, \tag{6}\]  
where \(H\) represents the image size in the horizontal direction, \(V\) represents the image size in the vertical direction, \(a_{ij}\) is a pixel on the segmented image \(A\) with a pair of coordinates \((i,j)\), and \(b_{ij}\) is a pixel on the benchmark image \(B\) with a pair of coordinates \((i,j)\). The drawback of _MSE_ is that the value often has the same weight in different grayscale. For example, a high _MSE_ can be obtained from a noisy background on a well-recognizable image. Second, the peak signal-to-noise ratio (_PSNR_) is an important indicator of the quality of image segmentation. It calculates the ratio of the effective signal to the noise signal on an image, that is, the ratio of the segmented image to the benchmark image. According to the mean square deviation in Equation (6), the _PSNR_ can be defined for two images with the same size:  
\[PSNR=10\times\log\left(\frac{L^{2}}{MSE}\right) \tag{7}\]  
where _MSE_ is the mean squared error in Equation (6), and \(L\) is the grayscale level of the image. A high _PSNR_ often means high quality, and a low _PSNR_ often means low quality. A high _PSNR_ also indicates good image recognition. Third, the correlation coefficient (_CorCoe_) is also a popular indicator to measure the linear correlation between two images. The _CorCoe_ can compare the intensity difference of each pixel between two images and the average intensity difference between two whole images. The _CorCoe_ can be calculated as follows:  
\[CorCoe=\frac{\sum_{i}^{H}\sum_{j}^{V}\left(A_{ij}-\overline{A}\right)\left(B_{ ij}-\overline{B}\right)}{\sqrt{\sum_{i}^{H}\sum_{j}^{V}\left(A_{ij}- \overline{A}\right)^{2}}\sqrt{\sum_{i}^{H}\sum_{j}^{V}\left(B_{ij}-\overline{ B}\right)^{2}}} \tag{8}\]where \(A_{ij}\) and \(B_{ij}\) indicate the intensity value on each pixel with a pair of coordinates \((i,j)\) for two images A and B, respectively. \(\overline{A}\) and \(\overline{B}\) indicate the arithmetic mean of intensity value for two images \(A\) and \(B\), respectively. \(H\) represents the image size in the horizontal direction, and \(V\) represents the image size in the vertical direction. The _CorCoe_ metric often takes values in [\(-1\), \(1\)], where \(1\) represents the highest match between two images, but \(-1\) represents the lowest match between two images. Fourth, [PERSON]'s index (_Jaccard_), also called Intersection-Over-Union, IoU, is another popular indicator to measure the segmentation quality. The _Jaccard_ metric calculates the size of the intersection divided by the union size of each set of pixels to measure the similarity between finite sets of pixels. The calculation equation can be obtained as follows:  
\[Jaccard=\frac{|A\cap B|}{|A\cup B|}=\frac{|A\cap B|}{|A|+|B|-|A\cap B|} \tag{9}\]  
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\).