Spinal cord gray matter imaging challenge for the 5th Spinal Cord Workshop (June 22nd 2018, Paris). The objective for this challenge is to propose a protocol that will generate the best image quality. For more details, please see: https://goo.gl/2owcL7.
- Python 3.8+
- SCT v5.4
Download the dataset of the challenge:
git clone https://github.com/sct-pipeline/gm-challenge-data.git
Download this repository and go in it:
git clone https://github.com/sct-pipeline/gm-challenge.git
cd gm-challenge
Create virtual environment, activate it and install package:
virtualenv venv # You only need to run this once
source venv/bin/activate # You need to run this everytime you with to process the data
python -m pip install --upgrade pip
pip install -e .
Run (you need to have SCT installed):
sct_run_batch -script process_data.sh -jobs -1 -path-data <PATH_DATA> -path-output <PATH_OUT>
with:
- <PATH_DATA>: The path to the downloaded dataset
- <PATH_OUT>: The path where results will be output.
At the end of the processing, you can review:
-
<PATH_OUT>/log/: Log files of the processing for each subject.
-
<PATH_OUT>/qc/index.html: Quality Control report
-
<PATH_OUT>/results/results.csv: CSV file containing the results. Example:
Subject SNR_diff SNR_single Contrast 9604 17.955421557112000 15.036597989806800 0.1532358378597440 9605 24.851538876483400 18.7942962516352 0.1238874277356780 9584 18.45677255732030 14.395098187990800 0.124765433521577 9418 20.29502533086980 16.989013170063300 0.1093208813636860
Two NIfTI files are required: an initial scan and a re-scan without repositioning. The analysis script process_data.sh
includes the following steps:
- Check if a mask for the spinal cord and/or gray matter (GM) already exists. If not, segment them automatically.
- Register the second scan to the first one. Use nearest-neighbour interpolation to preserve noise properties.
- Compute white matter (WM) mask by subtracting the spinal cord and the GM masks.
- Erode the WM mask to mitigate partial volume, yielding the WMe mask.
- Compute
SNR_diff
using the two-image subtraction method (Dietrich et al. J Magn Reson Imaging, 2007) in the WMe mask. - Compute
SNR_single
using the first scan, by dividing the mean in the WMe mask and the STD in the WMe masks. - Compute
Contrast
by dividing the mean signal in the GM by that in the WM, on a slice-by-slice basis and then average across slices.
A similar analysis can also be run on the spine-generic dataset. However, given that only one scan was available, SNR_diff could not be calculated. The command is similar to the one earlier, except the <PATH_DATA> should now point to the spine-generic multi-subject dataset:
sct_run_batch -script <PATH_REPOSITORY>/process_data.sh -path-data <PATH_DATA> -path-out <PATH_OUTPUT>
After running this script, figures can be generated as follows:
generate_figure_spinegeneric -ip <PATH_DATA>/participants.tsv -ir cd <PATH_OUT>/results/results.csv -o fig
Generate synthetic phantom of WM and GM that can be used to validate the proposed evaluation metrics. The phantoms are generated with random (Gaussian) noise, so running the script multiple times will not produce the same output. This script is meant to be run twice in order to assess the metrics with the following functions. Example:
simu_create_phantom -o simu_phantom1
simu_create_phantom -o simu_phantom2
Once both sets of phantom data are generated, process these. The next script will look for CSV files, which are
generated by simu_create_phantom.py
, and which contain file names of the NIfTI phantom data:
simu_process_data -i simu_phantom1/ simu_phantom2/
Finally, make figures to assess metrics sensitivity to image quality across two smoothing values:
simu_make_figures -i simu_results/results_all.csv -s 0
simu_make_figures -i simu_results/results_all.csv -s 1
- make sure the script niftyweb/WMGM is declared in
PATH
- add an entry to the crontab that points to the Daemon. Example (to edit, use
crontab -e
):
python niftyweb/setup/daemon_SOFTWEB_2files.py WMGM
Stephanie Alley, Ferran Prados, Julien Cohen-Adad
See: LICENSE