# PPA-SAM: Plug-and-Play Adversarial Segment Anything Model for 3D Tooth Segmentation
## 4 Experiments
### Evaluation Metrics  
In this study, we employ the Dice coefficient (Dice), the Hausdorff distance (HD95), the Average Surface Distance (ASD) and the Jaccard coefficient (Jaccard) metrics for comparative evaluation of experimental results and models.  
The Dice is utilized to measure the similarity between two sets, commonly applied in medical image segmentation to assess the segmentation accuracy of predicted labels. Assuming the segmentation result is represented by \(S\) and the ground truth annotation is denoted as \(G\), the _Dice_ coefficient formula between \(S\) and \(G\) is expressed as follows in Equation (2):  
\[d_{Dice}(S,G)=\frac{2|S\cap G|}{|S|+|G|} \tag{2}\]  
The Hausdorff distance is defined as the maximum distance from one set to another. It is commonly used in image segmentation tasks to calculate the distance between the farthest points on the predicted image's edge and the true image's edge. A smaller value indicates a higher similarity between the two sets. Assuming the segmentation result is denoted as \(S\) and the ground truth annotation is denoted as \(G\), the Hausdorff formula between \(S\) and \(G\) is expressed as shown in Equation (3):  
\[d_{H}(S,G)=\text{Max}\{h(S,G),h(G,S)\};h(S,G)=\max_{s\in S}\min_{g\in G}||s-g| |^{2} \tag{3}\]  
where \(h(S,G)\) represents the distance from \(S\) to \(G\), i.e., for a point \(s\) in \(S\), find the nearest point \(g\) in \(G\), calculate the Euclidean distance between them, and then take the maximum of these distances. Hausdorff corresponds to the most dissimilar regions between two sets. To avoid unreasonable distances caused by certain points being far from the main cluster, this paper calculates the distance of the farthest 95% of pixels as the indicator (HD95) to ensure numerical stability.  
ASD denotes the average distance between the segmentation result's edge and the ground truth's edge. Assuming the segmentation result is denoted as \(S\) and the ground truth annotation is denoted as \(G\), the \(ASD\) formula between \(S\) and \(G\) is expressed as follows in Equation (4):  
\[d_{ASD}(S,G)=\frac{1}{2}\Bigg{(}\frac{1}{n_{S}}\sum_{s\in S}d(s,G)+\frac{1}{n_{ G}}\sum_{g\in G}d(g,S)\Bigg{)} \tag{4}\]  
where \(n_{S}\) and \(n_{G}\) represent the number of non-zero pixels in \(S\) and \(G\) respectively, and \(d(s,G)\) denotes the Euclidean distance from pixel \(s\) to the nearest non-zero pixel in \(G\). Both the Hausdorff and \(ASD\) measure the distance between two sets. However, Hausdorff focuses on the distance between the most dissimilar pair of points, while \(ASD\) is based on the average distance among all points. Therefore, \(ASD\) can provide a more comprehensive assessment of the accuracy of the segmentation results.  
The Jaccard coefficient is commonly used to assess the performance of segmentation algorithms, especially when comparing the similarity between segmentation results and ground truth. It calculates the intersection ratio between predicted and true values. The formula is represented as Equation (5).  
\[d_{ Jaccard}(S,G)=\frac{|S\cap G|}{|S\cup G|} \tag{5}\]  
A larger Jaccard distance indicates a higher overlap between two sets, implying a smaller difference between the segmentation result and the true annotation.