.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "howto/howto_examples/plot_optic_radiations.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_howto_howto_examples_plot_optic_radiations.py: =========================================================== How to add new bundles into pyAFQ(Optic Radiations Example) =========================================================== pyAFQ is designed to be customizable and extensible. This example shows how you can customize it to define a new bundle based on a definition of waypoint and endpoint ROIs of your design. In this case, we add the optic radiations, based on work by Caffara et al. [1]_, [2]_. The optic radiations (OR) are the primary projection of visual information from the lateral geniculate nucleus of the thalamus to the primary visual cortex. Studying the optic radiations with dMRI provides a linkage between white matter tissue properties, visual perception and behavior, and physiological responses of the visual cortex to visual stimulation. We start by importing some of the components that we need for this example and fixing the random seed for reproducibility .. GENERATED FROM PYTHON SOURCE LINES 21-35 .. code-block:: Python import os.path as op import plotly import numpy as np import shutil from AFQ.api.group import GroupAFQ import AFQ.api.bundle_dict as abd import AFQ.data.fetch as afd from AFQ.definitions.image import ImageFile, RoiImage import AFQ.utils.streamlines as aus np.random.seed(1234) .. GENERATED FROM PYTHON SOURCE LINES 36-43 Get dMRI data --------------- We will analyze one subject from the Healthy Brain Network Processed Open Diffusion Derivatives dataset (HBN-POD2) [3]_, [4]_. We'll use a fetcher to get preprocessed dMRI data for one of the >2,000 subjects in that study. The data gets organized into a BIDS-compatible format in the `~/AFQ_data/HBN` folder: .. GENERATED FROM PYTHON SOURCE LINES 43-46 .. code-block:: Python study_dir = afd.fetch_hbn_preproc(["NDARAA948VFH"])[1] .. GENERATED FROM PYTHON SOURCE LINES 47-57 Define custom `BundleDict` object -------------------------------- The `BundleDict` object holds information about "include" and "exclude" ROIs, as well as endpoint ROIS, and whether the bundle crosses the midline. In this case, the ROIs are all defined in the MNI template space that is used as the default template space in pyAFQ, but, in principle, other template spaces could be used. The ROIs for the case can be downloaded using a custom fetcher which saves the ROIs to a folder and creates a dictionary of paths to the ROIs: .. GENERATED FROM PYTHON SOURCE LINES 57-62 .. code-block:: Python or_rois = afd.read_or_templates() bundles = abd.OR_bd() .. rst-class:: sphx-glr-script-out .. code-block:: none 0%| | 0/2 [00:00` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_optic_radiations.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_optic_radiations.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_