All processing steps are called via a bash script analysis_script.sh
This processes each subject's T1-weighted and FLAIR MRI images with the following main steps (each is a separate function in the bash script):
%%{init: {"flowchart": {"htmlLabels": false}} }%%
flowchart TD
fsl_anat("`Run fsl_anat on T1 image`")
flair_prep("`Pre-process FLAIR image and align it to T1 image`")
vent_dist("`Create periventricular vs deep white matter masks for T1 and FLAIR images`")
unet_prep("`Crop T1/FLAIR images, ready for UNet-pgs`")
unet("`Run UNet-pgs to segment WMLs`")
process_output("`Split WML segmentations into periventricular vs deep white matter + align to standard MNI template`")
fsl_anat --> flair_prep
flair_prep --> vent_dist
vent_dist --> unet_prep
unet_prep --> unet
unet --> process_output
After processing, the pipeline also generates an interactive QC output. See the QC docs for more information on those steps.
First, FSL's fsl_anat tool is run on the input T1 image and its output saved to
derivatives/enigma-pd-wml/<subject>/<session>/input/t1-mni.anat folder of each session.
See FSL's documentation for details of the various processing steps this includes.
Next, various FSL tools are used to pre-process the input FLAIR image and align it to the T1 image. Results are written
to the derivatives/enigma-pd-wml/<subject>/<session>/input/flair-bet directory of each session. This includes steps to:
-
Re-orient the FLAIR image to the standard (MNI) orientation with
fslreorient2std -
Extract the brain with
bet(brain extraction tool) -
Register the FLAIR image to the field-bias-corrected T1 brain (
T1_biascorr_brain) fromfsl_anatusingflirt(FMRIB's Linear Image Registration Tool) -
Apply this transformation to the reoriented FLAIR image using
flirt
Next, various FSL tools are used to create periventricular vs deep white matter masks for both the T1 and FLAIR images.
These will be used at a later stage to divide WML segmentations into periventicular vs deep white matter. Results are
written to the derivatives/enigma-pd-wml/<subject>/<session>/input/vent_dist_mapping directory of each session.
This includes steps to:
-
create binary masks of the ventricles and white matter with
make_bianca_mask -
Align these masks with the FLAIR brain with
flirt -
Use FSL's
distancemaptool andfslmathsto produce the final periventricular vs deep white matter masks
Next, various FSL tools are used to prepare the images for UNet-pgs. The main purpose of this step is to crop T1 /
FLAIR images with fslroi (if they're larger than 500 pixels in the x or y dimension).
Run the UNet-pgs segmentation workflow. This uses the WMHs_segmentation_PGS.sh script from
the pgs docker image. This will produce a WML binary segmentation mask
under the derivatives/enigma-pd-wml/<subject>/<session>/output/results.nii.gz of each session.
Next, the output from UNet-pgs is processed with various fsl tools. This splits the WML segmentation from UNet-pgs into periventricular vs deep white matter, as well as linearly/non-linearly aligning it to the standard MNI T1 1 mm template.
This includes steps to:
-
Align WML segmentations from UNet-pgs with the cropped T1 image, the full size T1 image and the full size FLAIR image via
flirt -
Use masks from the ventricular distance mapping step and
fslmathsto divide WML segmentations into periventricular and deep white matter -
Combine the periventricular and deep white matter masks using
fslmathsto restrict the segmentations to the white matter, excluding grey matter, CSF and areas outside of the brain -
Produce WML segmentations using the John Hopkins ICBM-DTI-81 white-matter labels and Oxford-GSK-Imanova striatal probabilistic connectivity atlases
-
Linearly transform/align all segmentations with MNI T1 via
flirt -
Non-linearly transform/align all segmentations with MNI T1 via
applywarp
The pipeline will generate multiple .zip files - one per session, stored within the corresponding session
sub-folder, e.g. derivatives/enigma-pd-wml/sub-1/ses-1/sub-1_ses-1_results.zip.
A csv file data/derivatives/enigma-pd-wml/t1_volumes.csv which contains the estimated brain volume (in mm³) in native T1-weighted space and MNI space, as well as the factor used to scale the brain from T1-weighted to MNI space for each subject and session will also be generated.
Please send these zip files to the ENIGMA-PD Vasc team.