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.1.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.1-py3-none-any.whl (20.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: veinseg_qsm-1.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 31e036c6d149b4d3fbef60f78d262104e69dc4c755f298044d32dc54a5157978
MD5 6fea3631d7c6cbc2d3377aff13abe0eb
BLAKE2b-256 47b614348c365b44e9dbd4e1d64dd900e1e74d4346b5b5da95b77f838242acf4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: veinseg_qsm-1.0.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b48c91d5cecee1f753878a9444d0552b7904c4582bba5345250334b32676cdd4
MD5 d23d7cf3949a3b4cc14d65d58e57073c
BLAKE2b-256 180a3aeaba92e021bbb9b10eb2dee41388376b5795df32537e01f6f85bdd48b5

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