Hi all,
We are trying to run functional preprocessing nuisance regression with the 3Ddeconvolve command and it doesnt look like the CSF and ventricle derivatives are being regressed out
Here is the script we’re using- any idea why thats happening?
All and any advice is appreciated- thank you in advance!!
echo
echo “Creating WM and ventricular masks…”
cd tmp
# Convert FAST output to MNI space
/usr/local/fsl/bin/applywarp --interp=nn --in=T1_fast_pve_CSF --ref=${subj}_anat_biascorr_MNI -w ${subj}_T1_to_MNI_nonlin_field -o T1_fast_pve_CSF_MNI
/usr/local/fsl/bin/applywarp --interp=nn --in=T1_fast_pve_WM --ref=${subj}_anat_biascorr_MNI -w ${subj}_T1_to_MNI_nonlin_field -o T1_fast_pve_WM_MNI
# Make two masks of the MNI brain: one w/ cerebrum and one w/ ventricles
3dcalc -a /usr/local/fsl/data/standard/MNI152_t1_2mm_strucseg.nii.gz -expr “amongst(a,1,5)” -prefix ${subj}_MNI152_t1_2mm_MNI_cerebrum.nii.gz
3dcalc -a /usr/local/fsl/data/standard/MNI152_t1_2mm_strucseg.nii.gz -expr “equals(a,5)” -prefix ${subj}_MNI152_t1_2mm_MNI_ventricles.nii.gz
# Make and trim the WM and ventricle masks
3dcalc -a ${subj}_MNI152_t1_2mm_MNI_ventricles.nii.gz -b T1_fast_pve_CSF_MNI.nii.gz -expr “abequals(b,1)” -prefix ${subj}_ventricles_all.nii.gz
3dcalc -a ${subj}_MNI152_t1_2mm_MNI_cerebrum.nii.gz -b T1_fast_pve_WM_MNI.nii.gz -expr “abequals(b,1)” -prefix ${subj}_WM_all.nii.gz
##STEP1B##
cd tmp
3dcalc -a ${subj}_WM_all.nii.gz -b a+i -c a-i -d a+j -e a-j -f a+k -g a-k \
-expr ‘a*(1-amongst(0,b,c,d,e,f,g))’ -prefix ${subj}_WM_trim1.nii.gz
3dcalc -a ${subj}_WM_trim1.nii.gz -b a+i -c a-i -d a+j -e a-j -f a+k -g a-k \
-expr ‘a*(1-amongst(0,b,c,d,e,f,g))’ -prefix ${subj}_wm_mask.nii.gz
3dcalc -a ${subj}_ventricles_all.nii.gz -b a+i -c a-i -d a+j -e a-j -f a+k -g a-k \
-expr ‘a*(1-amongst(0,b,c,d,e,f,g))’ -prefix ${subj}_vent_trim1.nii.gz
3dcalc -a ${subj}_vent_trim1.nii.gz -b a+i -c a-i -d a+j -e a-j -f a+k -g a-k \
-expr ‘a*(1-amongst(0,b,c,d,e,f,g))’ -prefix ${subj}_vent_mask.nii.gz
##STEP3##
echo
echo “Extracting regressor signals…”
rm ${subj}_*_regressor.1D
3dmaskave -q -mask ${subj}_wm_mask.nii.gz rest/${subj}_rest_mcf_MNI_b6.nii.gz > ${subj}_wm_regressor.1D
3dmaskave -q -mask ${subj}_vent_mask.nii.gz rest/${subj}_rest_mcf_MNI_b6.nii.gz > ${subj}_vent_regressor.1D
3dmaskave -q -mask rest/${subj}_automask_MNI.nii.gz rest/${subj}_rest_mcf_MNI_b6.nii.gz > ${subj}_gs_regressor.1D
##STEP4##
echo
echo “Computing derivatives…”
cd ${subjectsDirectory}/${subj}/rest/qualitycontrol/motion
1d_tool.py -infile ${subj}_fMRI_vr_motion.1D -derivative -overwrite -write ${subj}_fMRI_vr_motion_deriv.1D
cd …/…/…
1d_tool.py -infile ${subj}_wm_regressor.1D -derivative -overwrite -write ${subj}_wm_regressor_deriv.1D
1d_tool.py -infile ${subj}_vent_regressor.1D -derivative -overwrite -write ${subj}_vent_regressor_deriv.1D
1d_tool.py -infile ${subj}_gs_regressor.1D -derivative -overwrite -write ${subj}_gs_regressor_deriv.1D
echo
cd ${subjectsDirectory}/${subj}
echo “Removing nuisance regressors…”
3dDeconvolve -float -input rest/${subj}_rest_mcf_MNI_b6.nii.gz \
-nfirst 0 -polort 4 \
-mask rest/${subj}_automask_MNI.nii.gz \
-GOFORIT 5 \
-num_stimts 16 \
-stim_file 1 rest/qualitycontrol/motion/${subj}_fMRI_vr_motion.1D’[0]’ -stim_label 1 roll -stim_base 1 \
-stim_file 2 rest/qualitycontrol/motion/${subj}_fMRI_vr_motion.1D’[1]’ -stim_label 2 pitch -stim_base 2 \
-stim_file 3 rest/qualitycontrol/motion/${subj}_fMRI_vr_motion.1D’[2]’ -stim_label 3 yaw -stim_base 3 \
-stim_file 4 rest/qualitycontrol/motion/${subj}_fMRI_vr_motion.1D’[3]’ -stim_label 4 x -stim_base 4 \
-stim_file 5 rest/qualitycontrol/motion/${subj}_fMRI_vr_motion.1D’[4]’ -stim_label 5 y -stim_base 5 \
-stim_file 6 rest/qualitycontrol/motion/${subj}_fMRI_vr_motion.1D’[5]’ -stim_label 6 z -stim_base 6 \
-stim_file 7 rest/qualitycontrol/motion/${subj}_fMRI_vr_motion_deriv.1D’[0]’ -stim_label 7 droll -stim_base 7 \
-stim_file 8 rest/qualitycontrol/motion/${subj}_fMRI_vr_motion_deriv.1D’[1]’ -stim_label 8 dpitch -stim_base 8 \
-stim_file 9 rest/qualitycontrol/motion/${subj}_fMRI_vr_motion_deriv.1D’[2]’ -stim_label 9 dyaw -stim_base 9 \
-stim_file 10 rest/qualitycontrol/motion/${subj}_fMRI_vr_motion_deriv.1D’[3]’ -stim_label 10 dx -stim_base 10 \
-stim_file 11 rest/qualitycontrol/motion/${subj}_fMRI_vr_motion_deriv.1D’[4]’ -stim_label 11 dy -stim_base 11 \
-stim_file 12 rest/qualitycontrol/motion/${subj}_fMRI_vr_motion_deriv.1D’[5]’ -stim_label 12 dz -stim_base 12 \
-stim_file 13 ${subj}_wm_regressor.1D’[0]’ -stim_label 13 wm -stim_base 13 \
-stim_file 14 ${subj}_vent_regressor.1D’[0]’ -stim_label 14 vent -stim_base 14 \
-stim_file 15 ${subj}_wm_regressor_deriv.1D’[0]’ -stim_label 15 dwm -stim_base 15 \
-stim_file 16 ${subj}_vent_regressor_deriv.1D’[0]’ -stim_label 16 dvent -stim_base 16 \
-jobs 2 \
-errts rest/${subj}_rest_mcf_MNI_b6_nuisreg.nii.gz
echo
cd ${subjectsDirectory}/${subj}
rm Decon*
3dDeconvolve -float -input rest/${subj}_rest_mcf_orig_b6.nii.gz \
-nfirst 0 -polort 4 \
-mask rest/${subj}_automask_orig.nii.gz \
-GOFORIT 5 \
-num_stimts 16 \
-stim_file 1 rest/qualitycontrol/motion/${subj}_fMRI_vr_motion.1D’[0]’ -stim_label 1 roll -stim_base 1 \
-stim_file 2 rest/qualitycontrol/motion/${subj}_fMRI_vr_motion.1D’[1]’ -stim_label 2 pitch -stim_base 2 \
-stim_file 3 rest/qualitycontrol/motion/${subj}_fMRI_vr_motion.1D’[2]’ -stim_label 3 yaw -stim_base 3 \
-stim_file 4 rest/qualitycontrol/motion/${subj}_fMRI_vr_motion.1D’[3]’ -stim_label 4 x -stim_base 4 \
-stim_file 5 rest/qualitycontrol/motion/${subj}_fMRI_vr_motion.1D’[4]’ -stim_label 5 y -stim_base 5 \
-stim_file 6 rest/qualitycontrol/motion/${subj}_fMRI_vr_motion.1D’[5]’ -stim_label 6 z -stim_base 6 \
-stim_file 7 rest/qualitycontrol/motion/${subj}_fMRI_vr_motion_deriv.1D’[0]’ -stim_label 7 droll -stim_base 7 \
-stim_file 8 rest/qualitycontrol/motion/${subj}_fMRI_vr_motion_deriv.1D’[1]’ -stim_label 8 dpitch -stim_base 8 \
-stim_file 9 rest/qualitycontrol/motion/${subj}_fMRI_vr_motion_deriv.1D’[2]’ -stim_label 9 dyaw -stim_base 9 \
-stim_file 10 rest/qualitycontrol/motion/${subj}_fMRI_vr_motion_deriv.1D’[3]’ -stim_label 10 dx -stim_base 10 \
-stim_file 11 rest/qualitycontrol/motion/${subj}_fMRI_vr_motion_deriv.1D’[4]’ -stim_label 11 dy -stim_base 11 \
-stim_file 12 rest/qualitycontrol/motion/${subj}_fMRI_vr_motion_deriv.1D’[5]’ -stim_label 12 dz -stim_base 12 \
-stim_file 13 ${subj}_wm_regressor.1D’[0]’ -stim_label 13 wm -stim_base 13 \
-stim_file 14 ${subj}_vent_regressor.1D’[0]’ -stim_label 14 vent -stim_base 14 \
-stim_file 15 ${subj}_wm_regressor_deriv.1D’[0]’ -stim_label 15 dwm -stim_base 15 \
-stim_file 16 ${subj}_vent_regressor_deriv.1D’[0]’ -stim_label 16 dvent -stim_base 16 \
-jobs 2 \
-errts rest/${subj}_rest_mcf_orig_b6_nuisreg.nii.gz
rm Decon*
cd ${subjectsDirectory}/${subj}/rest
echo
echo "Filtering..."
3dTproject -input ${subj}_rest_mcf_MNI_b6_nuisreg.nii.gz -passband 0.008 0.08 -quiet -prefix ${subj}_rest_mcf_MNI_b6_nuisreg_bp.nii.gz
3dTproject -input ${subj}_rest_mcf_orig_b6_nuisreg.nii.gz -passband 0.008 0.08 -quiet -prefix ${subj}_rest_mcf_orig_b6_nuisreg_bp.nii.gz
end