.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "howto/howto_examples/plot_afq_fwdti.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_afq_fwdti.py: ========================== How to use Free water DTI ========================== The free-water DTI model [1, 2]_ fits a two compartment model to dMRI data with more than one non-zero shell. One compartment is a spherical compartment with the diffusivity of water, which accounts for free water in the tissue. The other compartment is the standard diffusion tensor. In this example, we will compare the results of the fwDTI model and the standard DTI model. .. GENERATED FROM PYTHON SOURCE LINES 15-28 .. code-block:: Python import os.path as op import matplotlib.pyplot as plt import nibabel as nib from AFQ.api.group import GroupAFQ import AFQ.data.fetch as afd from AFQ.definitions.image import ImageFile, RoiImage import AFQ.api.bundle_dict as abd import pandas as pd .. GENERATED FROM PYTHON SOURCE LINES 29-40 Get some data -------------- In this example, we will look at one subject from the Healthy Brain Network Processed Open Diffusion Derivatives dataset (HBN-POD2) [3, 4]_. The data in this study were collected with a multi-shell sequence, meaning that most subjects in this study have data with more than one non-zero b-value. This means that we can fit the fwDTI model to their data. We'll use a fetcher to get preprocessd 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 40-43 .. code-block:: Python study_dir = afd.fetch_hbn_preproc(["NDARAA948VFH"])[1] .. GENERATED FROM PYTHON SOURCE LINES 44-55 Define an AFQ object -------------------- In addition to preprocessd dMRI data, HBN-POD2 contains brain mask and mapping information for each subject. We can use this information in our pipeline, by inserting this information as `mapping_definition` and `brain_mask_definition` inputs to the `GroupAFQ` class initializer. When initializing this object, we will also ask for the fwDTI scalars to be computed. For expedience, we will limit our investigation to the bilateral arcuate fasciculus and track only around that bundle. If you would like to do this for all bundles, you would remove the `bundle_dict` and `tracking_params` inputs to the initializer that are provided below. .. GENERATED FROM PYTHON SOURCE LINES 55-78 .. code-block:: Python brain_mask_definition = ImageFile( suffix="mask", filters={'desc': 'brain', 'space': 'T1w', 'scope': 'qsiprep'}) bundle_names = ["Left Arcuate", "Right Arcuate"] bundle_dict = abd.default18_bd()[bundle_names] myafq = GroupAFQ( bids_path=study_dir, preproc_pipeline='qsiprep', output_dir=op.join(study_dir, "derivatives", "afq_fwdti"), bundle_info=bundle_dict, tracking_params={ "n_seeds": 50000, "random_seeds": True, "seed_mask": RoiImage(use_waypoints=True, use_endpoints=True), }, brain_mask_definition=brain_mask_definition, scalars=["fwdti_fa", "fwdti_md", "fwdti_fwf", "dti_fa", "dti_md"]) .. rst-class:: sphx-glr-script-out .. code-block:: none 0%| | 0/1 [00:00 P)") .. image-sg:: /howto/howto_examples/images/sphx_glr_plot_afq_fwdti_004.png :alt: plot afq fwdti :srcset: /howto/howto_examples/images/sphx_glr_plot_afq_fwdti_004.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none 0%| | 0/234119.0 [00:00` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_afq_fwdti.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_