Segmentation by registration-enabled SAM prompt engineering using five reference images

Yaxi Chen, Aleksandra Ivanová, Shaheer U. Saeed, Rikin Hargunani, Jie Huang, Chaozong Liu, Yipeng Hu · DOI

Abstract

The recently proposed Segment Anything Model (SAM) is a general tool for image segmentation, but it requires additional adaptation and careful fine-tuning for medical image segmentation, especially for small, irregularly-shaped, and boundary-ambiguous anatomical structures such as the knee cartilage that is of interest in this work. Repaired cartilage, after certain surgical procedures, exhibits imaging patterns unseen to pre-training, posing further challenges for using models like SAM with or without general-purpose fine-tuning. To address this, we propose a novel registration-based prompt engineering framework for medical image segmentation using SAM. This approach utilises established image registration algorithms to align the new image (to-be-segmented) and a small number of reference images, without requiring segmentation labels. The spatial transformations generated by registration align either the new image or pre-defined point-based prompts, before using them as input to SAM. This strategy, requiring as few as five reference images with defined point prompts, effectively prompts SAM for inference on new images, without needing any segmentation labels. Evaluation of MR images from patients who received cartilage stem cell therapy yielded Dice scores of 0.89, 0.87, 0.53, and 0.52 for segmenting femur, tibia, femoral- and tibial cartilages, respectively. This outperforms atlas-based label fusion and is comparable to supervised nnUNet, an upper-bound fair baseline in this application, both of which require full segmentation labels for reference samples.

Introduction

The Segment Anything Model (SAM) has revolutionized general-purpose image segmentation. However, its application to medical imaging remains challenging due to the specialized nature of clinical data. Anatomical structures like knee cartilage are often small, thin, and exhibit ambiguous boundaries. Furthermore, clinical workflows rarely allow for the extensive manual annotation required to fine-tune large models or the slice-by-slice manual prompting needed for 3D volumes.

This paper introduces a "shortcut" for medical segmentation: Registration-Enabled SAM Prompt Engineering. By leveraging classic image registration, the framework allows SAM to segment complex structures using only five weakly-labeled reference images, bypassing the need for large-scale supervised training.

Methodology

The core innovation lies in using image registration as a spatial "translator" between a small set of reference images and a new patient scan. A radiologist provides "weak labels" (a few points) for only five reference images. When a new scan arrives, the system calculates the spatial transformation between it and the references using the NiftyReg package.

Two primary strategies were evaluated:

  1. Image Alignment (I-align): The new image is warped to match the reference space. SAM segments the warped image using the reference's pre-defined points, and the result is warped back.
  2. Prompt Alignment (P-align): The reference points are warped directly onto the new patient's scan. SAM then performs segmentation on the original patient scan using these "borrowed" prompts.
Overview of the Vision Prompt Alignment (P-align) framework. Reference prompts are warped to the new image space using registration-derived transformations.

In both workflows, the outputs from the five references are combined via majority voting to ensure a robust final prediction.

Experimental Setup

The study utilized a specialized dataset of Knee Joint MRIs from 35 patients who had undergone cartilage stem cell transplantation. This "repaired" tissue presents a unique challenge as it differs significantly from healthy cartilage. Images were preprocessed to a consistent $512 \times 512 \times 40$ volume. Only 5 images served as the reference set, while the remaining 30 were used for testing.

Results and Discussion

The proposed framework achieved high accuracy for bone segmentation, with Dice scores of 0.89 for the Femur and 0.87 for the Tibia. Cartilage segmentation, a significantly more difficult task due to its thin and curved geometry, yielded Dice scores of 0.53 (Femoral cartilage) and 0.52 (Tibial cartilage).

Quantitative evaluation of cartilage segmentation performance. The proposed methods (Ours:I-align and Ours:P-align) are compared against various baselines including nnUNet.

As shown in the results table, the registration-enabled SAM significantly outperformed traditional atlas-based label fusion methods, which struggled with cartilage (scoring as low as 0.22). Remarkably, the performance was statistically comparable to nnUNet, the current gold standard for supervised medical segmentation, despite the proposed method requiring far less annotation effort.

Conclusion

Registration-enabled prompt engineering provides a viable pathway for deploying powerful foundation models like SAM in data-scarce clinical environments. By requiring only weak labels for a handful of reference images, this approach drastically reduces the barrier to entry for high-quality medical image segmentation. Future work will explore targeted registration at bone-cartilage interfaces and optimized reference selection to further improve performance on thin anatomical structures.

Summary updated

BibTeX
@misc{chen2024segmentation,
  author = {Yaxi Chen and Aleksandra Ivanová and Shaheer U. Saeed and Rikin Hargunani and Jie Huang and Chaozong Liu and Yipeng Hu},
  title = {{Segmentation by registration-enabled SAM prompt engineering using five reference images}},
  year = {2024},
  eprint = {2407.17933},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2407.17933},
}
Figure