Automatic tracking and segmentation of blood vessels in CT and MR images using deep learning and geometric tracking
SeqSeg is a novel method for automatic vessel segmentation that combines local deep learning predictions with geometric tracking algorithms. The approach segments vessels sequentially by taking steps along vessel centerlines and detecting bifurcations, enabling robust segmentation of complex vascular trees from minimal initialization.
Key Features:
- Minimal supervision: Requires only 1-2 seed points for initialization
- Robust bifurcation detection: Automatically identifies and follows vessel branches
- Multi-modal support: Works with CT, MR, and other 3D medical imaging modalities
- Scalable: Handles vessels from small coronaries to large aortas
- Clinical validation: Tested on diverse vascular anatomies including coronary, aortic, cerebral, and pulmonary vessels
Performance Highlights:
- Dice similarity coefficient: >0.9 on validation datasets
- Processing time: ~2-10 minutes per case (depending on vessel complexity)
- Computational requirements: Standard CPU and GPU (for faster inference) hardware
Real-time demonstration: Automatic segmentation of abdominal aorta in 3D MR scan
- Quick Start
- Algorithm Overview
- Installation
- Usage
- Performance & Benchmarks
- Configuration
- Research & Development
- Citation
For immediate use with pre-trained models:
# Install
pip install seqseg
# Download weights (see tutorial for links)
# Run segmentation
seqseg -data_dir your_data/ -nnunet_results_path path/to/weights/ -config_name aorta_tutorial📖 Complete Tutorial: Step-by-step guide with example data and detailed instructions.
SeqSeg employs a sequential tracking approach that combines:
- Local CNN Segmentation: nnU-Net provides probabilistic segmentation of local 3D patches
- Geometric Tracking: Vessel-specific tracking algorithm follows centerlines and detects bifurcations
- Iterative Refinement: Sequential processing builds complete vascular trees from seed points
Step-by-step process:
- Initialization: Place seed points manually or from prior centerlines
- Local Segmentation: Extract and segment 3D patches using trained nnU-Net
- Centerline Extraction: Compute local vessel centerlines and orientations
- Step Planning: Determine next position along vessel direction
- Bifurcation Detection: Identify and queue branch points
- Iteration: Repeat until vessel termination or max steps reached
The neural network is trained on local subvolume patches extracted from annotated vessel datasets, enabling:
- Generalization across different vessel scales and orientations
- Efficient training with limited annotated data
- Real-time inference on standard GPUs
- Adaptive patch sizing: Automatically adjusts to vessel diameter
- Multi-scale processing: Handles vessels from 1mm to 30mm diameter
- Topology preservation: Maintains vessel connectivity during segmentation
- Branch prioritization: Intelligent exploration of vessel trees
- OS: Linux, macOS, Windows
- Python: ≥3.11 (recommended)
- GPU: CUDA-compatible GPU with ≥8GB VRAM (recommended)
pip install seqseg
seqseg --help # Verify installationgit clone https://github.com/numisveinsson/SeqSeg.git
cd SeqSeg
pip install -e .conda create -n seqseg python=3.11
conda activate seqseg
pip install seqsegCore Dependencies:
nnunetv2==2.5.1 # Deep learning segmentation
torch>=2.3.1 # PyTorch backend
simpleitk==2.2.1 # Medical image I/O
vtk==9.1.0 # 3D visualization and processing
pyyaml==6.0.1 # Configuration management
Optional Dependencies:
matplotlib # Plotting and visualization
vmtk # Advanced vascular modeling tools
Pre-trained weights are required for inference:
- Download: Pre-trained Models (nnUNet_results folder)
- Extract: Unzip to desired location
- Reference: Use
-nnunet_results_pathto specify path
Available Models:
Dataset005_SEQAORTANDFEMOMR: Aortic and femoral vessels (MR)- Additional models available for coronary, cerebral, and pulmonary vessels
your_project/
├── images/ # Medical images (.nii.gz, .mha, .nrrd)
├── seeds.json # Seed point coordinates
├── centerlines/ # Optional: existing centerlines
└── truths/ # Optional: ground truth segmentations
- NIfTI:
.nii,.nii.gz - MetaImage:
.mha,.mhd - NRRD:
.nrrd - DICOM: Via SimpleITK readers
- Others: Any SimpleITK-supported format
Seeds can be provided via:
- JSON file (recommended):
[
{
"name": "case_001",
"seeds": [
[[-2.07, -2.20, 13.43], [-1.17, -1.34, 12.24], 1.1]
]
}
]Format: [[start_point], [direction_point], radius_estimate]
- Existing centerlines: Automatic initialization from first points
- Cardiac meshes: Aortic valve (Region 8) and LV (Region 7) labels
seqseg \
-data_dir /path/to/data/ \
-nnunet_results_path /path/to/nnUNet_results/ \
-nnunet_type 3d_fullres \
-train_dataset Dataset005_SEQAORTANDFEMOMR \
-fold all \
-img_ext .mha \
-config_name aorta_tutorial \
-outdir results/seqseg -data_dir data/ -max_n_steps 100 -max_n_branches 10 -write_steps 1seqseg -data_dir data/ -start 0 -stop 50 # Process cases 0-49seqseg -data_dir data/ -unit mm -scale 0.1 # Model trained in cm, data in mm| Argument | Type | Default | Description |
|---|---|---|---|
data_dir |
str | - | Path to data directory containing images and seeds.json |
nnunet_results_path |
str | - | Path to nnUNet model weights directory |
nnunet_type |
str | 3d_fullres |
nnUNet model architecture (3d_fullres, 2d) |
train_dataset |
str | - | Dataset name used for training (e.g., Dataset005_SEQAORTANDFEMOMR) |
fold |
str | all |
Cross-validation fold (all, 0, 1, 2, 3, 4) |
img_ext |
str | - | Image file extension (.nii.gz, .mha, .nrrd) |
config_name |
str | global |
Configuration file name |
outdir |
str | - | Output directory for results |
unit |
str | cm |
Image coordinate units (mm, cm) |
scale |
float | 1.0 |
Scaling factor for unit conversion |
max_n_steps |
int | 1000 |
Maximum tracking steps |
max_n_steps_per_branch |
int | 100 |
Maximum steps per vessel branch |
max_n_branches |
int | 100 |
Maximum number of branches to follow |
start |
int | 0 |
Starting case index for batch processing |
stop |
int | -1 |
Ending case index (-1 for all) |
write_steps |
int | 0 |
Save intermediate results (0/1) |
extract_global_centerline |
int | 0 |
Extract final centerline (0/1) |
cap_surface_cent |
int | 0 |
Cap vessel surface ends (0/1) |
SeqSeg generates several output files for each processed case:
| File | Description |
|---|---|
{case}_seg_containing_seeds_{steps}_steps.mha |
Final binary segmentation |
{case}_surface_mesh_smooth_{steps}_steps.vtp |
Smoothed 3D surface mesh |
{case}_centerline_{steps}_steps.vtp |
Extracted vessel centerlines |
{case}_binary_seg_*.mha |
Raw binary segmentation |
{case}_prob_seg_*.mha |
Probabilistic segmentation |
simvascular/ |
Directory with SimVascular-compatible files |
For debugging (when write_steps=1):
volumes/: Local image patchespredictions/: nnUNet predictionscenterlines/: Intermediate centerlinessurfaces/: Intermediate surfacespoints/: Tracking points
Processing Times (Local CPU, typical cases):
- Simple vessel (aorta): ~2-5 minutes
- Complex tree (coronary): ~5-15 minutes
- Full cerebral vasculature: ~10-30 minutes
Accuracy (validation on held-out test sets):
- Dice Similarity Coefficient: >0.9
- Hausdorff Distance: <35 pixels
- Centerline accuracy: >0.9
Scalability:
- Tested on images up to 512³ voxels
- Handles vessel diameters from 1mm to 30mm
- Supports vessel trees with 50+ branches
SeqSeg uses YAML configuration files located in seqseg/config/:
| Config File | Purpose |
|---|---|
global.yaml |
Default settings |
aorta_tutorial.yaml |
Aortic vessel segmentation |
global_coro.yaml |
Coronary arteries |
global_cereb.yaml |
Cerebral vessels |
global_pulm.yaml |
Pulmonary vessels |
# Tracking parameters
STEP_SIZE: 2.0 # Step size in ratio of radius
RADIUS_ESTIMATION_METHOD: 'auto' # Radius estimation approach
# Neural network parameters
PREDICTION_THRESHOLD: 0.5 # Segmentation threshold
# Post-processing
SMOOTH_FACTOR: 0.1 # Surface smoothing intensity
MIN_COMPONENT_SIZE: 100 # Minimum vessel component size- Copy existing config:
cp seqseg/config/global.yaml my_config.yaml - Modify parameters for your specific use case
- Run with:
seqseg -config_name my_config ...
# Replace nnUNet with custom segmentation model
from seqseg.modules.prediction import CustomPredictor
class MyPredictor(CustomPredictor):
def predict_patch(self, image_patch):
# Implement custom prediction logic
return segmentation_predictionTo train nnUNet models on custom datasets:
- Prepare data in nnUNet format:
nnUNet_raw/Dataset999_MYCUSTOM/
├── imagesTr/ # Training images
├── labelsTr/ # Training labels
├── imagesTs/ # Test images (optional)
└── dataset.json # Dataset metadata- Train model:
nnUNetv2_plan_and_preprocess -d 999
nnUNetv2_train 999 3d_fullres 0 # Train fold 0- Use with SeqSeg:
seqseg -train_dataset Dataset999_MYCUSTOM -fold 0from seqseg.analysis.compute_metrics import evaluate_segmentation
# Compute standard metrics (basic evaluation)
dice, hausdorff, _ = evaluate_segmentation(
prediction_path, ground_truth_path
)
# Full evaluation including centerline overlap
dice, hausdorff, centerline_overlap = evaluate_segmentation(
prediction_path, ground_truth_path, centerline_path
)SeqSeg outputs are compatible with SimVascular for CFD modeling:
# Output .vtp files can be directly imported into SimVascular
# for mesh generation and flow simulationSeqSeg also provides a simvascular/Paths/ directory with pre-formatted path files.
# Load SeqSeg results in 3D Slicer for visualization
import slicer
segmentation = slicer.util.loadSegmentation("result.mha")When using SeqSeg, please cite the following paper:
@Article{SveinssonCepero2024,
author={Sveinsson Cepero, Numi
and Shadden, Shawn C.},
title={SeqSeg: Learning Local Segments for Automatic Vascular Model Construction},
journal={Annals of Biomedical Engineering},
year={2024},
month={Sep},
day={18},
issn={1573-9686},
doi={10.1007/s10439-024-03611-z},
url={https://doi.org/10.1007/s10439-024-03611-z},
}

