Medical image segmentation
Labelling organs, lesions and structures in CT, MRI, ultrasound and pathology images with U-Nets, self-configuring pipelines and promptable foundation models.
On this page16 sections
Radiotherapy planning, volumetry, surgical planning, radiomics and quantitative imaging biomarkers all depend on segmentations whose reliability must be known.
Teaching computers to outline organs and tumours in medical scans.
- 1Scan from CT or MRI
- 2Network labels each voxel
- 3Compare with expert outline
- 4Check on unseen hospitals
- 5Flag cases where it fails
The task. Assign a class to every pixel (2D) or voxel (3D). The loss is typically cross-entropy plus a Dice term. The Dice score between predicted region and reference is ; for boundary quality one also uses surface distances. Small lesions make Dice unstable, so metric choice matters (the Metrics Reloaded recommendations).
Architectures. U-Net: an encoder reduces resolution while increasing feature channels; a decoder upsamples, with skip connections passing fine detail across. nnU-Net automatically configures preprocessing, patch size, network depth and post-processing from dataset statistics and won many challenges. The 2024 "nnU-Net Revisited" study concluded that scaled CNN U-Nets still beat transformer and Mamba-based alternatives in 3D when validated rigorously.
Foundation models. SAM shows that a promptable model can segment anything in natural images; MedSAM and relatives fine-tune it on medical images with box, click or text prompts. Results are mixed: strong in 2D and for prompted tumours, weaker than nnU-Net in several 3D tasks, and they need accurate prompts.
Evaluation traps. Patients appearing in both training and test sets; different scanners; annotators who disagree; models that confidently fail on unseen conditions. Reliable per-case failure detection, using uncertainty and calibration, is as important as average accuracy.
Skills. Convolutional and transformer networks, class imbalance, augmentation, domain shift, calibration, clinical validation.
Try it. Run the free TotalSegmentator tool on a public CT scan, then compare its organ outlines with a second tool using the Dice score; you will see that agreement is high for large organs and much lower for thin or small structures.
Go deeper
The full technical text.
What it is
Assign a class to every pixel or voxel of a medical image. Targets range from organs (CT multi-organ) to tumours and sub-structures (MRI brain), to cells in histology. Quality is measured against human reference annotations, which themselves differ between annotators (inter-rater variability), so the practical ceiling is not 100 percent overlap.
The core machinery
U-Net (Ronneberger et al. 2015): an encoder-decoder with skip connections and a per-pixel loss, typically Dice plus cross-entropy, where . nnU-Net (Isensee et al. 2021) automates the pipeline (preprocessing, patch size, architecture, training, post-processing) from dataset statistics and has won or tied most public challenges; the 2024 "nnU-Net Revisited" study found that newer transformer and Mamba architectures did not beat a well-tuned, scaled CNN U-Net in 3D.
Foundation models. SAM (2023) introduced promptable segmentation; MedSAM, SAM-Med3D, MedSAM2, BiomedParse and nnInteractive adapt this to medical data with box, click or text prompts, aiming at a single model that works across modalities and anatomies. Whole-body CT labelling (TotalSegmentator) is the best-established general-purpose product.
Evaluation is half the field
Overlap (Dice) and boundary metrics (Hausdorff, NSD) behave differently for small lesions; Metrics Reloaded (Maier-Hein et al. 2024) gives principles for metric choice. Leakage across patients, scanners and sites, annotation drift and prevalence shift produce optimistic results. Reliable systems also need per-case quality estimates and out-of-distribution detection.
Techniques to master
Convolutional and transformer segmentation networks, loss design for class imbalance, data augmentation, domain adaptation, uncertainty quantification and calibration, conformal prediction for set-valued segmentations, and clinical endpoint validation (e.g. dose planning impact).
Where it bites
One open problem: a single model that, on previously unseen anatomies, pathologies, scanners and modalities, performs within the range of expert inter-rater variability, with reliable detection of its own failures.
Words on this page (8)
- image segmentation
- Labelling every pixel or voxel of an image, for example marking which ones belong to a tumour.
- Dice score
- A number from 0 to 1 measuring how much two outlined regions overlap; 1 means identical.
- U-Net
- A neural network shaped like the letter U that shrinks an image to understand it and then expands it to label each pixel.
- neural network
- A computer program made of many adjustable numbers that learns patterns from examples instead of following hand-written rules.
- inter-rater variability
- The disagreement between two experts who label the same image; it sets a ceiling on how accurate any model can look.
- transformer
- A neural network design that lets every part of its input look at every other part; it underlies modern language and structure models.
- calibration
- When a model says 80 percent, it is right about 80 percent of the time.
- benchmark
- A fixed test set and scoring rule that lets different methods be compared fairly.
New to this? Read first (3)
- Image segmentation (Wikipedia)Concepts and methods, including medical uses.
- U-Net (Wikipedia)Why this network shape suits small medical datasets.
- Medical Segmentation DecathlonThe multi-task benchmark that shaped general medical segmentation.
Understanding map
map of the whole wiki →What to read before Medical image segmentation (left), and what builds on it: entries that depend on it and its open problems (right). Every box links to its page.
- Start with
- Fast matrix multiplicationAlgorithm
- Reverse-mode automatic differentiationAlgorithm
- Step 2
- The transformer architectureAlgorithm
- PyTorchLibrary
- Step 3
- Medical image segmentationYou are here
- Then
Open problems & questions
Progress timeline
- May 2, 2025Lung CT tumour benchmark of foundation modelsRelated to: Segmentation foundation models matching inter-rater variability on unseen anatomies, pathologies and scannerssource
Reports MedSAM 2 outperforming conventional models on tumour delineation (preprint).
- Apr 15, 2024nnU-Net RevisitedRelated to: Segmentation foundation models matching inter-rater variability on unseen anatomies, pathologies and scannerssource
Scaled CNN U-Nets beat newer architectures in 3D when validated rigorously.
- Apr 15, 2024nnU-Net Revisitedsource
Rigorous comparison finds that scaled CNN U-Nets beat transformer and Mamba variants in 3D medical segmentation.
- Jan 22, 2024MedSAMRelated to: Segmentation foundation models matching inter-rater variability on unseen anatomies, pathologies and scannerssource
Foundation model trained on 1.57 million image-mask pairs, evaluated on 146 tasks.
- Jan 22, 2024MedSAMsource
SAM fine-tuned on about 1.57 million image-mask pairs across 10 modalities, evaluated on 86 internal and 60 external tasks.
- Feb 2, 2021nnU-NetRelated to: Segmentation foundation models matching inter-rater variability on unseen anatomies, pathologies and scannerssource
Self-configuring segmentation sets state of the art across many public datasets.
- Feb 2, 2021nnU-Netsource
Self-configuring segmentation pipeline outperforms bespoke methods across 23 public datasets.
- May 18, 2015U-Netsource
Skip-connected encoder-decoder trained with heavy augmentation on very few annotated images.