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

Uploaded Python 3

File details

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

File metadata

  • Download URL: veinseg_qsm-1.0.0.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.0.tar.gz
Algorithm Hash digest
SHA256 93a8ef3eb6f32c32260f69ea98cb459f60978b4787c67d61b16d6df1b6e88067
MD5 1576a7df623485f0477885d8a9f6526a
BLAKE2b-256 077f9c2c0ef5dd7b9ade484b927edd23a0100370a5abb5550222fb12abca4568

See more details on using hashes here.

File details

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

File metadata

  • Download URL: veinseg_qsm-1.0.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d4ca9c6677952c6fe1b847eeec71c1b30aead696225d86fb0cfab8dc695277cc
MD5 92a7d3995e1701475e4da315c6110566
BLAKE2b-256 511df0b164457187037c1f428fcabbd3fcc96aa57522c9da2f717b574e2632af

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