3dDeconvolve Question

Hello, AFNI team!

I am trying to run 3dDeconvolve, but I am having trouble with the correct way to specify the basis function. If I use the script below, then I get the message “-‘BLOCK’ is unknown response function type”. If I remove the quotation marks around ‘BLOCK(1,6)’, then I get the message “Badly placed (.”

Please let me know what I am doing wrong and how to do it correctly!

Thank you.

PS There are 6 functional runs and 9 conditions specified by timing files.

#!/bin/tcsh

foreach subject (313)

#navigate to the 'keep ’ directory
cd ${subject}/${subject}.keep

#copy the timing files to this directory
cp …/*.txt ./

#deconvolve here

3dDeconvolve -input pb05.${subject}.r01.scale+tlrc pb05.${subject}.r02.scale+tlrc pb05.${subject}.r03.scale+tlrc pb05.${subject}.r04.scale+tlrc pb05.${subject}.r05.scale+tlrc pb05.${subject}.r06.scale+tlrc -noblock -censor motion_${subject}_censor.1D -ortvec mot_demean.r01.1D mot_demean_r01 -ortvec mot_demean.r02.1D mot_demean_r02 -ortvec mot_demean.r03.1D mot_demean_r03 -ortvec mot_demean.r04.1D mot_demean_r04 -ortvec mot_demean.r05.1D mot_demean_r05 -ortvec mot_demean.r06.1D mot_demean_r06 -polort 2 -num_stimts 9 -stim_times 1 XFC${subject}FarFracFrac.txt -‘BLOCK(1,6)’ -stim_label 1 farff -stim_times 2 XFC${subject}NearFracFrac.txt -‘BLOCK(1,6)’ -stim_label 2 nearff -stim_times 3 XFC${subject}MedFracFrac.txt -‘BLOCK(1,6)’ -stim_label 3 medff -stim_times 4 XFC${subject}FarFracLine.txt -‘BLOCK(1,6)’ -stim_label 4 farfl -stim_times 5 XFC${subject}NearFracLine.txt -‘BLOCK(1,6)’ -stim_label 5 nearfl -stim_times 6 XFC${subject}MedFracLine.txt ‘BLOCK(1,6)’ -stim_label 6 medfl -stim_times 7 XFC${subject}FarLineLine.txt -stim_label 7 farll -stim_times 8 XFC${subject}NearLineLine.txt -stim_label 8 nearll -stim_times 9 XFC${subject}MedLineLine.txt -stim_label 9 medll -gltsym ‘SYM: +nearff +nearfl +nearll -farff -farfl -farll’ -glt_label 1 all_near_far -gltsym ‘SYM: +nearff -farff’ -glt_label 2 FF_near_far -gltsym ‘SYM: + +nearll -farll’ -glt_label 3 LL_near_far -gltsym ‘SYM: +nearfl -farfl’ -glt_label 4 FL_near_far -fout -tout -x1D X.xmat.1D -xjpeg X.jpg -x1D_uncensored X.nocensor.xmat.1D -fitts fitts.${subject} -errts errts.${subject} -bucket stats.${subject}

cd …/…

end

Also, a “funny” story about why I am trying to use 3dDeconvolve this way. I had an afni_proc.py script that looped over participants set up, and I ran it, but I ended up with no ‘stats’ files (however, I had pb05 BRIKs for all the participants). This script worked before–the only change I made was the blur size. Is it possible that for some reason increasing the FWHM would make the regression step fail?

(I deleted most of the results folders due to limited server space).

Thanks.


#!/bin/tcsh

#based on AFNI help for afni_proc.py example 6. tcat_remove changed to 5; tlrc default to TT_27;
#https://afni.nimh.nih.gov/pub/dist/doc/program_help/afni_proc.py.html

foreach subj (304 305 306 307 309 311 312 313 315 316 317 318 319 320 321 323 324 325 326)

cd ${subj}

afni_proc.py -subj_id ${subj}
-copy_anat XFC_${subj}structural+orig
-dsets XFC
${subj}00005+orig XFC${subj}00006+orig XFC${subj}00007+orig XFC${subj}00008+orig XFC${subj}00009+orig XFC${subj}_00010+orig
-blocks despike tshift align tlrc volreg blur mask
scale regress
-tcat_remove_first_trs 5
-align_opts_aea -cost lpc+ZZ
-volreg_align_to MIN_OUTLIER
-volreg_align_e2a
-volreg_tlrc_warp
-mask_epi_anat yes
-blur_size 8
-regress_stim_times
XFC${subj}FarFracFrac.txt
XFC${subj}NearFracFrac.txt
XFC${subj}MedFracFrac.txt
XFC${subj}FarFracLine.txt
XFC${subj}NearFracLine.txt
XFC${subj}MedFracLine.txt
XFC${subj}FarLineLine.txt
XFC${subj}NearLineLine.txt
XFC${subj}MedLineLine.txt
-regress_stim_labels farff nearff meDFf
farfl
nearfl
medfl
farll
nearll
medll
-regress_basis ‘BLOCK(6,1)’
-regress_motion_per_run
-regress_censor_motion .3

-regress_opts_3dD
-gltsym ‘SYM: +nearff +nearfl +nearll -farff -farfl -farll’
-glt_label 1 all_near_far
-gltsym ‘SYM: +nearff -farff’
-glt_label 2 FF_near_far
-gltsym ‘SYM: + +nearll -farll’
-glt_label 3 LL_near_far
-gltsym ‘SYM: +nearfl -farfl’
-glt_label 4 FL_near_far
-regress_est_blur_epits
-regress_est_blur_errts

tcsh -xef proc.${subj} |& tee output.proc.${subj}

mkdir $subj.keep

mv $subj.results/stats $subj.keep/

mv $subj.results/pb05* $subj.keep/

mv $subj.results/anat_final* $subj.keep/

mv $subj.results/anat_w* $subj.keep/

mv $subj.results/*.1D $subj.keep/

#rm -r -f $subj.results

cd …/

Please respond! Let me know if you need more information!

In your first query, you don’t need or want the ‘-’ in front of the BLOCK model names in the script. Option names start with ‘-’, but the option parameters [such as ‘BLOCK(6,1)’] do not – unless the option parameter is a negative number.

I don’t know what the problem was with the afni_proc.py script, though.

Thanks! When I try removing the ‘-’ before ‘BLOCK’, then I get the message:

“FATAL ERROR: ‘-stim_times 7’: don’t understand basis function model ‘-stim_label’ [nopt=78]”

What am I missing?

Thanks.

You have

-stim_times 7 XFC${subject}FarLineLine.txt -stim_label 7

You forgot to put the response model [presumably 'BLOCK(1,6)'] between the filename and the -stim_label option.

facepalm Thanks! I don’t know how long it would have taken me to find that on my own.

The more eyes look at something, the simpler it becomes (usually).