Overview

Teaching: 15 min
Exercises: 45 min
Questions
  • How can I map the structural human brain connectome at multiple scales from MRI?

Objectives
  • Get familiar with a BIDS App

  • Use Connectome Mapper 3 to estimate, in the BIDS ecosystem, from raw anatomical and diffusion MRI, brain parcellation at multiple scales and the corresponding structural connectivity matrices

Hand over the stage to Sebastien.

Prerequisites

For best learning outcome, it is essential to have a basic understanding of:

If not, we recommend you to follow the lesson for the unix shell made by Software Carpentry.

Although not essential it is also helpful to have an understanding of:

Introduction

This tutorial illustrates a step-by-step guide to compute, in the BIDS ecosystem, from raw anatomical and diffusion MRI of the summerschool dataset, brain parcellation at multiple scales and the corresponding structural connectivity matrices, using a BIDS App, the Connectome Mapper 3.

Tutorial outline

What is a BIDS App?

docker run -ti --rm \
  -v $HOME/data/ds005:/bids_dataset:ro \  # map dataset directory to the /bids_dataset location inside the container
  -v HOME/data/ds005/derivatives/example-0.0.4:/outputs \  # map output directory to the /outputs location inside the container
  bids/example:0.0.4 \  # BIDS App
  /bids_dataset /outputs participant --participant_label 01  # Core set of commandline arguments

Easy to be run and integrated into automated platforms
Ability to exactly replicate an analysis workflow by reporting the BIDS App name and version in a manuscript.

External materials

What is Connectome Mapper 3?

Connectome Mapper 3 (CMP3) is an open-source Python3 image processing pipeline software developed for use within our Sinergia Consortium Project as well as for open-source software distribution.

CMP3 provides a BIDS App that implements full anatomical, diffusion and resting-state MRI processing pipelines split into multiple stages, from raw Diffusion / T1 / T2 / BOLD data to multi-resolution connection matrices.

CMP3 pipelines use a combination of tools from well-known software packages, including FSL, FreeSurfer, ANTs, MRtrix3, Dipy and AFNI, orchestrated by the Nipype dataflow library. These pipelines can be easily updated as newer and better neuroimaging software become available.

CMP3 diagram

CMP3 also provides a Graphical User Interface aka cmpbidsappmanager, designed to facilitate all steps involved in the configuration and execution of the BIDS App and the inspection of the different stage outputs with appropriate viewers.

CMP3 Graphical User Interface aka cmpbidsappmanager

For more documentation, please check the resources below.

Resources

Generate the 5-scale Lausanne2018 brain parcellations and the brain structural connectivity matrices

In this part of this tutorial, you will have exercises to learn not only how to configure the different pipelines and run CMP3 to produce the 5-scale Lausanne2018 brain parcellations and the structural brain connectivity matrices that will be used in the next tutorials, but also how to inspect the quality of the outputs of the different processing stages.

CMP3 is installed in the virtual machine provided for the summer school along with Docker, miniconda3 for the Python 3.7 environment and the following viewers:

Note: You will need to provide your own license key at first use of trackvis. You can get one on the official Download page. You will also need to provide your own Freesurfer license.txt in $HOME/Softwares/freesurfer directory to use both CMP3 and freeview. Please check the FreeSurfer Download and Registration page to obtain one.

In this exercise you will work through the configuration of CMP3 pipelines with cmpbidsappmanager.

Exercise 1: Use cmpbidsappmanager to configure the anatomical and diffusion pipelines (click on the arrow to open)

  1. Open a terminal and launch cmpbidsappmanager
  2. Load the summerschool dataset that in located in $HOME/Data/ds003505
  3. Open the Configurator Window
  4. Configure the different stages as follows:

ANATOMICAL PIPELINE

Segmentation stage

Parcellation stage

DIFFUSION PIPELINE

Preprocessing stage

Registration stage

Diffusion reconstruction and tractography stage

Connectome stage

  1. When you are done, save all configuration files

Solution (click on the arrow to open)

We have made the pipeline configuration file solutions available:

  1. Download the Anatomical Pipeline Configuration file
  2. Download the Diffusion Pipeline Configuration file

In this exercise you will work through the configuration and execution of the BIDSApp of CMP3 with cmpbidsappmanager.

Exercise 2: Use cmpbidsappmanager to run the BIDSApp (click on the arrow to open)

  1. If cmpbidsappmanager is not started, launch cmpbidsappmanager and load the summerschool dataset as in the previous exercise
  2. Open the BIDS App Window
  3. Select to process sub-01 and control that the configuration files are pointing to $HOME/Data/ds003505/code/ref_anatomical_config.json and $HOME/Data/ds003505/code/ref_diffusion_config.json
  4. Check the run configuration and run the BIDS App

In this exercise you will work through the configuration of CMP3 pipelines with cmpbidsappmanager.

Exercise 3: Use cmpbidsappmanager to check pipeline outputs with external viewers (click on the arrow to open)

  1. If cmpbidsappmanager is not started, launch cmpbidsappmanager and load the summerschool dataset as in the previous exercise
  2. Open the Quality Inspector Window
  3. Select the subject sub-01
  4. Check the the parcellations co-registered to the resampled diffusion-free B0 volume
  5. Check the fiber orientation distribution function (ODF) image reconstructed by CSD
  6. Check the tractogram (the reconstructed fibers)
  7. Visualize the connectivity matrices

In this exercise you will have to reproduce the execution of the BIDS App via cmpbidsappmanager using directly its commandline interface.

Exercise 4: Run directly the BIDSApp commandline interface (click on the arrow to open)

Hint: In the last exercise, cmpbidsappmanager displayed the generated command in the terminal output when running the BIDS App.

Solution (click on the arrow to open)

The command should be:

docker run -it --rm \
-v $HOME/Data/ds003505:/bids_dir \
-v $HOME/Data/ds003505/derivatives:/output_dir \
-v $HOME/Softwares/freesurfer/license.txt:/bids_dir/code/license.txt \
-v $HOME/Data/ds003505/code/ref_anatomical_config.json:/code/ref_anatomical_config.json \
-v $HOME/Data/ds003505/code/ref_diffusion_config.json:/code/ref_diffusion_config.json \
-u "$(id -u)":"$(id -g)" \
sebastientourbier/connectomemapper-bidsapp:v3.0.0-RC4 \  # CMP BIDS App Docker image
/bids_dir /output_dir participant --participant_label 01 \  # BIDS App argument sets
--anat_pipeline_config /code/ref_anatomical_config.json \
--dwi_pipeline_config /code/ref_diffusion_config.json \
--fs_license /bids_dir/code/license.txt

Key Points