MotionScoreHRpQCT core CLI for dataset-first HR-pQCT motion grading
Project description
MotionScoreHRpQCT
Motion scoring for HR-pQCT scans using deep convolutional neural networks.
This refactor provides a dataset-first pipeline with BIDS-style derivatives and review-state persistence for direct Slicer integration.
Related repositories:
- Core pipeline (this repo): https://github.com/wallematthias/MotionScoreHRpQCT
- Slicer extension: https://github.com/wallematthias/SlicerMotionScoreHRpQCT
What Changed In v2
- Legacy CLI commands
gradeandconfirmare removed. - New dataset-driven commands:
discover,predict,review-init,review-apply,explain,export. - Default output structure is now:
<dataset_root>/derivatives/MotionScore/
index.tsv
dataset_description.json
<mirrored-source-path-or-flat-aim-name>/
predictions/predictions.tsv
preview/<scan_id>_preview.png
preview/<scan_id>_slice_profile.png
review/review.tsv
review/review.json
review/review_audit.tsv
explain/<scan_id>_gradcam.mha
- AIM reading now uses
aimio-py. - Python baseline is now
>=3.10. - Output path mapping:
- Flat input (
*.AIMdirectly in dataset root): outputs are grouped under folder named after each AIM file stem. - Structured input (nested folders): outputs mirror the source folder structure under
MotionScore.
- Flat input (
- Raw-vs-mask identification:
- Primary: AIM header processing log (ISQ-origin markers indicate raw images).
- Fallback: filename-based heuristics when header signal is unavailable.
Installation
conda create -n motionscore python=3.10 -y
conda activate motionscore
# Clone
# git clone <repo-url>
# cd MotionScoreHRpQCT
# Install CLI + torch inference backend
pip install -e ".[torch]"
Models
Place torch model files (for example DNN_0.pt ... DNN_9.pt) in one of these locations:
./modelsmotionscore/models- explicit
--model-dir <path>
Model weights are licensed for usage tracking. In the current deployment configuration, licenses are automatically granted at signup.
CLI Usage
1) Discover scans
motionscore discover /path/to/dataset
motionscore discover /path/to/dataset --json
2) Run prediction + initialize review tables
motionscore predict /path/to/dataset --confidence-threshold 75
# blinded operator training mode
motionscore predict /path/to/dataset --training-mode
# optional: restrict to one scan_id (repeat flag for multiple)
motionscore predict /path/to/dataset --scan-id sub-001_site-tibia_ses-T1_abcdef1234
# optional quick-look PNG controls
motionscore predict /path/to/dataset --preview-panels 5
motionscore predict /path/to/dataset --no-preview-png
Default output root:
/path/to/dataset/derivatives/MotionScore
Optional custom output root:
motionscore predict /path/to/dataset --output-root /tmp/results
3) Update review threshold policy
motionscore review-init /path/to/dataset/derivatives/MotionScore --confidence-threshold 90
# keep/enable blinded operator training mode
motionscore review-init /path/to/dataset/derivatives/MotionScore --training-mode
--confidence-threshold 100 effectively requires review of all scans.
When --training-mode is enabled, pending scans are always operator-first and AI prediction is revealed after manual grading.
4) Apply manual review decision for one scan
motionscore review-apply /path/to/dataset/derivatives/MotionScore \
--scan-id sub-001_site-tibia_ses-T1_abcdef1234 \
--manual-grade 3 \
--reviewer mwalle
4b) Clear manual grades for re-review
# clear one operator across all scans
motionscore review-clear /path/to/dataset/derivatives/MotionScore --reviewer opA
# clear everyone
motionscore review-clear /path/to/dataset/derivatives/MotionScore --all-reviewers
5) Generate on-demand Grad-CAM attention map
motionscore explain /path/to/dataset/derivatives/MotionScore \
--scan-id sub-001_site-tibia_ses-T1_abcdef1234
6) Export final grade table
motionscore export /path/to/dataset/derivatives/MotionScore
Writes motion_grades.tsv at the derivatives root (or custom --output).
Export includes current per-scan review state plus machine-readable multi-reviewer summary columns:
reviewer_countreviewers(pipe-delimited reviewer IDs)consensus_method(currentlymean_manual_grade)consensus_mean_manual_gradeconsensus_grade_rounded- dynamic reviewer slots:
reviewer_1_id,reviewer_1_grade,reviewer_2_id,reviewer_2_grade, ...
Slicer Integration Contract
This repository is core logic only. A separate Slicer extension should:
- run
motionscore predict ...from aRunbutton, - run
motionscore review-apply ...as reviewers step through scans, - request
motionscore explain ...on demand to overlay Grad-CAM maps, - optionally show
preview/*_preview.pngfor quick QC, - load all outputs from derivatives without ad hoc state files.
Reference Slicer repository:
Citation
If you use this software, please cite:
Walle, M., Eggemann, D., Atkins, P.R., Kendall, J.J., Stock, K., Müller, R. and Collins, C.J., 2023. Motion grading of high-resolution quantitative computed tomography supported by deep convolutional neural networks. Bone, 166, p.116607. https://doi.org/10.1016/j.bone.2022.116607
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file motionscorehrpqct-2.2.2.tar.gz.
File metadata
- Download URL: motionscorehrpqct-2.2.2.tar.gz
- Upload date:
- Size: 40.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
91a2def589c2d9144a1e174af12bae02f95198030fa2ffe1463080d96e7589b2
|
|
| MD5 |
9ea46839913b7745aefcb48e7094d795
|
|
| BLAKE2b-256 |
e93fc8ef4a3994ee253a3028d990c0c99b1c2c2b104f082ea3e9649f3ed77e36
|
Provenance
The following attestation bundles were made for motionscorehrpqct-2.2.2.tar.gz:
Publisher:
publish-pypi.yml on wallematthias/MotionScoreHRpQCT
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
motionscorehrpqct-2.2.2.tar.gz -
Subject digest:
91a2def589c2d9144a1e174af12bae02f95198030fa2ffe1463080d96e7589b2 - Sigstore transparency entry: 1258493622
- Sigstore integration time:
-
Permalink:
wallematthias/MotionScoreHRpQCT@afa71ee232b16c8096830a854bd1237d09732fd4 -
Branch / Tag:
refs/tags/v2.2.2 - Owner: https://github.com/wallematthias
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@afa71ee232b16c8096830a854bd1237d09732fd4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file motionscorehrpqct-2.2.2-py3-none-any.whl.
File metadata
- Download URL: motionscorehrpqct-2.2.2-py3-none-any.whl
- Upload date:
- Size: 35.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ea07cf0f5bb191c83591a403c5451729e880f8fe8afba9fbe6ce49619396998b
|
|
| MD5 |
df611d1c3214000cb788db612ac44f3c
|
|
| BLAKE2b-256 |
c5ccc1fea067f3b4073620462355ebab1945e3d7a09af31a6da277ce45e00321
|
Provenance
The following attestation bundles were made for motionscorehrpqct-2.2.2-py3-none-any.whl:
Publisher:
publish-pypi.yml on wallematthias/MotionScoreHRpQCT
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
motionscorehrpqct-2.2.2-py3-none-any.whl -
Subject digest:
ea07cf0f5bb191c83591a403c5451729e880f8fe8afba9fbe6ce49619396998b - Sigstore transparency entry: 1258493641
- Sigstore integration time:
-
Permalink:
wallematthias/MotionScoreHRpQCT@afa71ee232b16c8096830a854bd1237d09732fd4 -
Branch / Tag:
refs/tags/v2.2.2 - Owner: https://github.com/wallematthias
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@afa71ee232b16c8096830a854bd1237d09732fd4 -
Trigger Event:
push
-
Statement type: