All models

Multi-Modal Foundation · Wang Lab, University of Toronto

MedSAM

A promptable medical image segmentation model fine-tuned on CT, MRI, X-ray, ultrasound, and histology data.

What MedSAM is

MedSAM is a foundation model developed by wanglab for medical image segmentation. Built upon the Segment Anything Model (SAM) architecture with a Vision Transformer Base (ViT-Base) backbone, it adapts universal promptable segmentation to biomedical imaging.

The model addresses the challenge of segmenting anatomical structures and pathological targets across diverse clinical imaging modalities. It has been fine-tuned on a collection of computed tomography (CT), magnetic resonance imaging (MRI), radiography (X-ray), ultrasound, and histology imagery, allowing researchers and clinicians to extract masks using spatial prompts.

How it works

MedSAM consists of a vision encoder, a prompt encoder, a mask decoder, and a prediction neck. The VisionEncoder is a Vision Transformer that computes image embeddings using self-attention over image patches along with relative positional embeddings. The PromptEncoder converts user-supplied prompts, such as spatial points or bounding boxes, into feature embeddings.

The MaskDecoder is a two-way transformer that conducts bidirectional cross-attention between image embeddings and prompt embeddings. A neck module then computes the final segmentation masks based on the contextualised representations produced by the decoder.

Key facts

Architecture
Vision Transformer Base (ViT-Base) with prompt encoder and mask decoder
Input prompt types
One bounding box here; the model itself also takes points
Supported modalities
CT, MRI, X-ray, ultrasound, histology
Primary task
Medical image mask generation

What you can use it for

Radiological Image Segmentation
Extracting anatomical and pathological segmentations from CT, MRI, and X-ray images using a box prompt.
Ultrasound Target Delineation
Generating object masks for structures within ultrasound scans based on spatial guidance.
Histology Tissue Segmentation
Segmenting histological structures and cellular regions in microscopic pathology images.

Run it here

No installation and no GPU of your own: fill in the inputs and it runs on our servers. Results stay in your browser unless you sign in.

Runs on On-demand GPU

Runs on our servers with on-demand compute. A first run needs time to load the model; active capacity can be reused and scales down when idle.

Run this model

MedSAM

One 2D slice or image as PNG or JPEG. Greyscale is fine.

Left, top, right, bottom in pixels of the image as uploaded. Leave empty to use the whole image, which MedSAM was not trained for.

Needs image

Strengths and limits

Good at

  • Fine-tuned across diverse medical modalities including CT, MRI, X-ray, ultrasound, and histology.
  • Accepts flexible spatial prompting via coordinates and bounding boxes to define segmentation targets.
  • Employs bidirectional cross-attention between image and prompt embeddings to generate contextualised masks.

Watch out for

  • For research use only: it is not a medical device and must not be used for diagnosis, treatment or any clinical decision.
  • Needs a bounding box around the structure of interest; point prompts, which the model also accepts, are not offered here.
  • Training coverage is specific to the documented modalities of CT, MRI, X-ray, ultrasound, and histology.

Inputs and outputs

You provide

  • Image

    One 2D slice or image as PNG or JPEG. Greyscale is fine.

  • Box around the structureoptional

    Left, top, right, bottom in pixels of the image as uploaded. Leave empty to use the whole image, which MedSAM was not trained for.

You get back

  • The mask drawn over the image with the box, and the bare mask as a black-and-white image.

  • The box used, the mask's area and extent in pixels, the model's own quality estimate, and the research-use limitation.

MedSAM API

The same run, from your own code: one HTTP request with an API key, billed in the same credits as the Run button. A fast run answers with its outputs; a longer one answers with a poll_url to read.

This model takes a file, which is sent in inputs as a data URI under the field's name.GET https://corollary-labs.com/api/v1/models/wanglab-medsam-vit-base lists every field.

Make an API key, then read the models reference.

Licence

Commercial use permitted · Apache-2.0

Read on 2026-11-28. The Hub card declares `license: apache-2.0` and the repository is public and not gated. The weights are a conversion of the checkpoint released by the MedSAM authors, whose code repository (bowang-lab/MedSAM) carries an Apache-2.0 LICENSE file, as does Segment Anything, the model it was fine-tuned from. Apache-2.0 permits commercial use. Provenance, not licence: MedSAM was trained on public medical imaging datasets that each have terms of their own, and neither the card nor the code licence carries any of them over to the weights. The model has no regulatory clearance and is not offered here as a medical device.

Questions

Can I use MedSAM commercially?

Commercial use permitted. Read on 2026-11-28. The Hub card declares `license: apache-2.0` and the repository is public and not gated. The weights are a conversion of the checkpoint released by the MedSAM authors, whose code repository (bowang-lab/MedSAM) carries an Apache-2.0 LICENSE file, as does Segment Anything, the model it was fine-tuned from. Apache-2.0 permits commercial use. Provenance, not licence: MedSAM was trained on public medical imaging datasets that each have terms of their own, and neither the card nor the code licence carries any of them over to the weights. The model has no regulatory clearance and is not offered here as a medical device.

How do I run MedSAM without installing anything?

Use the form under “Run it here” on this page: fill in the inputs and press Run model. It runs on our servers on CPU only, typically in 15s, and a run costs about 14 credits. Visitors without an account get 1,000 credits a month.

What prompts can be passed to MedSAM?

MedSAM was built to take points and bounding boxes as prompts. Here it is run with one bounding box, or with the whole image when no box is given.

Which imaging modalities does the model support?

The model is fine-tuned on CT, MRI, X-ray, ultrasound, and histology images.

What is the model architecture?

MedSAM is built on the Segment Anything Model ViT-Base architecture, containing a ViT vision encoder with relative positional embeddings, a prompt encoder, a two-way transformer mask decoder, and a prediction neck.

How to cite it

Kirillov, Alexander and Mintun, Eric and Ravi, Nikhila and Mao, Hanzi and Rolland, Chloe and Gustafson, Laura and Xiao, Tete and Whitehead, Spencer and Berg, Alexander C. and Lo, Wan-Yen and Dollar, Piotr and Girshick, Ross. (2023). Segment Anything. arXiv:2304.02643.

Written from MedSAM's own documentation (model card, paper). Statements citing a figure that does not appear there are removed before publication. Licence and running details come from our registry.