Skip to main content
. 2026 Jun 9;12(6):256. doi: 10.3390/jimaging12060256
Algorithm 1: Anchor-Teeth Guided Inference Algorithm.
Input: Sorted predicted teeth list P with class labels and probabilities
Output: Refined teeth list with corrected class labels
  1. Define reference rule:

    R = [8,7,6,5,4,3,2,1,1,2,3,4,5,6,7,8]

  2. Extract predicted labels Lp and probabilities Sp from P

  3. Initialize:

    max_len = 0

    best_pred_start = −1

    best_ref_start = −1

    best_score = −1

  4. For each r in [0, |R|):

    For each p in [0, |Lp|):
    • match_len = 0, score = 0
    • While R[r + match_len] == Lp[p + match_len]:
      • score += Sp[p + match_len]
      • match_len += 1
    • If (match_len > max_len) OR
      (match_len == max_len AND score > best_score):
      • Update best_pred_start, best_ref_start
      • max_len = match_len
      • best_score = score
  5. If max_len > 0

    For each index i in P:
    • ref_idx = best_ref_start + (i − best_pred_start)
    • If 0 ≤ ref_idx < |R|:
      • P[i].cls = R[ref_idx]
  6. Return P