This repository contains implementations of segmentation pipelines proposed by the NeuroPoly lab for the MICCAI 2021 MS New Lesions Segmentation Challenge. The goal of the challenge was to segment the new lesions given two fluid attenuated inversion recovery (FLAIR) images (baseline and follow-up). You can also check our arXiv paper and poster.
This repo has been tested with Python 3.8. Follow the steps below to use this repo:
- Clone project:
git clone https://github.com/ivadomed/ms-challenge-2021
- Create virtual environment and install packages:
cd ms-challenge-2021/ virtualenv -p python3.8 .env source .env/bin/activate pip install -r requirements.txt
- Check the sections below for dataset curation, preprocessing, and modeling.
modeling/README.md
provides documentation on how to run training and evaluation using the codebase.
You need
installed for the preprocessing pipeline.
Check this to
see how ANIMA
should be installed and configured in your system.
We used the following script to curate the dataset and make it compatible with the Brain Imaging Data Structure (BIDS) specification:
python scripts/curate_msseg_challenge_2021.py -d PATH_TO_msseg_challenge_2021_DATASET
The preprocessing pipeline for each subject can be found in preprocessing/preprocess_data.sh
.
The quality control (QC) script for this pipeline is preprocessing/qc_preprocess.py
.
Section 3.2 of our arXiv paper describes this pipeline in detail.
You can also check our quality-control (QC) visualizations.
You can find an example preprocessing visualization for a subject below.
The preprocessing steps include:
- Resampling of both FLAIR sessions to isotropic 0.75mm x 0.75mm x 0.75mm resolution
- Spinal cord (SC) segmentation with
sct_deepseg_sc
on both sessions - Initial registration (
ses-01 -> ses-02
) usingsct_register_multimodal
with the help of SC segmentation masks - Brain extraction using
bet2
on second session - Finer registration (
ses-01 -> ses-02
) usingantsRegistration
- Brain + SC masking on both sessions
- Bias-correction using
animaN4BiasCorrection
on both sessions - Cropping of volume-of-interest (VOI)
We are using sct_run_batch
to perform preprocessing on all subjects:
sct_run_batch -path-data PATH_DATA -path-output PATH_OUTPUT -script preprocessing/preprocess_data.sh -script-args "bet2"
where PATH_DATA
is the path to the BIDS data folder, and PATH_OUTPUT
is where the output of
preprocessing will be saved to. PATH_OUTPUT
will contain data_processed
and qc
(among others) directories after a successful run.
Additionally, you might want to play around with -jobs
and -itk-threads
arguments of
sct_run_batch
to gain speed-ups. -jobs 16 -itk-threads 16
was what we used in joplin
.
After a successful run, next step is to do quality-control (QC):
python preprocessing/qc_preprocess.py -s PATH_OUTPUT -mv
The QC script checks for:
- whether resolutions match between the two original sessions,
- whether all image sizes are equivalent for each subject,
- whether isotropic-resampling (step 1.) worked as expected,
- whether brain + SC mask leaves out any lesions from GTs (every expert and consensus),
- NOTE: In this project, we assumed that any lesions that are not inside the brain + SC region reflects a mistake in the annotation process. Therefore, you can discard this check safely!
and outputs the following to QC i) brain + SC extraction and ii) registration:
- per-subject visualizations
- aggregated visualizations (all subjects)
All modeling efforts can be found in modeling/
. modeling/README.md
and section 3.4 of our arXiv paper describe the deep learning architectures used in detail.
Location of the data:
git+ssh://data.neuro.polymtl.ca:msseg_challenge_2021
--> this is the BIDS-converted dataset.