.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "howto/howto_examples/vof_example.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_vof_example.py: ==================================== How to segment out only some bundles ==================================== The pyAFQ software can be configured to find all of its default set of white matter pathways, or bundles. Alternatively, it can be configured to find only some bundles. This example shows how to track and recognize only certain bundles that you are interested in, though note that ARC, pARC and VOF are all also part of the set of bundles that are segmented per default. .. GENERATED FROM PYTHON SOURCE LINES 13-50 .. code-block:: Python import AFQ.api.bundle_dict as abd import AFQ.data.fetch as afd from AFQ.api.group import GroupAFQ from AFQ.definitions.image import RoiImage import AFQ.utils.streamlines as aus import os.path as op afd.organize_stanford_data(clear_previous_afq="track") bundle_names = [ "Left Arcuate", "Right Arcuate", "Left Posterior Arcuate", "Right Posterior Arcuate", "Left Vertical Occipital", "Right Vertical Occipital"] bundle_dict = abd.default18_bd()[bundle_names] myafq = GroupAFQ( op.join(afd.afq_home, 'stanford_hardi'), bundle_info=bundle_dict, preproc_pipeline='vistasoft', tracking_params={ "n_seeds": 50000, "random_seeds": True, "seed_mask": RoiImage(use_waypoints=True, use_endpoints=True), } ) for b_name in bundle_names: b_len = len(aus.SegmentedSFT.fromfile(myafq.export("bundles")[ "01"]).get_bundle(b_name)) if b_len < 1: raise ValueError(f"{b_name} not found") myafq.export("all_bundles_figure")["01"][0] **Estimated memory usage:** 0 MB .. _sphx_glr_download_howto_howto_examples_vof_example.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: vof_example.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: vof_example.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: vof_example.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_