The NDMG pipeline estimates connectomes from M3r (multi-modal MRI) scans. The NDMG pipeline is designed to operate with:
NDMG-d
NDMG-f
The FNGS pipeline must first translate our raw M3r images into connectomes. Pressing "run" on the cell below will call the ndmg demo scripts.
If you get "process interrupted" as an output for any step of this notebook refresh the page and start again from the top; this is due to the server rebooting which it is scheduled to do every few hours.
Now that we are acquainted with the basics of the pipeline, feel free to click the cell below, and click the "play" button in the bar at the top. Alternatively, press shift + Enter from inside of the cell:
In [1]:
%%bash
ndmg_demo-func
To estimate our functional connectomes, we leverage many tools along the way, notably:
| Step | Tool(s) leveraged |
|---|---|
| Preprocessing | mcflirt (FSL), slicetimer (FSL), 3dSkullStrip (AFNI) |
| Registration | FLIRT (FSL), FLIRT-bbr (FSL), FNIRT (FSL), MNI 152 Template (MNI) |
| Nuisance | Neurodata Code (Neurodata) |
| Timeseries Extraction/Connectome Estimation | Parcellation Atlases |
Figure 2: The tools leveraged by the NDMG-f Pipeline.
Your fMRI timeseries can be viewed with the following code. This demo is on very small data, so it is not necessarily guaranteed to produce high-quality outputs as it was given drastically simpler data than most neuroscience applications, but it gives users a feel for the overall workflow. Click in the block, and press the "play" button at the top to execute it.
In [3]:
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
ts = np.load('/tmp/ndmg_demo/outputs/func/roi-timeseries/desikan-res-4x4x4/sub-0025864_ses-1_bold_desikan-res-4x4x4_variant-mean_timeseries.npz')['roi']
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(ts)
ax.set_xlabel('TR')
ax.set_ylabel('Intensity')
ax.set_title('Subject 0025864 session 1 ROI timeseries')
fig.show()
In [7]:
import networkx as nx
g = nx.read_gpickle('/tmp/ndmg_demo/outputs/func/connectomes/desikan-res-4x4x4/sub-0025864_ses-1_bold_desikan-res-4x4x4_measure-correlation.gpickle')
mtx = nx.to_numpy_matrix(g)
fig = plt.figure(figsize=(7,7))
ax = fig.add_subplot(111)
cax = ax.imshow(mtx, interpolation='None')
ax.set_xlabel('ROI')
ax.set_ylabel('ROI')
ax.set_title('Subject 0025864 session 1 Functional Connectome')
fig.colorbar(cax)
fig.show()
In [10]:
%%bash
ndmg_bids /tmp/ndmg_demo/outputs/func/connectomes /tmp/ndmg_demo/outputs/func/group group func --atlas desikan-res-4x4x4
cp /tmp/ndmg_demo/outputs/func/group/connectomes/desikan-res-4x4x4/plot.html ./qc_desikan_fmri_plot.html
The NDMG-f pipeline produces a plot which tells you about your functional connectomes.
Click this link to view the result!
In [1]:
%%bash
ndmg_demo-dwi
In [5]:
%matplotlib inline
g = nx.read_gpickle('/tmp/ndmg_demo/outputs/graphs/desikan-res-4x4x4/sub-0025864_ses-1_dwi_desikan-res-4x4x4.gpickle')
mtx = nx.to_numpy_matrix(g)
fig = plt.figure(figsize=(7,7))
ax = fig.add_subplot(111)
cax = ax.imshow(mtx, interpolation='None')
ax.set_xlabel('ROI')
ax.set_ylabel('ROI')
ax.set_title('Subject 0025864 session 1 Diffusion Connectome')
fig.colorbar(cax)
fig.show()
The FNGS pipeline produces numerous statistical reports and quality assurance summaries, both qualitative and quantitative, at both the subject-specific and group level. The subject-level qa will be alongside your local outputs in the qa folder. To generate the group-level qa, we can use the following command:
In [11]:
%%bash
ndmg_bids /tmp/ndmg_demo/outputs/graphs /tmp/ndmg_demo/outputs/dwi/group group dwi
cp /tmp/ndmg_demo/outputs/dwi/group/connectomes/desikan-res-4x4x4/plot.html ./qc_desikan_dwi_plot.html
Click this link to view the result!
In [ ]: