SAM (Segment Anything Model) in Medical Imaging: How It Works and What It Means for FDA-Regulated CV

Segment anything in medical images: how MedSAM and MedSAM2 adapt SAM, where nnU-Net still wins, and why prompted masks are not FDA validation evidence.

SAM (Segment Anything Model) in Medical Imaging: How It Works and What It Means for FDA-Regulated CV
Written by TechnoLynx Published on 11 Jul 2026

“Segment Anything in Medical Images” is the title of the MedSAM paper. The model it describes is Meta’s Segment Anything Model (SAM) fine-tuned on more than a million medical image-mask pairs, so that a box drawn around an organ or lesion returns a usable mask. The training set holds 1,570,263 image-mask pairs covering 10 imaging modalities and over 30 cancer types. Like SAM, MedSAM is promptable: it segments the target marked by a user-drawn bounding box. On its own, a prompted mask is not the validation evidence for clinical imaging that the FDA’s draft guidance describes for AI-enabled devices.

What Is Promptable, Class-Agnostic Segmentation, and How Do Point and Box Prompts Drive SAM’s Mask Output?

SAM is a promptable segmentation model. Given an image and a prompt (a foreground point, a bounding box or a rough mask), it returns a valid segmentation mask for the indicated object, including objects and image distributions it never saw during training. Kirillov et al. (2023) built it alongside the SA-1B dataset, with over 1 billion masks on 11 million licensed images, and designed it to transfer zero-shot to new image distributions and tasks. The base model runs in two modes: an automatic “everything” mode that proposes masks across the whole image, and a manual prompt mode.

SAM is class-agnostic. SAM’s output is a mask for the object you indicated. It attaches no organ name, no lesion type and no pathology call to that mask. SAM was also trained mostly on natural images, and medical image domains pose their own set of challenges.

According to the Segment Anything overview, Meta released SAM 3 in November 2025, adding prompts written as short noun phrases or example images, on top of points, boxes and masks. A noun-phrase prompt is still not a clinical label taxonomy someone has validated against a reference standard, so the same caution applies.

On medical images, the prompt type matters. The MedSAM authors found that bounding boxes give a less ambiguous spatial context than points, which become ambiguous when neighbouring structures look alike, and boxes are also faster to draw when there are several objects.

How Well Does Base SAM Handle CT, MRI and Ultrasound?

It varies widely across datasets, and sometimes it fails outright. Mazurowski et al. (Medical Image Analysis, 2023) tested SAM on 19 medical imaging datasets across modalities and anatomies and found that its performance varies widely from one dataset to the next. Huang et al. found that SAM does better with point and box prompts than in everything mode, works remarkably well on some objects and modalities, and is imperfect or completely fails on others. Their conclusion was that zero-shot capability alone is not enough to apply SAM directly to medical image segmentation.

SAM struggles with low contrast and amorphous target structures. It also struggles with weak boundaries, which leads to under- or over-segmentation. In the MedSAM evaluation, base SAM ranked last on almost every task.

What you are segmenting matters too. In the MedSAM2 study, every method, including general-purpose SAM2.1 variants, often scored above 95% Dice on simple, well-bounded structures such as kidneys and lungs, while the gap opened on heterogeneous targets such as kidney lesions and pancreas. Cardiac ultrasound followed the same pattern: all SAM2.1 models did well on the left ventricle and atrium but varied more on the left ventricle epicardium, where appearance and shape change more.

Fine-tuning on medical data changes the picture. On nasopharynx cancer segmentation, MedSAM reached a median Dice of 87.8%, which the authors report as a 52.3% improvement over SAM. The MedSAM2 authors draw the general lesson that transfer learning is an effective way to adapt general-domain segmentation models to medical imaging.

How Do Medical-Specialised Variants (e.g. MedSAM) Differ from Base SAM, and When Are They Worth Adopting?

MedSAM keeps SAM’s architecture and retrains its image encoder and mask decoder. MedSAM consists of a Vision Transformer (ViT) image encoder, a prompt encoder that takes bounding boxes, and a lightweight mask decoder, and it works on 1024×1024 inputs. The lighter LiteMedSAM variant, an efficient SAM, takes 256×256 inputs. Training started from the pre-trained SAM ViT-Base. The prompt encoder stayed frozen, and all parameters of the image encoder and mask decoder were updated: 89,670,912 and 4,058,340 respectively. The authors simulated box prompts from expert annotations with a random 0-20 pixel perturbation.

Operationally, the bigger change is that one MedSAM model segments all modalities, while the specialist U-Net and DeepLabV3+ baselines each needed a model per modality. The authors also name its limits. CT, MRI and endoscopy dominate the training set, which may hurt performance on modalities such as mammography. Vessel-like branching structures are hard because a single box can enclose both arteries and veins.

An independent study of pelvic MR (a preprint of a 2025 Medical Physics paper) found that out-of-the-box MedSAM and LiteMedSAM performed poorly, especially on disjoint or non-convex structures, and that changing the box prompt made little difference. Its authors suggest that MedSAM’s diverse training data may bias the decoder towards contiguous, convex shapes.

Our reading is that MedSAM is worth adopting over base SAM whenever the targets are lesions or weak-boundary structures in the modalities it was trained on, because base SAM struggles with weak boundaries and ranked last on almost every MedSAM task. For mammography, vessels, or bilateral and disjoint anatomy, treat MedSAM as a starting point for fine-tuning rather than a finished tool.

Segment Anything in 3D Medical Images and Videos: SAM 2 and MedSAM2

The original SAM and MedSAM are 2D models. A 3D volume gets split into slices, each slice is segmented independently, and the results are stacked back into the volume. The MedSAM2 authors point out that models built for 2D data can miss the spatial relationships in volumes and the temporal information in video.

SAM 2 (Meta, July 2024) treats an image as a single-frame video. It replaced SAM’s ViT encoder with a hierarchical Hiera backbone and added a streaming memory (memory encoder, memory bank and memory attention) that stores embeddings of past frames, so objects can be tracked through occlusions. Its authors report better video accuracy with three times fewer interactions than earlier approaches, and image segmentation that is more accurate and six times faster than SAM.

MedSAM2 adapts SAM 2 to medical data. It is SAM 2 fine-tuned on more than 455,000 3D image-mask pairs and 76,000 video frames. The changes fit medical data. The input size drops from 1024×1024 to 512×512, which suits typical medical image sizes and cuts compute. A four-layer memory attention module conditions each slice or frame on a memory bank of earlier ones, which exploits spatial continuity in volumes and temporal coherence in video. For 3D images, MedSAM2 takes the box on the middle slice and propagates the mask in both directions to the ends of the volume.

The fine-tuning shows on hard cases. On a hard polyp subset, SAM2.1 models lost 6.29% to 10.33% Dice, while MedSAM2 held 92.22%. Across tasks, MedSAM2 consistently beat SAM2.1 with less variability. It has limits too: relying on box prompts holds it back on thin, branching vessels, and because the model does not explicitly model 3D spatial continuity, long, curved 3D objects can trip it up. MedSAM2 was released in the official MedSAM repository on 7 April 2025.

Is SAM or MedSAM the Best Model for Medical Image Segmentation, or Do Task-Specific Models Like U-Net Still Have a Place?

No single model is best. The answer depends on whether you need one prompted model across many tasks and sites, or the strongest possible model for one fixed task you can train for. The published studies were asking different questions.

The MedSAM paper reports MedSAM ranking first on most tasks against U-Net and DeepLabV3+ specialists. Its U-Net baseline was nnU-Net given the box as an extra input channel and trained per modality, not per task. When the authors trained task-specific U-Nets, those models did very well on internal validation but dropped significantly on external datasets, while MedSAM stayed consistent.

The pelvic MR study evaluated one specific task and got the opposite answer. A benchmark nnU-Net was significantly better in Dice for every structure, and MedSAM scored 10-20% lower on well-defined structures such as bladder, rectum and prostate. After fine-tuning, though, LiteMedSAM matched nnU-Net, with no significant difference on most structures. For how to do that fine-tuning, see our piece on fine-tuning the Segment Anything Model.

Isensee et al. explain why the choice of baseline matters in these comparisons. They found that many claims for newer architectures do not hold up once you check for weak baselines, unsuitable datasets and ignored compute budgets. In their benchmark, the recipe for top performance was a CNN-based U-Net run in the nnU-Net framework and scaled to modern hardware. Transformer-based architectures generally failed to match CNNs. For a single regulated product both results apply: the pelvic study answers within-task accuracy, and the MedSAM paper’s external-site drop answers robustness.

Comparison: Where Each Option Fits

Option What it is Where it fits Where it falls short
Base SAM Promptable, class-agnostic model trained mostly on natural images Clear, well-bounded structures; quick prototyping Low contrast, amorphous targets, weak boundaries
MedSAM / LiteMedSAM SAM fine-tuned on over a million medical image-mask pairs, box-prompted, 2D One model across many modalities and tasks, consistent on external data Vessels, under-represented modalities, disjoint or non-convex shapes
MedSAM2 SAM 2 fine-tuned for 3D volumes and video with memory attention Volumetric lesions, echocardiography, endoscopy video Thin branching and long curved 3D structures
nnU-Net Self-configuring U-Net framework One fixed task with training data; strongest within-task baseline Needs task-specific training; can degrade on external sites

How Can We Use the MedSAM GitHub Code to Speed up Annotation?

The open-source MedSAM code is most useful as a pre-annotation tool: an expert draws a box, MedSAM drafts the mask, and the expert corrects it. The official repository on GitHub carries the code, and an official MedSAM-Lite plugin brings it into 3D Slicer. In the plugin you load the image, run a one-off preprocessing step per image, place a region of interest, click Segmentation, and then manually refine the result in Slicer’s segmentation tools. The MedSAM2 plugin uses a client-server design, so inference can run on a workstation or on a remote compute cluster. Its interface offers CT and MRI intensity presets, start and end slices for the region, a box on the key slice, and the option to load your own fine-tuned model.

The time savings reported in the MedSAM and MedSAM2 studies come from workflows where experts revised the model’s outputs. In the MedSAM study, experts drew tumour axes every 3-10 slices, MedSAM segmented from those sparse marks, and the experts revised the result until satisfied. Annotation time for 3D adrenal tumours fell by 82.37% and 82.95% for the two experts. MedSAM2’s human-in-the-loop study fine-tuned the model on each round’s corrected annotations. CT lesion annotation went from 525.9 seconds per lesion by hand to 289.2, then 185.3, then 74.3 seconds over three rounds. Echocardiogram annotation went from 102.3 seconds per frame to 8.4. The authors summarise the result as a reduction in manual cost of more than 85%.

Prompt quality affects the result. In the pelvic MR study, boxes taken from nnU-Net predictions produced significantly lower Dice than boxes taken from ground truth on several structures. If you automate the box step, part of the saving comes back as correction time.

What Human-in-the-Loop Review Is Required Before SAM-Generated Masks Enter a Training Set or Clinical Workflow?

Every model-drafted mask needs expert sign-off before it counts as ground truth. The authors of the pelvic MR study argue that off-the-shelf foundation models need specialised refinement and adjudication. The FDA’s draft guidance on AI-enabled device software functions lists how data were annotated as part of the data management a reviewer evaluates. The checklist below is how we would structure that review:

  1. Record provenance per mask. Note the model and version, the prompt (box coordinates, key slice) and the reviewing annotator, so that any model-assisted label can be traced later.
  2. Review every mask, not a sample. The published savings come from experts revising each output, not from spot checks.
  3. Look hardest at the known failure classes. These are vessels and branching structures, disjoint or bilateral anatomy, non-convex shapes, weak boundaries and under-represented modalities such as mammography.
  4. Adjudicate disagreements. Where two experts’ corrections differ, a defined adjudication step decides the label, so that model bias does not settle the matter by default.
  5. Freeze the model between rounds. In an iterative pipeline like MedSAM2’s, each round fine-tunes the model on new labels, so record which version drafted which batch.
  6. Keep model-assisted masks out of the test reference standard. The FDA draft expects the criteria and expertise behind the clinical reference standard to be stated. A reference standard drafted by the model family under test would measure agreement with itself.

Why a Prompted Mask Is Not FDA Validation Evidence

The first question is whether this use of SAM is regulated at all. Often a team assumes everything is constrained when much of the pipeline is not, and checking the actual FDA regulatory scope for imaging AI is the right first step. The FDA draft guidance defines a device software function by its distinct purpose, tied to the product’s intended use, and an AI-enabled device software function as one that uses a model to achieve that purpose. Read against that definition, a MedSAM instance that only drafts training labels is a data-preparation tool rather than the device’s intended-use function. Its outputs still feed into the annotation and data-management record that reviewers examine. Once the masks reach a clinician, or a measurement such as tumour volume is computed from them, the model sits inside the device. The document is a draft and marked as non-binding, so treat everything below as the direction of the guidance, not a final rule.

Inside the device, a prompted mask is not evidence for three reasons. First, the draft guidance describes performance validation as objective evidence that the device performs predictably and reliably in the target population. A mask shaped by one person’s box on one image shows neither of those things. Second, a reference standard is the best available truth for each case, validated by current medical and regulatory practice, and segmentation of contours is explicitly one of the clinical tasks it covers. A zero-shot mask is a candidate for review against that standard, not the standard itself. Third, test data should be independent of training data and sequestered from developers, which our overview of the FDA rules for AI-enabled medical devices covers in full.

Even a perfect Dice score answers only the standalone question. The draft guidance separates standalone assessments, which measure the model without human interaction, from reader studies, which compare clinicians working with and without the device. For AI that supports clinical decisions in imaging, reader studies are usually the primary performance evaluation, because they show clinical benefit in the hands of the intended user. Mask overlap is standalone evidence at best: it says nothing about whether a radiologist reading with MedSAM’s contours does better than one reading without them.

Two further expectations collide with how foundation models get used. The guidance asks sponsors to document the tested model version and any differences from the released version, so the model cannot be adjusted after the fact in light of test data. An iterative fine-tuning loop produces a new version every round. The guidance also warns that models can learn features unique to specific scanners, sites or subpopulations, which produces AI bias. MedSAM’s own authors report a modality imbalance in its training data, so that bias has to be characterised for your population, not assumed away.

Evidence that an auditor can sign against is an engineering output in its own right, and TechnoLynx builds it as AI engineering for healthcare (evaluations, traceability and lineage for model decisions), not as policy advice or certification.

The judgement that remains is where, in your own pipeline, a mask stops being a draft. If an expert-reviewed MedSAM output only ever becomes a training label, you gain annotation speed and a provenance record to keep. If any model output reaches a reader or a measurement unreviewed, you have taken on a device function that needs its own reference standard, its own frozen version and, most likely, its own reader study.