Skip to main content

Physics-informed cerebral vein segmentation from QSM

Project description

VeinSeg

Physics-informed deep learning for cerebral vein segmentation from QSM.

Hugging Face | GitHub


Overview

VeinSeg segments cerebral veins from Quantitative Susceptibility Mapping (QSM). It supports multi-site, multi-field-strength data (3T and 7T) across five QSM reconstruction methods (TGV, MEDI, L1, STAR, iLSQR) using a physics-informed training objective.


Installation

Install PyTorch first (pytorch.org), then:

pip install veinseg

Download the model weights (~600 MB, once only):

veinseg-install /path/to/models/dir

On shared HPC clusters, set:

export VEINSEG_CHECKPOINT=/shared/models/veinseg/checkpoint.pth

Usage

veinseg -i qsm.nii.gz -r tgv -f 7t -o mask.nii.gz -p prob.nii.gz

Required arguments

Flag Description
-i QSM susceptibility map (.nii / .nii.gz, ppm)
-r QSM reconstruction method: tgv | medi | l1 | star | ilsqr
-f MRI field strength: 7t | 3t
-o Output binary vein mask
-p Output vein probability map

Optional arguments

Flag Default Description
--local-field PATH Measured background-removed local field (skips dipole computation)
--local-field-units auto hz | ppm | auto
--b0 X Y Z 0 0 1 B0 direction in world/scanner axes
--threshold 0.5 Probability threshold for binary mask
--step-size 0.5 Sliding window overlap as fraction of patch
--no-tta off Disable test-time augmentation
--device auto auto | cpu | cuda
--out-field PATH Save local field channel used (ppm)
--out-frangi PATH Save Frangi vesselness channel

Examples

# Dipole field computed automatically from QSM
veinseg -i qsm.nii.gz -r tgv -f 7t -o mask.nii.gz -p prob.nii.gz

# With measured local field (Romeo output in Hz — auto-detected)
veinseg -i qsm.nii.gz -r medi -f 7t -o mask.nii.gz -p prob.nii.gz \
        --local-field bgrm_field.nii.gz

# Inspect intermediate channels
veinseg -i qsm.nii.gz -r tgv -f 7t -o mask.nii.gz -p prob.nii.gz \
        --out-field dipole_field.nii.gz --out-frangi frangi.nii.gz

License

Apache 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

veinseg_qsm-1.0.3.tar.gz (20.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

veinseg_qsm-1.0.3-py3-none-any.whl (20.6 kB view details)

Uploaded Python 3

File details

Details for the file veinseg_qsm-1.0.3.tar.gz.

File metadata

  • Download URL: veinseg_qsm-1.0.3.tar.gz
  • Upload date:
  • Size: 20.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for veinseg_qsm-1.0.3.tar.gz
Algorithm Hash digest
SHA256 410d5a9a22965ecad5635be7687baeb7030d27586cf115a7ed69ee2bcef69198
MD5 be2c8d088138b6d65988d6026d43714b
BLAKE2b-256 94eafab3e90ece266532f6da3b3b791509d5e1d925d3ae82d81fef82ad07b5db

See more details on using hashes here.

File details

Details for the file veinseg_qsm-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: veinseg_qsm-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 20.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for veinseg_qsm-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 61385ed152549dd17c6b54bd00790f1499f308d8731c083e5f2cff8b8e9628c9
MD5 3145ea99fd7ffe8a2672222fc50e165e
BLAKE2b-256 35c2875f556047daefea90d8e0098da3b3076b254b2b99f7e16f89d4e2ffecc4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page