14.2.2. Yue et al. (2025). Ultrafast fMRI reveals serial queuing of information processing …

Introduction

Here we present commands used in the following paper:

Abstract: The human brain is heralded for its massive parallel processing capacity, yet influential cognitive models suggest that there is a central bottleneck of information processing distinct from perceptual and motor stages that limits our ability to carry out two cognitively demanding tasks at once, resulting in the serial queuing of task information processing. Here we used ultrafast (199 ms TR), high-field (7T) fMRI with multivariate analyses to distinguish brain activity between two arbitrary sensorimotor response selection tasks when the tasks were temporally overlapping. We observed serial processing of task-specific activity in the fronto-parietal multiple-demand (MD) network, while processing in earlier sensory stages unfolded largely in parallel. Moreover, the MD network combined with modality-specific motor areas to define the functional characteristic of the central bottleneck at the stage of response selection. These results provide direct neural evidence for serial queuing of information processing and pinpoint the neural substrates undergirding the central bottleneck.

Study keywords: FMRI, Attention, Human behaviour

Main programs: afni_proc.py, @SSwarper, to3d, Dimon, timing_tool.py, 3dcalc

Download scripts

To download, either:

  • ... click the link(s) in the following table (perhaps Rightclick -> “Save Link As…”):

    do_00_recon_data.tcsh

    run to3d and Dimon to convert the datasets into NIFTI format

    do_01_prepare_timing_file.tcsh

    run timing_tool.py to create stimulus timing files for the FMRI processing

    do_02_preproc_anat.tcsh

    run @SSwarper skullstripping and nonlinear warping to template space

    do_03_preproc_func.tcsh

    run afni_proc.py for task-based FMRI analysis; this uses nonlinear warps estimated with @SSwarper

  • ... or copy+paste into a terminal:

    curl -O https://afni.nimh.nih.gov/pub/dist/doc/htmldoc/codex/fmri/media/2025_YueEtal/do_00_recon_data.tcsh
    curl -O https://afni.nimh.nih.gov/pub/dist/doc/htmldoc/codex/fmri/media/2025_YueEtal/do_01_prepare_timing_file.tcsh
    curl -O https://afni.nimh.nih.gov/pub/dist/doc/htmldoc/codex/fmri/media/2025_YueEtal/do_02_preproc_anat.tcsh
    curl -O https://afni.nimh.nih.gov/pub/dist/doc/htmldoc/codex/fmri/media/2025_YueEtal/do_03_preproc_func.tcsh
    

Additional code availability:
The authors’ code is also available here, with additional Matlab scripts for MVPA:

View scripts

do_00_recon_data.tcsh

 1#!/bin/tcsh
 2
 3# This is an example code for one subject, to reconstruct anatomical
 4# and functional images from the raw data.
 5
 6# From:
 7# 
 8#  Yue Q, Newton AT, Marois R (2025). Ultrafast fMRI reveals serial
 9#  queuing of information processing during multitasking in the human
10#  brain. Nat Commun 16(1):3057.
11#  https://pmc.ncbi.nlm.nih.gov/articles/PMC11953464/
12
13# ===========================================================================
14
15# set paths 
16set topdir = /Volumes/Seagate/prp_data
17
18# list of all subject IDs
19set all_sub = ( s773 )
20
21set all_subjn = ( 341285 )
22
23
24foreach subjn ( ${all_subjn} ) # loop over all subj num
25    foreach sub ( ${all_sub} ) # loop over all subj IDs
26
27        set ssdir = ${topdir}/${sub}/Marois_${subjn}
28
29        cd ${ssdir}/T1_3D_TFE_iso070_501
30        to3d                                                                 \
31            -spgr                                                            \
32            -orient   ASL                                                    \
33            -session  ../../                                                 \
34            -prefix   ${sub}_anat *.dcm
35
36        cd ${ssdir}/T1_3D_TFE_iso070_SENSE_Axial_502
37        to3d                                                                 \
38            -spgr                                                            \
39            -orient   RAI                                                    \
40            -session  ../../                                                 \
41            -prefix   ${sub}_anat_axial *.dcm
42
43        cd ${ssdir}/T1_3D_TFE_iso070_SENSE_Coronal_503
44        to3d                                                                 \
45            -spgr                                                            \
46            -orient   RSA                                                    \
47            -session  ../../                                                 \
48            -prefix   ${sub}_anat_coronal *.dcm
49
50        foreach run ( `seq 601 100 1501` ) # loop over all runs
51
52            cd ${ssdir}/Task_199ms_1600dyn_${run}
53
54            Dimon                                                            \
55                -infile_pattern    '*.dcm'                                   \
56                -GERT_Reco                                                   \
57                -quit                                                        \
58                -use_last_elem                                               \
59                -use_slice_loc                                               \
60                -dicom_org                                                   \
61                -sort_by_acq_time
62            to3d                                                             \
63                -prefix         ${sub}_task01 -time:zt 26 1600 199 zero      \
64                -use_last_elem                                               \
65                -session        ../../ -@ < dimon.files.run.${run}
66
67        end
68    end
69end

do_01_prepare_timing_file.tcsh

 1#!/bin/tcsh
 2
 3# Create stimulus timing files for afni_proc.py
 4
 5# From:
 6# 
 7#  Yue Q, Newton AT, Marois R (2025). Ultrafast fMRI reveals serial
 8#  queuing of information processing during multitasking in the human
 9#  brain. Nat Commun 16(1):3057.
10#  https://pmc.ncbi.nlm.nih.gov/articles/PMC11953464/
11
12# ===========================================================================
13
14# list of all subject IDs
15set all_sub = ( s707 s709 s710 s713 s718 s719 s722 s726 s735 s736 \
16                s738 s741 s747 s748 s750 s751 s755 s759 s760 s761 \
17                s763 s764 s765 s766 s768 s773 )
18
19# list of all stimulus conditions
20set all_cond = ( AO VM S_AOVM S_VMAO L_AOVM L_VMAO AO_response VM_response )
21
22foreach sub ( ${all_sub} )  # loop over all subj IDs
23
24    cd ~/Downloads/prp_scripts/timing/${sub}
25
26    # partition trials according to correct/incorrect response in each of
27    # task conditions
28    foreach cond ( ${all_cond} ) # loop over all conditions
29
30        timing_tool.py                                                       \
31            -timing     all_trials_${cond}.txt                               \
32            -partition  partition_${cond}.txt                                \
33            ${cond}
34    end
35
36    # left vs. right manual response
37    timing_tool.py                                                           \
38        -timing     VM_response_correct.1D                                   \
39        -partition  partition_VM_response_correct_l_vs_r.txt                 \
40        VM_response_correct
41
42    timing_tool.py                                                           \
43        -timing     VM_correct.1D                                            \
44        -partition  partition_VM_response_correct_l_vs_r.txt                 \
45        VM_correct
46
47
48    # partition trials according to AO task RT quartiles
49    timing_tool.py                                                           \
50        -timing     AO_correct.1D                                            \
51        -partition  partition_AO_rt_quartile.txt                             \
52        AO_correct
53
54
55    # partition trials according to VM task RT quartiles
56    timing_tool.py                                                           \
57        -timing     VM_correct.1D                                            \
58        -partition  partition_VM_rt_quartile.txt                             \
59        VM_correct
60
61end

do_02_preproc_anat.tcsh

 1#!/bin/tcsh
 2
 3# Do some preprocesses on anatomical images: FreeSurfer parcellation,
 4# and AFNI skullstripping and nonlinear alignment to template.
 5#
 6# NB: Below, @SSwarper is used to perform both skullstripping (SS) of
 7# the subject anatomical and nonlinear alignment (warping) of it to
 8# template space. There is a newer version of this program now
 9# available: sswarper2. It is meant to be a direct replacement and
10# update, and the I/O syntax is nearly identical.
11
12# From:
13# 
14#  Yue Q, Newton AT, Marois R (2025). Ultrafast fMRI reveals serial
15#  queuing of information processing during multitasking in the human
16#  brain. Nat Commun 16(1):3057.
17#  https://pmc.ncbi.nlm.nih.gov/articles/PMC11953464/
18
19# ===============================================================================
20
21# list of all subject IDs
22set all_sub = ( s773 )
23
24foreach sub ( ${all_sub} ) # 
25
26    ## 1. run-Freesurfer
27
28    cd /Volumes/Seagate/prp_data/${sub}/
29
30    3dcopy ${sub}_anat+orig ${sub}_anat.nii
31
32    recon-all                                                                    \
33        -i    ${sub}_anat.nii                                                    \
34        -s    ${sub}                                                             \
35        -sd   /Volumes/Seagate/prp_data/freesurfer/                              \
36        -all
37
38    cd /Volumes/Seagate/prp_data/freesurfer/${sub}/
39    @SUMA_Make_Spec_FS -NIFTI -sid ${sub}
40
41
42    ## 2. get some masks from segmentation
43
44    cd /Volumes/Seagate/prp_data/freesurfer/${sub}/SUMA
45
46    # ventricle
47    3dcalc                                                                       \
48        -a       aseg.nii                                                        \
49        -expr    'amongst(a,4,5,14,31,43,44,63)'                                 \
50        -prefix  ${sub}_anat_Vent_mask
51
52    # WM
53    3dcalc                                                                       \
54        -a       aseg.nii                                                        \
55        -expr    'amongst(a,2,41,77,251,252,253,254,255)'                        \
56        -prefix  ${sub}_anat_WM_mask
57
58    3dcopy                                                                       \
59        ${sub}_anat_Vent_mask+orig                                               \
60        /Volumes/Seagate/prp_data/${sub}/${sub}_anat_Vent_mask
61    3dcopy                                                                       \
62        ${sub}_anat_WM_mask+orig                                                 \
63        /Volumes/Seagate/prp_data/${sub}/${sub}_anat_WM_mask
64
65    3dcopy ${sub}_SurfVol.nii /Volumes/Seagate/prp_data/${sub}/${sub}_SurfVol
66
67    # get an anatomical parcellation mask, which is used to estimate
68    # parameters for subject-specific HRF
69
70    3dcalc                                                                       \
71        -a       aparc.a2009s+aseg_REN_gm.nii                                    \
72        -expr    'equals(a,116)'                                                 \
73        -prefix  ${sub}_FS_lPreCS.inf_mask
74    3dcopy                                                                       \
75        ${sub}_FS_lPreCS.inf_mask+orig                                           \
76        /Volumes/Seagate/prp_data/${sub}/${sub}_FS_lPreCS.inf_mask
77
78
79    ## 3. preprocess anatomical image
80
81    cd /Volumes/Seagate/prp_data/${sub}/
82
83    @SSwarper                                                                    \
84        -input     ${sub}_SurfVol+orig                                           \
85        -subid     ${sub}                                                        \
86        -odir      ${sub}_anat_warped                                            \
87        -base      MNI152_2009_template_SSW.nii.gz                               \
88        -skipwarp
89
90    cd /Volumes/Seagate/prp_data/${sub}/${sub}_anat_warped/
91    3dcopy anatSS.${sub}.nii ../${sub}_SurfVol_SS
92
93end

do_03_preproc_func.tcsh

  1#!/bin/tcsh
  2
  3# Generate script for preprocessing functional images (including
  4# GLM1), via afni_proc.py
  5
  6# From:
  7# 
  8#  Yue Q, Newton AT, Marois R (2025). Ultrafast fMRI reveals serial
  9#  queuing of information processing during multitasking in the human
 10#  brain. Nat Commun 16(1):3057.
 11#  https://pmc.ncbi.nlm.nih.gov/articles/PMC11953464/
 12
 13# ===========================================================================
 14
 15# set paths 
 16set topdir = /Volumes/Seagate/prp_data
 17
 18# list of all subject IDs
 19set all_sub = ( s773 )
 20
 21foreach sub ( ${all_sub} ) # loop over all subject IDs
 22
 23    # per subject directory with timing info
 24    set sdir_timing = ${topdir}/timing/${sub}
 25
 26    cd ${topdir}/${sub}
 27
 28    # Comments on processing
 29    #
 30    # a. Use anatomical skullstrip results from @SSwarper (also now sswarper2
 31    #    is available);
 32    # b. No tshift here as all slices are obtained simultaneously;
 33    # c. No blur to preserve the spatial variances across neighboring voxels;
 34    # d. Include 6 PCs from ventricles and 6 PCs from eroded WM in the 
 35    #    regression model to account for physiological noises;
 36    # e. Include both demeaned and derivatives of motion parameters in the
 37    #    regression model;
 38    # f. Not only censor motion, but also TRs when more than 10% of the voxels
 39    #    are detected as outliers;
 40    # g. Run regression model via 3dREMLfit to address the temporal 
 41    #    autocorrelation issue for the fast fMRI data.
 42    # h. In this special dataset case, the final processing of all
 43    #    runs together had 16,000 time points, so HTML creation was
 44    #    turned off by adding '-html_review_style none', relying on
 45    #    early QC checks and additional ones after the full run.
 46
 47    afni_proc.py                                                             \
 48        -subj_id                  ${sub}                                     \
 49        -script                   proc.task.${sub}.correct_noblur_REML       \
 50        -out_dir                  results.task.${sub}.correct_noblur_REML    \
 51        -dsets                    ${sub}_task01+orig ${sub}_task02+orig      \
 52                                  ${sub}_task03+orig ${sub}_task04+orig      \
 53                                  ${sub}_task05+orig ${sub}_task06+orig      \
 54                                  ${sub}_task07+orig ${sub}_task08+orig      \
 55                                  ${sub}_task09+orig ${sub}_task10+orig      \
 56        -copy_anat                ${sub}_SurfVol_SS+orig                     \
 57        -anat_has_skull           no                                         \
 58        -anat_follower_ROI        anat_WM epi ${sub}_anat_WM_mask+orig       \
 59        -anat_follower_ROI        anat_Vent epi ${sub}_anat_Vent_mask+orig   \
 60        -anat_follower_erode      anat_WM                                    \
 61        -blocks                   align volreg mask scale regress            \
 62        -tcat_remove_first_trs    0                                          \
 63        -volreg_align_to          MIN_OUTLIER                                \
 64        -align_opts_aea           -cost lpc+ZZ                               \
 65                                  -giant_move                                \
 66                                  -cmass cmass                               \
 67        -volreg_align_e2a                                                    \
 68        -volreg_warp_master       ${sub}_task01+orig                         \
 69        -mask_apply               anat                                       \
 70        -regress_stim_times       ${sdir_timing}/AO_correct.1D               \
 71                                  ${sdir_timing}/AO_response_correct.1D      \
 72                                  ${sdir_timing}/VM_correct.1D               \
 73                                  ${sdir_timing}/VM_response_correct_left.1D \
 74                                  ${sdir_timing}/VM_response_correct_right.1D \
 75                                  ${sdir_timing}/S_AOVM_correct.1D           \
 76                                  ${sdir_timing}/S_VMAO_correct.1D           \
 77                                  ${sdir_timing}/L_AOVM_correct.1D           \
 78                                  ${sdir_timing}/L_VMAO_correct.1D           \
 79                                  ${sdir_timing}/AO_incorrect.1D             \
 80                                  ${sdir_timing}/AO_response_incorrect.1D    \
 81                                  ${sdir_timing}/VM_incorrect.1D             \
 82                                  ${sdir_timing}/VM_response_incorrect.1D    \
 83                                  ${sdir_timing}/S_AOVM_incorrect.1D         \
 84                                  ${sdir_timing}/S_VMAO_incorrect.1D         \
 85                                  ${sdir_timing}/L_AOVM_incorrect.1D         \
 86                                  ${sdir_timing}/L_VMAO_incorrect.1D         \
 87        -regress_local_times                                                 \
 88        -regress_stim_labels      AO_c AO_resp_c VM_c VM_resp_c_left         \
 89                                  VM_resp_c_right S_AOVM_c S_VMAO_c L_AOVM_c \
 90                                  L_VMAO_c AO_inc AO_resp_inc VM_inc         \
 91                                  VM_resp_inc S_AOVM_inc S_VMAO_inc          \
 92                                  L_AOVM_inc L_VMAO_inc                      \
 93        -regress_basis_multi      'TWOGAMpw(4,3,0.2,7.5,3)'                  \
 94                                  'TWOGAMpw(4,3,0.2,7.5,3)'                  \
 95                                  'TWOGAMpw(4,3,0.2,7.5,3)'                  \
 96                                  'TWOGAMpw(4,3,0.2,7.5,3)'                  \
 97                                  'TWOGAMpw(4,3,0.2,7.5,3)'                  \
 98                                  'TWOGAMpw(4,3,0.2,7.5,3)'                  \
 99                                  'TWOGAMpw(4,3,0.2,7.5,3)'                  \
100                                  'TWOGAMpw(4,3,0.2,7.5,3)'                  \
101                                  'TWOGAMpw(4,3,0.2,7.5,3)'                  \
102                                  'TWOGAMpw(4,3,0.2,7.5,3)'                  \
103                                  'TWOGAMpw(4,3,0.2,7.5,3)'                  \
104                                  'TWOGAMpw(4,3,0.2,7.5,3)'                  \
105                                  'TWOGAMpw(4,3,0.2,7.5,3)'                  \
106                                  'TWOGAMpw(4,3,0.2,7.5,3)'                  \
107                                  'TWOGAMpw(4,3,0.2,7.5,3)'                  \
108                                  'TWOGAMpw(4,3,0.2,7.5,3)'                  \
109                                  'TWOGAMpw(4,3,0.2,7.5,3)'                  \
110        -regress_ROI_PC           anat_Vent 6                                \
111        -regress_ROI_PC           anat_WM 6                                  \
112        -regress_censor_motion    0.3                                        \
113        -regress_censor_outliers  0.1                                        \
114        -regress_apply_mot_types  demean deriv                               \
115        -regress_opts_3dD         -jobs 6                                    \
116                                  -num_glt 15                                \
117                                  -gltsym                                    \
118                                  'SYM: S_AOVM_c -AO_c -AO_resp_c -VM_c -VM_resp_c_left -VM_resp_c_right' \
119                                  -glt_label 1 S_AOVM.vs.single              \
120                                  -gltsym                                    \
121                                  'SYM: S_VMAO_c -AO_c -AO_resp_c -VM_c -VM_resp_c_left -VM_resp_c_right' \
122                                  -glt_label 2 S_VMAO.vs.single              \
123                                  -gltsym                                    \
124                                  'SYM: L_AOVM_c -AO_c -AO_resp_c -VM_c -VM_resp_c_left -VM_resp_c_right' \
125                                  -glt_label 3 L_AOVM.vs.single              \
126                                  -gltsym                                    \
127                                  'SYM: L_VMAO_c -AO_c -AO_resp_c -VM_c -VM_resp_c_left -VM_resp_c_right' \
128                                  -glt_label 4 L_VMAO.vs.single              \
129                                  -gltsym                                    \
130                                  'SYM: 0.5*S_AOVM_c 0.5*S_VMAO_c -AO_c -AO_resp_c -VM_c -VM_resp_c_left -VM_resp_c_right' \
131                                  -glt_label 5 S_dual.vs.single              \
132                                  -gltsym                                    \
133                                  'SYM: 0.5*L_AOVM_c 0.5*L_VMAO_c -AO_c -AO_resp_c -VM_c -VM_resp_c_left -VM_resp_c_right' \
134                                  -glt_label 6 L_dual.vs.single              \
135                                  -gltsym 'SYM: S_AOVM_c -L_AOVM_c'          \
136                                  -glt_label 7 S.vs.L_AOVM                   \
137                                  -gltsym 'SYM: S_VMAO_c -L_VMAO_c'          \
138                                  -glt_label 8 S.vs.L_VMAO                   \
139                                  -gltsym                                    \
140                                  'SYM: S_AOVM_c S_VMAO_c -L_AOVM_c -L_VMAO_c' \
141                                  -glt_label 9 S.vs.L_dual                   \
142                                  -gltsym 'SYM: AO_c -VM_c'                  \
143                                  -glt_label 10 AO.vs.VM                     \
144                                  -gltsym 'SYM: AO_resp_c -VM_resp_c_left'   \
145                                  -glt_label 11 AO_resp.vs.VM_resp_left      \
146                                  -gltsym 'SYM: AO_resp_c -VM_resp_c_right'  \
147                                  -glt_label 12 AO_resp.vs.VM_resp_right     \
148                                  -gltsym                                    \
149                                  'SYM: AO_resp_c -VM_resp_c_left -VM_resp_c_right' \
150                                  -glt_label 13 AO_resp.vs.VM_resp           \
151                                  -gltsym                                    \
152                                  'SYM: VM_resp_c_left VM_resp_c_right'      \
153                                  -glt_label 14 VM_resp                      \
154                                  -gltsym                                    \
155                                  'SYM: VM_resp_c_left -VM_resp_c_right'     \
156                                  -glt_label 15 VM_resp_left.vs.right        \
157        -regress_3dD_stop                                                    \
158        -regress_reml_exec                                                   \
159        -regress_run_clustsim     no
160
161    # run the generated script for preprocessing and GLM1 (with REML
162    # approach), with log file generated
163    tcsh -xef proc.task.${sub}.correct_noblur_REML                           \
164        |& tee output.proc.task.${sub}.correct_noblur_REML
165
166end