VeinSeg
Physics-informed deep learning for cerebral vein segmentation from QSM or R2*.
Overview
VeinSeg segments cerebral veins from Quantitative Susceptibility Mapping (QSM) or R2* maps, using only the image as input. It supports multi-site, multi-field-strength data (3T and 7T) across five QSM reconstruction methods (TGV, MEDI, L1, STAR, iLSQR) and R2* maps using a physics-informed training objective.
Installation
Install PyTorch first (pytorch.org), then:
pip install veinseg-qsm
Download the model weights (~290 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), or R2* map (1/s) with -r r2star — the only input needed |
-r |
Reconstruction method: tgv | medi | l1 | star | ilsqr | r2star |
-f |
MRI field strength: 7t | 3t |
-o |
Output binary vein mask |
-p |
Output vein probability map |
Optional arguments
| Flag | Default | Description |
|---|---|---|
--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 (mirroring) |
--device |
auto |
auto | cpu | cuda |
Examples
# QSM
veinseg -i qsm.nii.gz -r medi -f 3t -o mask.nii.gz -p prob.nii.gz
# R2*
veinseg -i r2star.nii.gz -r r2star -f 3t -o mask.nii.gz -p prob.nii.gz
# CPU inference, no test-time augmentation (faster)
veinseg -i qsm.nii.gz -r tgv -f 7t -o mask.nii.gz -p prob.nii.gz \
--device cpu --no-tta
License
Apache 2.0
Metadata
Release files for veinseg-qsm 1.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| veinseg_qsm-1.1.1.tar.gz | 15.4 kB | Without provenance | Details for veinseg_qsm-1.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| veinseg_qsm-1.1.1-py3-none-any.whl | Python 3 | none | any | Details for veinseg_qsm-1.1.1-py3-none-any.whl |
Total release size: 29.8 kB
Release files / veinseg_qsm-1.1.1.tar.gz
| Download URL | veinseg_qsm-1.1.1.tar.gz |
|---|---|
| Size | 15.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
05ab4041a3c501f16420a2fe734f340c0ffd901c051d3d45117c13a7cdcc1fb1
|
|
BLAKE2b-256 checksum How to use checksums |
39e39df1c65371b7ac0776d1ab8be7b9824764de2bb35f564af6faafbcbd2ca1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.2
|
Release files / veinseg_qsm-1.1.1-py3-none-any.whl
| Download URL | veinseg_qsm-1.1.1-py3-none-any.whl |
|---|---|
| Size | 14.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2731013cffe880f1fed424de72f74ad527d82f6c389fbca3a8b465ca3dae6afc
|
|
BLAKE2b-256 checksum How to use checksums |
ef22ccf7b8f61e0c51b84e31ab080568e2dbe00b0ab5804757feea76f0a9bfea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.2
|
Security for veinseg-qsm 1.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.