PhantomKit
PhantomKit is a Python toolkit for automated quality assurance (QA) of medical imaging scanners using physical phantoms. It provides pydra-based workflows that register phantom scans to a reference template, extract per-vial signal statistics across multiple contrast types, and generate publication-quality plots — supporting both MRI and PET phantom protocols.
Features
- Template-based registration — iterative ANTs SyN registration with automatic orientation search across a rotation library
- Vial metric extraction — per-vial mean, median, std, min and max across all contrast images, written to CSV
- Plotting — scatter plots of vial intensity and parametric map plots (T1/IR, T2/TE) with mrview ROI overlays
- Protocol support — extensible
protocolssub-package for phantom- and project-specific workflow configurations - Parallel batch processing — pydra-native splitting and combining for multi-session datasets
Installation
python -m pip install phantomkit
Basic usage
from phantomkit.protocols.gsp_spirit import GspSpiritAnalysis
wf = GspSpiritAnalysis(
input_image="/data/session01/t1_mprage.nii.gz",
template_dir="/templates/gsp_spirit",
rotation_library_file="/templates/gsp_spirit/rotations.txt",
)
outputs = wf(cache_root="/data/cache-root")
Or via the command line:
# Single session
phantom-process run gsp-spirit /data/session01/t1_mprage.nii.gz \
--template-dir /templates/gsp_spirit \
--rotation-library-file /templates/gsp_spirit/rotations.txt \
--output-base-dir /results
# Batch — process every matching image found under /data/
phantom-process run gsp-spirit /data/ \
--template-dir /templates/gsp_spirit \
--rotation-library-file /templates/gsp_spirit/rotations.txt \
--output-base-dir /results \
--pattern "*t1*mprage*.nii.gz"
# List available protocols
phantom-process list
Plotting
Generate QA plots from existing CSV metric files:
# Vial intensity scatter plot for one contrast
phantom-process plot vial-intensity \
/results/session01/metrics/session01_t1_mprage_mean_matrix.csv scatter \
--std_csv /results/session01/metrics/session01_t1_mprage_std_matrix.csv \
--output /results/session01/metrics/session01_t1_PLOTmeanstd.png
# T1 inversion-recovery parametric map plot
phantom-process plot maps-ir \
/results/session01/images_template_space/ir_*.nii.gz \
--metric_dir /results/session01/metrics \
--output /results/session01/metrics/session01_T1map_plot.png
# T2 spin-echo parametric map plot
phantom-process plot maps-te \
/results/session01/images_template_space/te_*.nii.gz \
--metric_dir /results/session01/metrics \
--output /results/session01/metrics/session01_T2map_plot.png
See the CLI documentation for the full option reference.
License
Copyright 2026 Australian Imaging Service. Released under the Apache License 2.0.
Metadata
Release files for phantomkit 0.1.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| phantomkit-0.1.7.tar.gz | 29.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| phantomkit-0.1.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 73.1 kB
Release files / phantomkit-0.1.7.tar.gz
| Download URL | phantomkit-0.1.7.tar.gz |
|---|---|
| Size | 29.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f93eada9a1e87b1c0a9d7ecb06610179cc5c571fef0a1103b1a3145d52f8401d
|
|
BLAKE2b-256 checksum How to use checksums |
70124828830c767080ce0d0edc0543398d3709a0a3bb2cbae00360e7568d50f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / phantomkit-0.1.7-py3-none-any.whl
| Download URL | phantomkit-0.1.7-py3-none-any.whl |
|---|---|
| Size | 43.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7049c9a317a69992177a0a3fe6941ece191e021c457ec131bc6697306053f129
|
|
BLAKE2b-256 checksum How to use checksums |
bbe365ffebbe3b76efb7e75fcf0635729dc36c91513fd8344c3a00ee864f5aca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|