Evaluate the sensitivity of atrophy detection with SCT. The algorithm works as follows:
This code has been tested using Python 3.7.
Download (or git clone) this repository:
git clone https://github.com/sct-pipeline/csa-atrophy.git
cd csa-atrophy
Installation: csa-atrophy requires specific python packages for computing statistics and processing images. If not already present on the computer's python environment such packages will automatically be installed by running pip command:
pip install -e .
Download the Spine Generic Multi-Subject dataset.
Edit the file config_sct_run_batch.yml
according to your setup. Notable flags include:
path_data
: If you downloaded the spine-generic data at another location, make sure to update the path;include_list
: If you only want to run the script in a few subjects, list them here. Example:
include_list: ['sub-unf04', 'sub-unf05']
See sct_run_batch -h
to look at the available options.
Run the analysis:
sct_run_batch -config config_sct_run_batch.yml
:note: desired subjects using flag -include and in parallel processing using flag -jobs.
To output statistics, run in Dataset
csa_rescale_stat -i csa_atrophy_results/results -o csa_atrophy_results -config config_script.yml -fig
After running the analysis, check your Quality Control (QC) report by opening the file qc/index.html. Use the “Search” feature of the QC report to quickly jump to segmentations or labeling results. If you spot issues (wrong labeling), add their filenames in the 'config_correction.yml' file (see https://spine-generic.rtfd.io/en/latest/analysis-pipeline.html for further indications). Then, manually create labels in the cord at the level of inter-vertebral discs C1-C2, C2-C3, ..., C4-C5 with the command:
manual_correction -config config_correction.yml -path-in csa_atrophy_results/data_processed -path-out PATH_DATA
The bash script outputs all manual labelings to the derivatives directory in the dataset path defined in path_data
.
It is now possible to re-run the whole process. With the command below labeling will use the manual corrections that
are present in the derivatives/ folder of the dataset, otherwise labeling will be done automatically.
sct_run_batch -config config_sct_run_batch.yml
After everything is done, compute stats:
Per-subject stat: Panda dataframe df_sub
:
df_sub['mean']
df_sub['std']
df_sub['cov']
df_sub['rescale_estimated']
df_sub['error']
df_sub['perc_error']
Across-subject stats: Panda dataframe df_rescale
df_rescale['std_intra']
df_rescale['cov']
df_rescale['std_inter']
df_rescale['mean_rescale_estimated']
df_rescale['std_rescale_estimated']
Power analysis:
Plot results: