# White Matter Bundle Segmentation with RecoBundles

This tutorial explains how we can use RecoBundles [1] to extract bundles from input tractograms.

First, we need to download a reference streamline atlas. Here, we downloaded an atlas with 30 bundles in MNI space [2] from:

> https://figshare.com/articles/Atlas_of_30_Human_Brain_Bundles_in_MNI_space/12089652

For this tutorial, you can use your own tractography data or you can download a single subject tractogram from:

> https://figshare.com/articles/hcp_tractogram_zip/7013003

Let’s say we have an input target tractogram named `streamlines.trk` and the atlas we downloaded, named `whole_brain_MNI.trk`.

Visualizing the target and atlas tractograms before registration:

    dipy_horizon "streamlines.trk" "whole_brain_MNI.trk" --random_color

Atlas and target tractograms before registration.

## Streamline-Based Linear Registration

To extract the bundles from the tractogram, we first need move our target tractogram to be in the same space as the atlas (MNI, in this case). We can directly register the target tractogram to the space of the atlas, using streamline-based linear registration (SLR) [3].

The following workflows require two positional input arguments; `static` and `moving` .trk files. In our case, the `static` input is the atlas and the `moving` is our `target` tractogram (`streamlines.trk`).

Run the following workflow:

    dipy_slr "whole_brain_MNI.trk" "streamlines.trk" --force

Per default, the SLR workflow will save a transformed tractogram as `moved.trk`.

Visualizing the target and atlas tractograms after registration:

    dipy_horizon "moved.trk" "whole_brain_MNI.trk" --random_color

Atlas and target tractograms after registration.

## RecoBundles

Create an `out_dir` folder (e.g., `rb_output`), into which output will be placed:

    mkdir rb_output

For the RecoBundles workflow, we will use the 30 model bundles downloaded earlier. Run the following workflow:

    dipy_recobundles "moved.trk" "bundles/*.trk" --force --mix_names --out_dir "rb_output"

This workflow will extract 30 bundles from the tractogram. Example of extracted Left Arcuate fasciculus (AF_L) bundle (visualized with `dipy_horizon`):

Extracted Left Arcuate fasciculus (AF_L) from input tractogram

Example of extracted Left Arcuate fasciculus (AF_L) bundle visualized along with the model AF_L bundle used as reference in RecoBundles:

Extracted Left Arcuate fasciculus (AF_L) in pink and model AF_L bundle in green color.

Output of RecoBundles will be in native space. To get bundles in subject’s original space, run following commands:

    mkdir org_output

    dipy_labelsbundles 'streamlines.trk' 'rb_output/*.npy' --mix_names --out_dir "org_output"

For more information about each command line, please visit DIPY website https://dipy.org/ .

If you are using any of these commands please be sure to cite the relevant papers and DIPY [4].

## References

[1]

Eleftherios Garyfallidis, Marc-Alexandre Côté, François Rheault, Jasmeen Sidhu, Janice Hau, Laurent Petit, David Fortin, Stephen Cunanne, and Maxime Descoteaux. Recognition of white matter bundles using local and global streamline-based registration and clustering. NeuroImage, 170:283–295, April 2018. Segmenting the Brain. URL: https://doi.org/10.1016/j.neuroimage.2017.07.015, doi:10.1016/j.neuroimage.2017.07.015.

[2]

Fang-Cheng Yeh, Sandip Panesar, David Fernandes, Antonio Meola, Masanori Yoshino, Juan C. Fernandez-Miranda, Jean M. Vettel, and Timothy Verstynen. Population-averaged atlas of the macroscale human structural connectome and its network topology. NeuroImage, 178:57–68, 2018. URL: https://doi.org/10.1016/j.neuroimage.2018.05.027, doi:10.1016/j.neuroimage.2018.05.027.

[3]

Eleftherios Garyfallidis, Omar Ocegueda, Demian Wassermann, and Maxime Descoteaux. Robust and efficient linear registration of white-matter fascicles in the space of streamlines. NeuroImage, 117:124–140, August 2015. URL: https://doi.org/10.1016/j.neuroimage.2015.05.016, doi:10.1016/j.neuroimage.2015.05.016.

[4]

Eleftherios Garyfallidis, Matthew Brett, Bagrat Amirbekian, Ariel Rokem, Stefan Van Der Walt, Maxime Descoteaux, Ian Nimmo-Smith, and Dipy Contributors. Dipy, a library for the analysis of diffusion MRI data. Frontiers in Neuroinformatics, February 2014. URL: https://doi.org/10.3389/fninf.2014.00008, doi:10.3389/fninf.2014.00008.