def test_AFQ_custom_tract(): """ Test whether AFQ can use tractography from custom_tractography_bids_filters """ _, bids_path, sub_path = get_temp_hardi() afd.fetch_stanford_hardi_tractography() bundle_names = ["SLF", "ARC", "CST", "FP"] # move subsampled tractography into bids folder os.rename( op.join( op.expanduser('~'), 'AFQ_data', 'stanford_hardi_tractography', 'tractography_subsampled.trk'), op.join( sub_path, 'subsampled_tractography.trk' ) ) my_afq = api.AFQ( bids_path, dmriprep='vistasoft', bundle_info=bundle_names, custom_tractography_bids_filters={ "suffix": "tractography", "scope": "vistasoft" }) my_afq.get_streamlines()
# # The top level directory is our overall bids dataset folder. In most # cases, this folder will include a `raw` folder that will contain the # raw data. In this case, we do not include the raw folder and only have # the derivatives folder that contains the outputs of preprocessing the data. # In this case, one folder containing Freesurfer derivatives and another # folder containing the DWI data that has been preprocessed with Vistasoft. # pyAFQ provides facilities to segment tractography results obtained # using other software. For example, we often use # `qsiprep <https://qsiprep.readthedocs.io/en/latest/>`_ to preprocess # our data and reconstruct tractographies with software such as # `MRTRIX <https://www.mrtrix.org/>`_. Here, we will demonstrate how to use # these reconstructions in the pyAFQ segmentation and tractometry pipeline # We fetch this data and add it as a separate derivatives folder afd.fetch_stanford_hardi_tractography() bids_path = op.join(op.expanduser('~'), 'AFQ_data', 'stanford_hardi') tractography_path = op.join(bids_path, 'derivatives', 'my_tractography') sub_path = op.join(tractography_path, 'sub-01', 'ses-01', 'dwi') os.makedirs(sub_path, exist_ok=True) os.rename( op.join(op.expanduser('~'), 'AFQ_data', 'stanford_hardi_tractography', 'full_segmented_cleaned_tractography.trk'), op.join(sub_path, 'sub-01_ses-01-dwi_tractography.trk')) afd.to_bids_description( tractography_path, **{ "Name": "my_tractography", "PipelineDescription": {