multiple GLT briks from seemingly simple GLT specification

Hi everybody,

I have a problem which I’ve never seen before. I have the script below used to directly run 3dD.


3dDeconvolve -input $fmriprepdir/sub-${subj}_ses-${ses}_task-CCT_run-*_space-MNI152NLin6Asym_res-2_desc-preproc_bold.nii.gz \
	-jobs 8 \
	-polort 4                                                                 	\
	-float                                                                    	\
	-jobs 10                                                                   	\
	-local_times                                                    	 	\
	-num_stimts 38                                                            	\
	-allzero_OK                                                      		\
	-GOFORIT 3                                           			\
	-stim_times 1 $scriptdir/Error.txt 'BLOCK4(1,1)'            		\
	-stim_label 1 Error                                             	      	\
	-stim_times 2 $scriptdir/Feedback.txt 'BLOCK4(1,1)'         		\
	-stim_label 2 Feedback                                                    	\
	-stim_times 3 $scriptdir/InitSpatialBranch.txt 'BLOCK4(1,1)'		\
	-stim_label 3 InitSpatialBranch                                           	\
	-stim_times 4 $scriptdir/InitSpatialControl.txt 'BLOCK4(1,1)'		\
	-stim_label 4 InitSpatialControl                                           	\
	-stim_times 5 $scriptdir/InitSpatialDelay.txt 'BLOCK4(1,1)'         	\
	-stim_label 5 InitSpatialDelay                                              	\
	-stim_times 6 $scriptdir/InitSpatialSwitch.txt 'BLOCK4(1,1)'               	\
	-stim_label 6 InitSpatialSwitch                                             	\
	-stim_times 7 $scriptdir/InitVerbalBranch.txt 'BLOCK4(1,1)'               	\
	-stim_label 7 InitVerbalBranch                                            	\
	-stim_times 8 $scriptdir/InitVerbalControl.txt 'BLOCK4(1,1)'      		\
	-stim_label 8 InitVerbalControl                                             	\
	-stim_times 9 $scriptdir/InitVerbalDelay.txt 'BLOCK4(1,1)'        		\
	-stim_label 9 InitVerbalDelay                                               	\
	-stim_times 10 $scriptdir/InitVerbalSwitch.txt 'BLOCK4(1,1)'               	\
	-stim_label 10 InitVerbalSwitch                                            	\
	-stim_times 11 $scriptdir/LeftResponse.txt 'BLOCK4(1,1)'                 	\
	-stim_label 11 LeftResponse                                              	\
	-stim_times 12 $scriptdir/ReturnSpatialBranch.txt 'BLOCK4(1,1)'    		\
    	-stim_label 12 ReturnSpatialBranch                                          	\
    	-stim_times 13 $scriptdir/ReturnSpatialControl.txt 'BLOCK4(1,1)'           	\
    	-stim_label 13 ReturnSpatialControl                                         	\
    	-stim_times 14 $scriptdir/ReturnSpatialDelay.txt 'BLOCK4(1,1)'           	\
    	-stim_label 14 ReturnSpatialDelay                                       	\
    	-stim_times 15 $scriptdir/ReturnSpatialSwitch.txt 'BLOCK4(1,1)'        	\
    	-stim_label 15 ReturnSpatialSwitch                                     	\
    	-stim_times 16 $scriptdir/ReturnVerbalBranch.txt 'BLOCK4(1,1)'     		\
    	-stim_label 16 ReturnVerbalBranch                                     	\
    	-stim_times 17 $scriptdir/ReturnVerbalControl.txt 'BLOCK4(1,1)'           	\
    	-stim_label 17 ReturnVerbalControl                                      	\
    	-stim_times 18 $scriptdir/ReturnVerbalDelay.txt 'BLOCK4(1,1)'              	\
    	-stim_label 18 ReturnVerbalDelay                                          	\
    	-stim_times 19 $scriptdir/ReturnVerbalSwitch.txt 'BLOCK4(1,1)'            	\
    	-stim_label 19 ReturnVerbalSwitch                                       	\
    	-stim_times 20 $scriptdir/RightResponse.txt 'BLOCK4(1,1)'               	\
    	-stim_label 20 RightResponse                                             	\
    	-stim_times 21 $scriptdir/spatialBaseline1_tran.txt 'BLOCK4(1,1)'        	\
    	-stim_label 21 spatialBaseline1tran                                      	\
    	-stim_times 22 $scriptdir/spatialBaseline2_tran.txt 'BLOCK4(1,1)'          	\
    	-stim_label 22 spatialBaseline2tran                                    	\
    	-stim_times_AM1 23 $scriptdir/SpatialBranch.txt 'dmBLOCK(1)'		\
    	-stim_label 23 SpatialBranch                                             	\
    	-stim_times_AM1 24 $scriptdir/SpatialControl.txt 'dmBLOCK(1)'          	\
    	-stim_label 24 SpatialControl                                             	\
    	-stim_times_AM1 25 $scriptdir/SpatialDelay.txt 'dmBLOCK(1)'               	\
    	-stim_label 25 SpatialDelay                                             	\
    	-stim_times 26 $scriptdir/spatialInit.txt 'BLOCK4(1,1)'             	\
    	-stim_label 26 spatialInit                                             	\
    	-stim_times_AM1 27 $scriptdir/SpatialSwitch.txt 'dmBLOCK(1)'               	\
    	-stim_label 27 SpatialSwitch                                             	\
    	-stim_times 28 $scriptdir/verbalBaseline1_tran.txt 'BLOCK4(1,1)'           	\
    	-stim_label 28 verbalBaseline1tran                                       	\
    	-stim_times 29 $scriptdir/verbalBaseline2_tran.txt 'BLOCK4(1,1)'        	\
    	-stim_label 29 verbalBaseline2tran                                     	\
    	-stim_times_AM1 30 $scriptdir/VerbalBranch.txt 'dmBLOCK(1)'               	\
    	-stim_label 30 VerbalBranch                                             	\
    	-stim_times_AM1 31 $scriptdir/VerbalControl.txt 'dmBLOCK(1)'               	\
    	-stim_label 31 VerbalControl                                             	\
    	-stim_times_AM1 32 $scriptdir/VerbalDelay.txt 'dmBLOCK(1)'               	\
    	-stim_label 32 VerbalDelay                                             	\
    	-stim_times 33 $scriptdir/verbalInit.txt 'BLOCK4(1,1)'               	\
    	-stim_label 33 verbalInit                                             	\
    	-stim_times_AM1 34 $scriptdir/VerbalSwitch.txt 'dmBLOCK(1)'               	\
    	-stim_label 34 VerbalSwitch 						\
    	-stim_times_AM1 35 $scriptdir/spatialBaseline1_sus.txt 'dmBLOCK(1)'       	\
    	-stim_label 35 spatialBaseline1sus                                       	\
    	-stim_times_AM1 36 $scriptdir/spatialBaseline2_sus.txt 'dmBLOCK(1)'     	\
    	-stim_label 36 spatialBaseline2sus                                       	\
    	-stim_times_AM1 37 $scriptdir/verbalBaseline1_sus.txt 'dmBLOCK(1)'      	\
    	-stim_label 37 verbalBaseline1sus                                         	\
    	-stim_times_AM1 38 $scriptdir/verbalBaseline2_sus.txt 'dmBLOCK(1)'     	\
    	-stim_label 38 verbalBaseline2sus                                           	\
    	-num_glt 5                                                               	\
    	-gltsym 'SYM: 0.25*SpatialBranch +0.25*SpatialDelay +0.25*VerbalBranch 	\
	+.25*VerbalDelay -.25*SpatialControl -.25*SpatialSwitch -.25*VerbalControl \
	-.25*VerbalSwitch' 							\
    	-glt_label 1 Positive_TC                                                	\
    	-gltsym 'SYM: +.25*SpatialBranch +.25*SpatialSwitch +.25*VerbalBranch 	\
	+.25*VerbalSwitch -.25*SpatialControl -.25*SpatialDelay -.25*VerbalControl \
	-.25*VerbalDelay' 							\
    	-glt_label 2 Positive_CC 							\
    	-gltsym 'SYM: +.167*SpatialBranch +.167*SpatialSwitch +.167*SpatialDelay \
	+.167*VerbalBranch +.167*VerbalSwitch +.167*VerbalDelay -.5*SpatialControl \
	-.5*VerbalControl' 							\
    	-glt_label 3 Positive_SM 							\
    	-gltsym 'SYM: +.25*SpatialBranch +.25*SpatialSwitch +.25*SpatialControl 	\
	+.25*SpatialDelay -.25*VerbalBranch -.25*VerbalSwitch -.25*VerbalControl \
	-.25*VerbalDelay' 							\
    	-glt_label 4 Spatial 							\
    	-gltsym 'SYM: +.25*VerbalBranch +.25*VerbalSwitch +.25*VerbalControl 	\
	+.25*VerbalDelay -.25*SpatialBranch -.25*SpatialSwitch -.25*SpatialControl \
	-.25*SpatialDelay' 							\
    	-glt_label 5 Verbal 							\
    	-fout -tout     								\
    	-x1D $output_dir/X.xmat.1D   						\
    	-xjpeg $output_dir/X.jpg   						\
    	-errts $output_dir/sub-${subj}_ses-${ses}_CCT_errts.nii                   		\
    	-bucket $output_dir/sub-${subj}_ses-${ses}_CCT_stats.nii 

For reasons I do not understand, the GLTs are producing three coefficient/tstat pairs of sub-briks per GLT. I’ve never seen this before. The output from 3dinfo showing below has been edited to remove sub-briks related to individual betas for brevity but I can provide the whole thing necessary.


++ 3dinfo: AFNI version=AFNI_22.3.06 (Nov 20 2022) [64-bit]

Dataset File:    /home/colmconn/mriAnalysis/jess/sub-103_ses-V1_CCT_stats.nii
Identifier Code: AFN_b0UAV__ll21rc2QYrjXHDQ  Creation Date: Thu Jan 19 11:27:08 2023
Template Space:  MNI
Dataset Type:    Anat Bucket (-abuc)
Byte Order:      LSB_FIRST {assumed} [this CPU native = LSB_FIRST]
Storage Mode:    NIFTI
Storage Space:   541,577,400 (542 million) bytes
Geometry String: "MATRIX(-2,0,0,90,0,-2,0,126,0,0,2,-72):91,109,91"
Data Axes Tilt:  Plumb
Data Axes Orientation:
  first  (x) = Left-to-Right
  second (y) = Posterior-to-Anterior
  third  (z) = Inferior-to-Superior   [-orient LPI]
R-to-L extent:   -90.000 [R] -to-    90.000 [L] -step-     2.000 mm [ 91 voxels]
A-to-P extent:   -90.000 [A] -to-   126.000 [P] -step-     2.000 mm [109 voxels]
I-to-S extent:   -72.000 [I] -to-   108.000 [S] -step-     2.000 mm [ 91 voxels]
Number of values stored at each pixel = 150
  <--- >8 ---->
  -- At sub-brick #115 'Positive_TC_GLT#0_Coef' datum type is float:     -25.3866 to       25.5636
  -- At sub-brick #116 'Positive_TC_GLT#0_Tstat' datum type is float:     -4.69123 to       5.50368
     statcode = fitt;  statpar = 1648
  -- At sub-brick #117 'Positive_TC_GLT#1_Coef' datum type is float:     -13.3206 to       20.6431
  -- At sub-brick #118 'Positive_TC_GLT#1_Tstat' datum type is float:     -6.19946 to       4.79392
     statcode = fitt;  statpar = 1648
  -- At sub-brick #119 'Positive_TC_GLT#2_Coef' datum type is float:     -7.33805 to       9.86096
  -- At sub-brick #120 'Positive_TC_GLT#2_Tstat' datum type is float:     -5.09876 to       4.80523
     statcode = fitt;  statpar = 1648
  -- At sub-brick #121 'Positive_TC_GLT_Fstat' datum type is float:            0 to       34.4997
     statcode = fift;  statpar = 3 1648
  -- At sub-brick #122 'Positive_CC_GLT#0_Coef' datum type is float:      -27.425 to        29.315
  -- At sub-brick #123 'Positive_CC_GLT#0_Tstat' datum type is float:     -5.28585 to       5.24339
     statcode = fitt;  statpar = 1648
  -- At sub-brick #124 'Positive_CC_GLT#1_Coef' datum type is float:     -13.9727 to       23.5768
  -- At sub-brick #125 'Positive_CC_GLT#1_Tstat' datum type is float:     -4.90869 to       5.40784
     statcode = fitt;  statpar = 1648
  -- At sub-brick #126 'Positive_CC_GLT#2_Coef' datum type is float:     -7.86648 to       14.8651
  -- At sub-brick #127 'Positive_CC_GLT#2_Tstat' datum type is float:       -5.388 to       5.62748
     statcode = fitt;  statpar = 1648
  -- At sub-brick #128 'Positive_CC_GLT_Fstat' datum type is float:            0 to       33.3531
     statcode = fift;  statpar = 3 1648
  -- At sub-brick #129 'Positive_SM_GLT#0_Coef' datum type is float:      -18.169 to       17.1799
  -- At sub-brick #130 'Positive_SM_GLT#0_Tstat' datum type is float:      -4.6474 to       4.97804
     statcode = fitt;  statpar = 1648
  -- At sub-brick #131 'Positive_SM_GLT#1_Coef' datum type is float:     -20.0609 to       13.8209
  -- At sub-brick #132 'Positive_SM_GLT#1_Tstat' datum type is float:     -11.5391 to       9.04824
     statcode = fitt;  statpar = 1648
  -- At sub-brick #133 'Positive_SM_GLT#2_Coef' datum type is float:     -18.2493 to        39.772
  -- At sub-brick #134 'Positive_SM_GLT#2_Tstat' datum type is float:     -5.01106 to       4.82161
     statcode = fitt;  statpar = 1648
  -- At sub-brick #135 'Positive_SM_GLT_Fstat' datum type is float:            0 to       52.3296
     statcode = fift;  statpar = 3 1648
  -- At sub-brick #136 'Spatial_GLT#0_Coef' datum type is float:     -29.6044 to        20.976
  -- At sub-brick #137 'Spatial_GLT#0_Tstat' datum type is float:     -4.69783 to       6.55785
     statcode = fitt;  statpar = 1648
  -- At sub-brick #138 'Spatial_GLT#1_Coef' datum type is float:     -20.3043 to       23.3449
  -- At sub-brick #139 'Spatial_GLT#1_Tstat' datum type is float:     -8.70796 to       5.90311
     statcode = fitt;  statpar = 1648
  -- At sub-brick #140 'Spatial_GLT#2_Coef' datum type is float:     -7.86648 to       14.8651
  -- At sub-brick #141 'Spatial_GLT#2_Tstat' datum type is float:       -5.388 to       5.62748
     statcode = fitt;  statpar = 1648
  -- At sub-brick #142 'Spatial_GLT_Fstat' datum type is float:            0 to       63.0401
     statcode = fift;  statpar = 3 1648
  -- At sub-brick #143 'Verbal_GLT#0_Coef' datum type is float:     -31.8397 to       22.2809
  -- At sub-brick #144 'Verbal_GLT#0_Tstat' datum type is float:     -4.91587 to       5.84735
     statcode = fitt;  statpar = 1648
  -- At sub-brick #145 'Verbal_GLT#1_Coef' datum type is float:      -18.485 to       22.0382
  -- At sub-brick #146 'Verbal_GLT#1_Tstat' datum type is float:     -9.67806 to       5.67452
     statcode = fitt;  statpar = 1648
  -- At sub-brick #147 'Verbal_GLT#2_Coef' datum type is float:     -12.2403 to       13.4385
  -- At sub-brick #148 'Verbal_GLT#2_Tstat' datum type is float:     -5.15695 to       4.98863
     statcode = fitt;  statpar = 1648
  -- At sub-brick #149 'Verbal_GLT_Fstat' datum type is float:            0 to       82.2836
     statcode = fift;  statpar = 3 1648

The married regressors used in stim_times_AM1 regressors all contain only one married component, the delay.

Does anyone have any idea why what appears to me to be a straightforward 3dD woudl results in multiple GLTs for the same GLT spec?

Hi Colm,

How are you running that script, via tcsh or bash. I think they will be different. bash might pass the '' characters to 3dDeconvolve, which will treat them as line separators for the GLT, meaning they would have different rows. For example, consider:

-gltsym ‘SYM: 0.25SpatialBranch +0.25SpatialDelay +0.25VerbalBranch
+.25
VerbalDelay -.25SpatialControl -.25SpatialSwitch -.25VerbalControl
-.25
VerbalSwitch’

If 3dDeconvolve sees those '' characters, this GLT would have 3 lines, each with its own Coef and Tstat, plus a final overall F for the 3 lines at once.

For example GLT#2_Coef would just be -.25*VerbalSwitch. You could easily verify that with 3dcalc.

Also, the text output from 3dDeconvolve should show the per-row glt’s that come from the gltsym’s. Those probably show multi-row tests.

Does that seem to be the case? And are you running this via bash?

  • rick

I’m running it with bash.

I just eliminated the backslashes from the GLT specifications and reran it. Now I only get one coef and tstat per GLT as expected.

I never knew that a GLT could have more than one line in the contrast matrix so never suspected that the backslashes would be the culprit.

Thanks for you help, Rick. Much appreciated.

Great! Yes, either \ or | can be used as a line delimiter to make a multi-row GLT in 3dDeconvolve.
A proc script written by afni_proc.py will have the '' characters, but that is appropriate for tcsh.

  • rick