Skip to main content

Extract parcellated diffusion features and connectivity matrices from QSIRecon outputs

Project description

QSIParc logo

CI Docs PyPI Python License: MIT

QSIParc

Parcellated diffusion feature extraction from QSIRecon outputs.

QSIParc reads atlas parcellations and diffusion scalar maps produced by QSIRecon, computes per-region distribution statistics using direct numpy masking, and writes analysis-ready TSV files in a BIDS-derivative layout. It also repackages QSIRecon's structural connectivity matrices with standardized JSON sidecar metadata.

Part of the SNBB neuroimaging extraction stack, paired with fsatlas (FreeSurfer morphometrics).

Installation

pip install -e ".[dev]"

Quick start

# Extract all atlases, all subjects
qsiparc /data/qsirecon /data/qsiparc-out -v

# Single atlas, single subject
qsiparc /data/qsirecon /data/qsiparc-out \
    --atlas Schaefer2018N100Tian2020S2 \
    --participant-label sub-001 \
    -vv

# Only specific scalars
qsiparc /data/qsirecon /data/qsiparc-out --scalars FA MD ICVF

# Dry run
qsiparc /data/qsirecon /data/qsiparc-out --dry-run

Output layout

qsiparc-out/
├── dataset_description.json
└── sub-001/
    └── ses-01/
        └── dwi/
            └── atlas-Schaefer2018N100Tian2020S2/
                ├── sub-001_ses-01_atlas-Schaefer2018N100Tian2020S2_diffmap.tsv
                ├── sub-001_ses-01_atlas-Schaefer2018N100Tian2020S2_desc-streamline_count_connmatrix.csv
                └── sub-001_ses-01_atlas-Schaefer2018N100Tian2020S2_desc-streamline_count_connmatrix.json

Diffusion scalar TSV (long-format)

Each row is one region × one scalar:

| region_index | region_name | hemisphere | scalar | mean | median | std | iqr | skewness | kurtosis | n_voxels | coverage | |---|---|---|---|---|---|---|---|---|---|---|---|---| | 1 | LH_Vis_1 | L | cortex | FA | 0.42 | 0.41 | 0.08 | 0.11 | 0.15 | -0.32 | 847 | 0.98 |

Connectivity matrix

Square CSV (no headers) + JSON sidecar with region labels, edge weight type, and provenance.

Architecture

qsiparc/
├── discover.py    # BIDS file discovery (globs, entity parsing)
├── atlas.py       # Atlas LUT loading (TSV, JSON, FreeSurfer format)
├── extract.py     # Per-region scalar extraction (numpy masking)
├── connectome.py  # Connectivity matrix passthrough
├── output.py      # BIDS-derivative TSV/JSON writing
└── cli.py         # Click CLI

Key design decisions:

  • Direct numpy masking (not nilearn) for full voxel distribution access
  • No atlas warping — consumes QSIRecon's subject-space parcellations
  • Long-format TSV with rich statistics (mean, median, std, IQR, skewness, kurtosis)
  • Connectome passthrough (repackaging, not recomputation)

Testing

pytest
pytest --cov=qsiparc

All tests use synthetic 10×10×10 NIfTI volumes — no real data required.

Contributing

Bug reports, documentation fixes, and pull requests are welcome. See CONTRIBUTING for setup instructions, code style, and guidelines on what is in scope.

License

MIT

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

qsiparc-0.1.0.tar.gz (2.3 MB view details)

Uploaded Source

Built Distribution

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

qsiparc-0.1.0-py3-none-any.whl (22.5 kB view details)

Uploaded Python 3

File details

Details for the file qsiparc-0.1.0.tar.gz.

File metadata

  • Download URL: qsiparc-0.1.0.tar.gz
  • Upload date:
  • Size: 2.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for qsiparc-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9ebbe82880e98d65dfca4cf31ba84e0b050f189f5db69b8b0bf706e3808f07cb
MD5 74c0c4665fdf18e61141e0fbb41fa629
BLAKE2b-256 6a59d876f21808b9e54ed360c58980cf8b5630e105c952706483b33dd3437492

See more details on using hashes here.

File details

Details for the file qsiparc-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: qsiparc-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 22.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for qsiparc-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 421db466fa4da31c57b24d6cced63b5907cc5c9c0fcd3b73b1a020951573849d
MD5 3ddd3ad5feb8baa0b9a297444bdf1826
BLAKE2b-256 5ea664c91d7b6a14528eeb8b32d60b3bba39ab9da741f6974967a7312784ff39

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