Using RecoBundles for tract delineation¶

To delineate the major white matter pathways , pyAFQ defaults to use the waypoint ROI approach described in Yeatman, 2012. However, as an alternative approach, pyAFQ also supports using the RecoBundles algorithm Garyfallidis, 2018, which uses an atlas of bundles in streamlines. This section shows how to use RecoBundles for bundle recognition.

In [1]:
import os.path as op
from paths import afq_home
In [2]:
from AFQ.api.group import GroupAFQ
import AFQ.api.bundle_dict as abd
import plotly

Defining the segmentation params¶

We also refer to bundle recognition as the "segmentation" of the tractogram. Parameters of this process are set through a dictionary input to the segmentation_params argument of the GroupAFQ object. In this case, we use abd.reco_bd(16), which tells pyAFQ to use the RecoBundles algorithm for bundle recognition.

In [3]:
myafq = GroupAFQ(
    output_dir=op.join(afq_home, 'stanford_hardi', 'derivatives',
                       'recobundles'),
    bids_path=op.join(afq_home, 'stanford_hardi'),
    # Set the algorithm to use RecoBundles for bundle recognition:
    bundle_info=abd.reco_bd(16),
    preproc_pipeline='vistasoft')

myafq.export("profiles")
INFO:AFQ:No seed mask given, using FA (or first scalar if none are FA)thresholded to 0.2
INFO:AFQ:No stop mask given, using FA (or first scalar if none are FA)thresholded to 0.2
Out[3]:
{'01': '../data_/tractometry/stanford_hardi/derivatives/recobundles/sub-01/ses-01/dwi/sub-01_ses-01_desc-profiles_tractography.csv'}
In [4]:
plotly.io.show(myafq.export("all_bundles_figure")["01"][0])
INFO:AFQ:Loading Volume...
INFO:AFQ:Loading Volume...
INFO:AFQ:Loading Stateful Tractogram...
/Users/john/pyAFQ/AFQ/utils/streamlines.py:93: UserWarning:

Pass ['to_space'] as keyword args. From version 2.0.0 passing these as positional arguments will result in an error. 

INFO:AFQ:Generating colorful lines from tractography...
WARNING:AFQ:Failed to write HTML file: ../data_/tractometry/stanford_hardi/derivatives/recobundles/sub-01/ses-01.html
In [ ]: