Minimal preprcessing pipepline involves 1) despike (3dDespike), 2) slice-timing correction (3dTshift), 3) motion correction (3dvolreg), 4) EPI distortion correction (topup). No temporal filtering or regression was performed:
#!/bin/bash
## required AFNI and FSL to be installed, and the foreach function (included in the resource pipeline).
sub=sub-IONm01 # define the animal
ses=ses-01 # define the sessions
inputdir=${BIDS_sourcedata_fMRI}/${sub}/${ses} # define input data dir
outputdir=${BIDS_preprocessed_fMRI_after}/${sub}/${ses}; mkdir -p ${outputdir} # define output data dir
tmpdir=/tmp/${sub}/${ses}; mkdir -p ${tmpdir}
topup_datain_RL=${pipeline_dir}/connectome_acq_param_blip_per2tp_RL.txt
topup_datain_LR=${pipeline_dir}/connectome_acq_param_blip_per2tp_LR.txt
topup_config=${pipeline_dir}/b02b0_marmoset.cnf
tpattern=altplus
TR=2
numCPU=8 # define the how many CPU for parallel computing
## environment variable -- DON'T CHANGE
export OMP_NUM_THREADS=${numCPU}
export ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS=${numCPU}
export FSLOUTPUTTYPE=NIFTI ## dont change the format
## ======== copy data to tmp folder ========
cp ${inputdir}/func/*task-rest_run*.nii.gz ${tmpdir}
gzip -d -f ${tmpdir}/*.nii.gz
## ======== despike ========
foreach -${numCPU} ${tmpdir}/*task-rest_run*.nii : 3dDespike -NEW -nomask -prefix ${tmpdir}/PRE-despike.nii IN -overwrite
## ======== tshift ========
foreach -${numCPU} ${tmpdir}/*-despike.nii : 3dTshift -TR ${TR}s -Fourier -tpattern ${tpattern} -prefix ${tmpdir}/PRE-tshift.nii IN -overwrite
## ======== volreg (two round) ========
3dbucket -prefix ${tmpdir}/RL-vr-base.nii ${tmpdir}/${sub}_${ses}_task-rest_run-RL-1-despike-tshift.nii"[0]" -overwrite
3dbucket -prefix ${tmpdir}/LR-vr-base.nii ${tmpdir}/${sub}_${ses}_task-rest_run-LR-1-despike-tshift.nii"[0]" -overwrite
foreach -${numCPU} ${tmpdir}/*-RL-*-tshift.nii : 3dvolreg -zpad 5 -base ${tmpdir}/RL-vr-base.nii -prefix ${tmpdir}/PRE-volreg.nii -1Dfile ${tmpdir}/PRE-volreg.1D -Fourier -overwrite IN
foreach -${numCPU} ${tmpdir}/*-LR-*-tshift.nii : 3dvolreg -zpad 5 -base ${tmpdir}/LR-vr-base.nii -prefix ${tmpdir}/PRE-volreg.nii -1Dfile ${tmpdir}/PRE-volreg.1D -Fourier -overwrite IN
fslmerge -t ${tmpdir}/RL-vr-base.nii ${tmpdir}/*-RL-*-tshift-volreg.nii
fslmerge -t ${tmpdir}/LR-vr-base.nii ${tmpdir}/*-LR-*-tshift-volreg.nii
fslmaths ${tmpdir}/RL-vr-base.nii -Tmean ${tmpdir}/RL-vr-base.nii
fslmaths ${tmpdir}/LR-vr-base.nii -Tmean ${tmpdir}/LR-vr-base.nii
foreach -${numCPU} ${tmpdir}/*-RL-*-tshift.nii : 3dvolreg -zpad 5 -base ${tmpdir}/RL-vr-base.nii -prefix ${tmpdir}/PRE-volreg.nii -1Dfile ${tmpdir}/PRE-volreg.1D -Fourier -overwrite IN
foreach -${numCPU} ${tmpdir}/*-LR-*-tshift.nii : 3dvolreg -zpad 5 -base ${tmpdir}/LR-vr-base.nii -prefix ${tmpdir}/PRE-volreg.nii -1Dfile ${tmpdir}/PRE-volreg.1D -Fourier -overwrite IN
## ======== topup ========
cp ${inputdir}/func/${sub}_${ses}_task-rest_SEEPI-RL.nii.gz ${tmpdir}/SEEPI-RL.nii.gz
cp ${inputdir}/func/${sub}_${ses}_task-rest_SEEPI-LR.nii.gz ${tmpdir}/SEEPI-LR.nii.gz
## preprocess SEEPI for RL
3dvolreg -zpad 5 -base ${tmpdir}/RL-vr-base.nii -prefix ${tmpdir}/SEEPI-RLLR-RL.nii -Fourier -overwrite ${tmpdir}/SEEPI-RL.nii.gz
fslmaths ${tmpdir}/SEEPI-RLLR-RL.nii -Tmean ${tmpdir}/SEEPI-RLLR-RL.nii
3dvolreg -zpad 5 -base ${tmpdir}/SEEPI-RLLR-RL.nii -prefix ${tmpdir}/SEEPI-RLLR-LR.nii -Fourier -overwrite ${tmpdir}/SEEPI-LR.nii.gz
fslmaths ${tmpdir}/SEEPI-RLLR-LR.nii -Tmean ${tmpdir}/SEEPI-RLLR-LR.nii
fslmerge -t ${tmpdir}/SEEPI-RLLR.nii ${tmpdir}/SEEPI-RLLR-RL.nii ${tmpdir}/SEEPI-RLLR-LR.nii
## preprocess SEEPI for LR
3dvolreg -zpad 5 -base ${tmpdir}/LR-vr-base.nii -prefix ${tmpdir}/SEEPI-LRRL-LR.nii -Fourier -overwrite ${tmpdir}/SEEPI-LR.nii.gz
fslmaths ${tmpdir}/SEEPI-LRRL-LR.nii -Tmean ${tmpdir}/SEEPI-LRRL-LR.nii
3dvolreg -zpad 5 -base ${tmpdir}/SEEPI-LRRL-LR.nii -prefix ${tmpdir}/SEEPI-LRRL-RL.nii -Fourier -overwrite ${tmpdir}/SEEPI-RL.nii.gz
fslmaths ${tmpdir}/SEEPI-LRRL-RL.nii -Tmean ${tmpdir}/SEEPI-LRRL-RL.nii
fslmerge -t ${tmpdir}/SEEPI-LRRL.nii ${tmpdir}/SEEPI-LRRL-LR.nii ${tmpdir}/SEEPI-LRRL-RL.nii
## topup for LR
topup --imain=${tmpdir}/SEEPI-LRRL.nii --datain=${topup_datain_LR} --config=${topup_config} --out=${tmpdir}/SEEPI-LRRL-topup-results --fout=${tmpdir}/SEEPI-LRRL-fout --iout=${tmpdir}/SEEPI-LRRL-iout
## topup for RL
topup --imain=${tmpdir}/SEEPI-RLLR.nii --datain=${topup_datain_RL} --config=${topup_config} --out=${tmpdir}/SEEPI-RLLR-topup-results --fout=${tmpdir}/SEEPI-RLLR-fout --iout=${tmpdir}/SEEPI-RLLR-iout
## applytopup for LR
foreach -${numCPU} ${tmpdir}/*-RL-*-volreg.nii : applytopup --imain=IN --datain=${topup_datain_RL} --method=jac --inindex=1 --topup=${tmpdir}/SEEPI-RLLR-topup-results --out=${outputdir}/PRE-topup.nii.gz
## applytopup for RL
foreach -${numCPU} ${tmpdir}/*-LR-*-volreg.nii : applytopup --imain=IN --datain=${topup_datain_LR} --method=jac --inindex=1 --topup=${tmpdir}/SEEPI-LRRL-topup-results --out=${outputdir}/PRE-topup.nii.gz
rename -f 's///' ${outputdir}/*
rename -f 's/-despike-tshift-volreg-topup//' ${outputdir}/*
Following the Minimal preprcessing pipepline, the data were de-noised by regressing out different noise components by 3dDeconvolve and 3dTproject. The B represents band-passing (0.01Hz-0.1Hz);
The M represents demeaned motion parameters and their derivatives;
The W represents the demeaned white matter signal;
The C represents the demeaned csf signal;
The G represents the global signal regression (demeaned whole brain signal);
The 0 represents the motion-censor: any TR and the previous TR were censored (set to zeros) if the motion was >0.2 mm.
#!/bin/bash
sub=sub-IONm01 # define the animal
ses=ses-01 # define the sessions
run=run-RL-1 #define the runs
inputdir=${BIDS_preprocessed_fMRI_before}/${sub}/${ses} # define input data dir
regressordir=${BIDS_fMRI_regressors}/${sub}/${ses} # define regressor dir
numCPU=8
###
## without global signal regression
###
regr_type=regrBMWC0
outputdir=${BIDS-preprocessed-fMRI_after}/${sub}/${ses}; mkdir -p ${outputdir} # define output dir
3dDeconvolve -input ${inputdir}/${sub}_${ses}_task-rest_${run}.nii.gz \
-censor ${regressordir}/${sub}_${ses}_task-rest_${run}_combined-censor.1D \
-ortvec ${regressordir}/${sub}_${ses}_task-rest_${run}_bpass.1D bandpass \
-ortvec ${regressordir}/${sub}_${ses}_task-rest_${run}_wm-demean.1D wm \
-ortvec ${regressordir}/${sub}_${ses}_task-rest_${run}_csf-demean.1D csf \
-float \
-num_stimts 12 \
-stim_file 1 ${regressordir}/${sub}_${ses}_task-rest_${run}_motion-demean.1D'[0]' -stim_base 1 -stim_label 1 roll_01 \
-stim_file 2 ${regressordir}/${sub}_${ses}_task-rest_${run}_motion-demean.1D'[1]' -stim_base 2 -stim_label 2 pitch_01 \
-stim_file 3 ${regressordir}/${sub}_${ses}_task-rest_${run}_motion-demean.1D'[2]' -stim_base 3 -stim_label 3 yaw_01 \
-stim_file 4 ${regressordir}/${sub}_${ses}_task-rest_${run}_motion-demean.1D'[3]' -stim_base 4 -stim_label 4 dS_01 \
-stim_file 5 ${regressordir}/${sub}_${ses}_task-rest_${run}_motion-demean.1D'[4]' -stim_base 5 -stim_label 5 dL_01 \
-stim_file 6 ${regressordir}/${sub}_${ses}_task-rest_${run}_motion-demean.1D'[5]' -stim_base 6 -stim_label 6 dP_01 \
-stim_file 7 ${regressordir}/${sub}_${ses}_task-rest_${run}_motion-deriv.1D'[0]' -stim_base 7 -stim_label 7 roll_02 \
-stim_file 8 ${regressordir}/${sub}_${ses}_task-rest_${run}_motion-deriv.1D'[1]' -stim_base 8 -stim_label 8 pitch_02 \
-stim_file 9 ${regressordir}/${sub}_${ses}_task-rest_${run}_motion-deriv.1D'[2]' -stim_base 9 -stim_label 9 yaw_02 \
-stim_file 10 ${regressordir}/${sub}_${ses}_task-rest_${run}_motion-deriv.1D'[3]' -stim_base 10 -stim_label 10 dS_02 \
-stim_file 11 ${regressordir}/${sub}_${ses}_task-rest_${run}_motion-deriv.1D'[4]' -stim_base 11 -stim_label 11 dL_02 \
-stim_file 12 ${regressordir}/${sub}_${ses}_task-rest_${run}_motion-deriv.1D'[5]' -stim_base 12 -stim_label 12 dP_02 \
-fout -tout -x1D ${outputdir}/${sub}_${ses}_task-rest_${run}_${regr_type}.xmat.1D \
-xjpeg ${outputdir}/tmp_${sub}_${ses}_task-rest_${run}_${regr_type}.jpg \
-x1D_uncensored ${outputdir}/${sub}_${ses}_task-rest_${run}_${regr_type}.nocensor.xmat.1D \
-fitts ${outputdir}/tmp_${sub}_${ses}_task-rest_${run}_${regr_type}_fitts \
-errts ${outputdir}/tmp_${sub}_${ses}_task-rest_${run}_${regr_type}_errts \
-bucket ${outputdir}/tmp_${sub}_${ses}_task-rest_${run}_${regr_type}_stats \
-jobs ${numCPU} -overwrite -x1D_stop
cenmode=ZERO
3dTproject -polort 0 -input ${inputdir}/${sub}_${ses}_task-rest_${run}.nii.gz -censor ${regressordir}/${sub}_${ses}_task-rest_${run}_combined-censor.1D -cenmode ${cenmode} -ort ${outputdir}/${sub}_${ses}_task-rest_${run}_${regr_type}.nocensor.xmat.1D -prefix ${outputdir}/${sub}_${ses}_task-rest_${run}.nii.gz -overwrite
###
## with global signal regression
###
regr_type=regrBMWCG0
outputdir=${BIDS-preprocessed-fMRI_after}/${sub}/${ses}; mkdir -p ${outputdir}
3dDeconvolve -input ${inputdir}/${sub}_${ses}_task-rest_${run}.nii.gz \
-censor ${regressordir}/${sub}_${ses}_task-rest_${run}_combined-censor.1D \
-ortvec ${regressordir}/${sub}_${ses}_task-rest_${run}_bpass.1D bandpass \
-ortvec ${regressordir}/${sub}_${ses}_task-rest_${run}_wm-demean.1D wm \
-ortvec ${regressordir}/${sub}_${ses}_task-rest_${run}_csf-demean.1D csf \
-ortvec ${regressordir}/${sub}_${ses}_task-rest_${run}_brain-demean.1D brain \
-float \
-num_stimts 12 \
-stim_file 1 ${regressordir}/${sub}_${ses}_task-rest_${run}_motion-demean.1D'[0]' -stim_base 1 -stim_label 1 roll_01 \
-stim_file 2 ${regressordir}/${sub}_${ses}_task-rest_${run}_motion-demean.1D'[1]' -stim_base 2 -stim_label 2 pitch_01 \
-stim_file 3 ${regressordir}/${sub}_${ses}_task-rest_${run}_motion-demean.1D'[2]' -stim_base 3 -stim_label 3 yaw_01 \
-stim_file 4 ${regressordir}/${sub}_${ses}_task-rest_${run}_motion-demean.1D'[3]' -stim_base 4 -stim_label 4 dS_01 \
-stim_file 5 ${regressordir}/${sub}_${ses}_task-rest_${run}_motion-demean.1D'[4]' -stim_base 5 -stim_label 5 dL_01 \
-stim_file 6 ${regressordir}/${sub}_${ses}_task-rest_${run}_motion-demean.1D'[5]' -stim_base 6 -stim_label 6 dP_01 \
-stim_file 7 ${regressordir}/${sub}_${ses}_task-rest_${run}_motion-deriv.1D'[0]' -stim_base 7 -stim_label 7 roll_02 \
-stim_file 8 ${regressordir}/${sub}_${ses}_task-rest_${run}_motion-deriv.1D'[1]' -stim_base 8 -stim_label 8 pitch_02 \
-stim_file 9 ${regressordir}/${sub}_${ses}_task-rest_${run}_motion-deriv.1D'[2]' -stim_base 9 -stim_label 9 yaw_02 \
-stim_file 10 ${regressordir}/${sub}_${ses}_task-rest_${run}_motion-deriv.1D'[3]' -stim_base 10 -stim_label 10 dS_02 \
-stim_file 11 ${regressordir}/${sub}_${ses}_task-rest_${run}_motion-deriv.1D'[4]' -stim_base 11 -stim_label 11 dL_02 \
-stim_file 12 ${regressordir}/${sub}_${ses}_task-rest_${run}_motion-deriv.1D'[5]' -stim_base 12 -stim_label 12 dP_02 \
-fout -tout -x1D ${outputdir}/${sub}_${ses}_task-rest_${run}_${regr_type}.xmat.1D \
-xjpeg ${outputdir}/tmp_${sub}_${ses}_task-rest_${run}_${regr_type}.jpg \
-x1D_uncensored ${outputdir}/${sub}_${ses}_task-rest_${run}_${regr_type}.nocensor.xmat.1D \
-fitts ${outputdir}/tmp_${sub}_${ses}_task-rest_${run}_${regr_type}_fitts \
-errts ${outputdir}/tmp_${sub}_${ses}_task-rest_${run}_${regr_type}_errts \
-bucket ${outputdir}/tmp_${sub}_${ses}_task-rest_${run}_${regr_type}_stats \
-jobs ${numCPU} -overwrite -x1D_stop
cenmode=ZERO
3dTproject -polort 0 -input ${inputdir}/${sub}_${ses}_task-rest_${run}.nii.gz -censor ${regressordir}/${sub}_${ses}_task-rest_${run}_combined-censor.1D -cenmode ${cenmode} -ort ${outputdir}/${sub}_${ses}_task-rest_${run}_${regr_type}.nocensor.xmat.1D -prefix ${outputdir}/${sub}_${ses}_task-rest_${run}.nii.gz -overwrite