hazen
Quality assurance framework for Magnetic Resonance Imaging
Explore the docs »
View repo
·
Report Bug
·
Request Feature
Please STAR this repo to receive updates about new versions of hazen!
Overview
hazen is a command line tool (Python package) for performing automated analysis of magnetic resonance imaging (MRI) quality assurance (QA) data. hazen consists of multiple Tasks which perform quantitative processing and analysis of MRI phantom data. Currently, hazen supports the ACR Large MRI Phantom and the MagNET Test Objects collection of phantoms.
The hazen Tasks provide the following measurements within these phantoms:
- Signal-to-noise ratio (SNR)
- Spatial resolution
- Slice position
- Slice width
- Uniformity
- Ghosting
- MR relaxometry
Each Task outputs numerical results to the user's terminal. Below is an output from the hazen snr Task performed on
some example MRI data:
hazen snr tests/data/snr/Siemens
{
'snr_smoothing_measured_SNR_seFoV250_2meas_slice5mm_tra_repeat_PSN_noDC_2_1': 173.97,
'snr_smoothing_measured_SNR_seFoV250_2meas_slice5mm_tra_repeat_PSN_noDC_3_1': 177.91,
'snr_smoothing_normalised_SNR_seFoV250_2meas_slice5mm_tra_repeat_PSN_noDC_2_1': 1698.21,
'snr_smoothing_normalised_SNR_seFoV250_2meas_slice5mm_tra_repeat_PSN_noDC_3_1': 1736.66,
'snr_subtraction_measured_SNR_seFoV250_2meas_slice5mm_tra_repeat_PSN_noDC_2_1': 220.73,
'snr_subtraction_normalised_SNR_seFoV250_2meas_slice5mm_tra_repeat_PSN_noDC_2_1': 2154.69
}
The optional --report flag allows the user to generate diagrams that visualise the image processing performed by each hazen Task:
hazen snr tests/data/snr/Siemens --report |
hazen acr_ghosting tests/data/acr/Siemens --report |
|---|---|
Installation and usage
There are two main options for running hazen.
- Install using Python and run directly via command line interface (CLI)
- Run using the latest Docker container build
1) Python install and run (CLI)
hazen can be installed with Python 3.9, 3.10, 3.11 or 3.12 versions via pip.
It is strongly recommended to use a virtual environment, that can be made using the following commands.
python3 -m venv hazen-venv
source hazen-venv/bin/activate
pip install hazen
# Check that hazen was correctly installed and see which version it is:
hazen --version
Updating hazen
If you already have an old version of hazen installed, upgrade to the latest version with:
source hazen-venv/bin/activate
pip install --upgrade pip
pip install --upgrade hazen
Running hazen via CLI
The CLI version of hazen is designed to be pointed at single folders containing DICOM file(s). Example datasets are
provided in the tests/data/ directory. If you are using the Docker version of hazen (installation described below),
replace hazen with hazen-app in the following commands.
# To see the full list of available Tasks and optional arguments, enter:
hazen -h
# To perform the SNR Task on example data:
hazen snr tests/data/snr/Philips
# The `--report` option generates additional visualisation about the image processing measurement methods and is available
# for all Tasks. Example usage for the SNR Task, which returns images showing the regions used for SNR calculation.
hazen snr tests/data/snr/Philips --report
# a directory path can be provided to save the report images to:
hazen snr tests/data/snr/Philips --report ./report_images
2) Docker
The Docker version of hazen has been made available as it is easy to get up-and-running and is linked to the most recent stable release. Refer to the Docker installation instructions to install Docker on your host computer.
The containerised version of hazen can be obtained from DockerHub (see commands below). For ease of use, it is
recommended to copy the hazen-app script to a location accessible on the PATH such as /usr/local/bin. This will
allow you to run hazen from any directory on your computer. Then, to use Docker hazen, simply run the hazen-app script
appended with the function you want to use (e.g.: snr).
In Terminal:
# Ensure Docker installed and running, then pull the latest hazen Docker container
docker pull gsttmriphysics/hazen:latest
# Command line output will look something like:
latest: Pulling from gsttmriphysics/hazen
Digest: sha256:18603e40b45f3af4bf45f07559a08a7833af92a6efe21cb7306f758e8eeab24a
Status: Image is up to date for gsttmriphysics/hazen:latest
docker.io/gsttmriphysics/hazen:latest
# Copy the 'hazen-app' executable file into your local bin folder
cd hazen
cp hazen-app /usr/local/bin
# Run hazen via Docker with the normal CLI inputs
hazen-app snr tests/data/snr/Siemens/
# Example command line output for the SNR Task:
{
'snr_smoothing_measured_SNR_seFoV250_2meas_slice5mm_tra_repeat_PSN_noDC_2_1': 173.97,
'snr_smoothing_measured_SNR_seFoV250_2meas_slice5mm_tra_repeat_PSN_noDC_3_1': 177.91,
'snr_smoothing_normalised_SNR_seFoV250_2meas_slice5mm_tra_repeat_PSN_noDC_2_1': 1698.21,
'snr_smoothing_normalised_SNR_seFoV250_2meas_slice5mm_tra_repeat_PSN_noDC_3_1': 1736.66,
'snr_subtraction_measured_SNR_seFoV250_2meas_slice5mm_tra_repeat_PSN_noDC_2_1': 220.73,
'snr_subtraction_normalised_SNR_seFoV250_2meas_slice5mm_tra_repeat_PSN_noDC_2_1': 2154.69
}
Web Interface
Development of a web interface for hazen is in progress.
Contributing to hazen
Users
Please raise an Issue for any of the following reasons:
- Problems installing or running hazen
- Suggestions for improvements
- Requests for new features
We have used hazen with MRI data from a handful of different MRI scanners, including multiple different vendors. If hazen does not perform with your MRI data, or the results are unexpected, please raise an Issue.
Developers
Please see CONTRIBUTING.md for developer guidelines.
Metadata
Release files for hazen-wales 1.3.4
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 |
|---|---|---|---|---|
| hazen_wales-1.3.4.tar.gz | 313.9 kB | Without provenance | Details for hazen_wales-1.3.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hazen_wales-1.3.4-py3-none-any.whl | Python 3 | none | any | Details for hazen_wales-1.3.4-py3-none-any.whl |
Total release size: 648.7 kB
Release files / hazen_wales-1.3.4.tar.gz
| Download URL | hazen_wales-1.3.4.tar.gz |
|---|---|
| Size | 313.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d7e8df7c678ad5fcb05da8ee841e3439b6c9c016f516a1d8bf61416693befdf8
|
|
BLAKE2b-256 checksum How to use checksums |
03c53e69120b154007c81f6820732304ce76bfb1e05934287ebf69a44fc31b58
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.4
|
Release files / hazen_wales-1.3.4-py3-none-any.whl
| Download URL | hazen_wales-1.3.4-py3-none-any.whl |
|---|---|
| Size | 334.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
eb444e78bbb3ed0fd2f9ed3ee74d34f5e07f63ffd230025f28b162ac49bb66cb
|
|
BLAKE2b-256 checksum How to use checksums |
07fba9edc3ca4225b1de4d4d6b65a375037692db6e3fc65b38386a56bed2a39c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.4
|
Security for hazen-wales 1.3.4
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.