Run motion analyses on ADHD data
[1]:
%matplotlib inline
import pandas as pd
from nilearn import datasets
from ddmra import run_analyses, utils
[2]:
%%time
# Constants
n_subjects = 31
qc_thresh = 0.2
data = datasets.fetch_adhd(n_subjects=n_subjects)
n_iters = 10000
# Prepare data
imgs = []
fd_all = []
for i in range(n_subjects):
func = data.func[i]
imgs.append(func)
conf = data.confounds[i]
df = pd.read_table(conf)
motion = df[
[
'motion-pitch',
'motion-roll',
'motion-yaw',
'motion-x',
'motion-y',
'motion-z',
]
].values
fd_all.append(
utils.get_fd_power(motion, order=['p', 'r', 'ya', 'x', 'y', 'z'], unit='deg'),
)
[fetch_adhd] Dataset found in /home/tsalo/nilearn_data/adhd
CPU times: user 77.5 ms, sys: 20.2 ms, total: 97.8 ms
Wall time: 139 ms
[3]:
%%time
run_analyses(imgs, fd_all, out_dir='results/', n_iters=n_iters, n_jobs=16, qc_thresh=qc_thresh)
QCRSFC/HL null distributions: 100%|██████████████████████████████████████████████| 10000/10000 [00:14<00:00, 676.89it/s]
Scrubbing null distribution: 100%|███████████████████████████████████████████████| 10000/10000 [00:30<00:00, 329.07it/s]
CPU times: user 9min 22s, sys: 25.5 s, total: 9min 48s
Wall time: 10min 33s
[4]:
df = pd.read_table("results/run_denoising_summary.tsv")
df.head()
[4]:
| input_index | filename | n_volumes | mean_qc | qc_thresh | n_qc_missing | n_volumes_at_or_below_qc_thresh | n_volumes_above_qc_thresh | proportion_volumes_at_or_below_qc_thresh | proportion_volumes_above_qc_thresh | n_confounds | nominal_t_dof_after_confounds | retained_after_loading | retained_for_analysis | drop_reason | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 0 | 0010042_rest_tshift_RPI_voreg_mni.nii.gz | 176 | 0.056072 | 0.2 | 0 | 176 | 0 | 1.000000 | 0.000000 | 0 | 176 | False | False | zero_variance_roi |
| 1 | 1 | 0010064_rest_tshift_RPI_voreg_mni.nii.gz | 176 | 0.061499 | 0.2 | 0 | 176 | 0 | 1.000000 | 0.000000 | 0 | 176 | False | False | zero_variance_roi |
| 2 | 2 | 0010128_rest_tshift_RPI_voreg_mni.nii.gz | 176 | 0.069027 | 0.2 | 0 | 175 | 1 | 0.994318 | 0.005682 | 0 | 176 | False | False | zero_variance_roi |
| 3 | 3 | 0021019_rest_tshift_RPI_voreg_mni.nii.gz | 175 | 0.058589 | 0.2 | 0 | 175 | 0 | 1.000000 | 0.000000 | 0 | 175 | False | False | zero_variance_roi |
| 4 | 4 | 0023008_rest_tshift_RPI_voreg_mni.nii.gz | 77 | 0.082273 | 0.2 | 0 | 70 | 7 | 0.909091 | 0.090909 | 0 | 77 | False | False | zero_variance_roi |
[ ]: