Automated Quality Control based on Deep-learning algorithms for spinal cord imaging segmentation
The containerization for automated QC can be used via Docker or Singularity/Apptainer. Here are some brief instructions on how to use it.
You should have two folders: one with all the .nii.gz images and another with all the segmentation masks ending in _seg_labeled.nii.gz (e.g., image: c0001.nii.gz, mask: c0001_seg_labeled.nii.gz). The masks can be generated by either method (SCT or Enigma-SC).
The results will be generated within your image folder, a /Results folder will be created with two files, a .txt and a .pdf, both containing the segmentation results according to the Figure 1 below. These classifications are based on the anatomical landmarks on the Anatomical Ground Truth section.
It's important to note that in some cases, it may generate a 'failed' result even for correct segmentations (~3% of images in our tests), so it's important to check the .pdf file to verify if the segmentation really failed. The .pdf file contains the image with the labeling.
Images with a 'correct' result are indeed correct, making it unnecessary to verify them. This pipeline can help save effort and speed up the QC checking process, and we hope it will be useful to you!
Once you pulled the Docker image
docker pull art2mri/qc_spinalcord:5.0You are able to generate the results by typing the following command
docker run -it --rm --gpus all \
-v /path/to/images_folder:/home/QC_pipeline/image \ #replace the /path/to/images_folder by the real path of your images folder
-v /path/to/masks_folder:/home/QC_pipeline/mask \ #replace the /path/to/masks_folder by the real path of your masks folder
-e MPLCONFIGDIR=/home/QC_pipeline/temp/matplotlib \
--user $(id -u):$(id -g) art2mri/qc_spinalcord:5.0If you do not have an integrated GPU, simply remove the GPU flag --gpus all from the command.
singularity build --sandbox qc_spinalcord/ docker://art2mri/qc_spinalcord:5.0or
apptainer build --sandbox qc_spinalcord/ docker://art2mri/qc_spinalcord:5.0chmod -R 777 qc_spinalcord/You are now able to generate the results.
singularity exec \
--writable \
--nv \
--no-home \
--containall \
--bind /tmp:/tmp \
--bind "/path/to/images:/home/QC_pipeline/image" \
--bind "/path/to/mask:/home/QC_pipeline/mask" \
--env MPLCONFIGDIR=/home/QC_pipeline/temp/matplotlib \
qc_spinalcord/ \
python3 /home/QC_pipeline/main.py 2>/dev/null