afni_proc using blocks as regressors

Hello,

I am figure out how to re-preprocess my data in order to extract out stats and nifti files for each block, instead of each run or each condition within a run. For example, in my initial preprocess, my generating script (below) resulting in stats files that I could 3dBucket into to extract nifti files that were an average beta weight for entire condition (unlabeled in the below):

afni_proc.py 								\
	-subj_id $subject.$label.noblur					\
	-dsets $subject/unlabeled1+orig					\
	           $subject/unlabeled2+orig					\
	-blocks tshift align tlrc volreg mask scale regress		\
	-copy_anat $subject/mprage+orig					\
	-align_opts_aea -giant_move					\
	-tlrc_base MNI152_T1_2009c+tlrc					\
	-volreg_align_e2a						\
	-volreg_tlrc_warp						\
	-regress_censor_motion 1.0					\
	-regress_censor_outliers 0.1					\
	-regress_stim_times ONSETS/unlabeled.txt			\
	-regress_basis_multi 'BLOCK(18,1)'				\
	-regress_est_blur_epits						\
	-regress_est_blur_errts

I am trying to be able to extract a nifti file each block, instead. There are 4 blocks in each run and 8 blocks total. Here is the generating script I am working with:

afni_proc.py 								\
	-subj_id $subject.$label.noblur					\
	-dsets $subject/unlabeled1+orig					\
	       $subject/unlabeled2+orig					\
	-blocks tshift align tlrc volreg mask scale regress		\
	-copy_anat $subject/mprage+orig					\
	-align_opts_aea -giant_move					\
	-tlrc_base MNI152_T1_2009c+tlrc					\
	-volreg_align_e2a						\
	-volreg_tlrc_warp						\
	-regress_censor_motion 1.0					\
	-regress_censor_outliers 0.1					\
	-regress_stim_times ONSETS/unlabeled1.txt			\
	-regress_stim_times ONSETS/unlabeled2.txt			\
	-regress_stim_times ONSETS/unlabeled3.txt			\
	-regress_stim_times ONSETS/unlabeled4.txt			\
	-regress_stim_times ONSETS/unlabeled5.txt			\
	-regress_stim_times ONSETS/unlabeled6.txt			\
	-regress_stim_times ONSETS/unlabeled7.txt			\
	-regress_stim_times ONSETS/unlabeled8.txt			\
	-regress_run_clustsim
	-regress_basis_multi 'BLOCK(18,1)'				\
	-regress_est_blur_epits						\
	-regress_est_blur_errts

The main difference is that I am feeding it 8 onset files, each with 7 * and 1 number, corresponding to the onset of that specific block.

I am not getting an error, but I am not confident I didn’t miss something.

Any advice on how to meet this goal would be very much appreciated!

Hi Daisy,

If you want one beta weight per event, that is IM
(individual modulation). You should be able to just
add “-regress_stim_types IM” to the initial command.

  • rick

Thank you! I will look into that now. But I still need to recreate all the onset files and include those in the generating script, right?
So it would look like:

set label = ulab_block

foreach subject (A000442 A000443 A000452 A000453 A000454 A000455 A000479 A000484 A000485 A000487 A000488 A000493 A000498 A000500 A000522 A000526 A000580 A000581 A000582 A000583 A000584 A000585 A000587 A000589 A000598 A000599 A000600 A000601 A000602 A000605 A000606 A000613 A000619 A000651 A000661 A000665 A000683 A000686 A000688 A000691 A000698)

afni_proc.py 								\
	-subj_id $subject.$label.noblur					\
	-dsets $subject/unlabeled1+orig					\
	       $subject/unlabeled2+orig					\
	-blocks tshift align tlrc volreg mask scale regress		\
	-copy_anat $subject/mprage+orig					\
	-align_opts_aea -giant_move					\
	-tlrc_base MNI152_T1_2009c+tlrc					\
	-volreg_align_e2a						\
	-volreg_tlrc_warp						\
	-regress_censor_motion 1.0					\
	-regress_censor_outliers 0.1					\
	-regress_stim_times IM ONSETS/unlabeled1.txt			\
			    IM ONSETS/unlabeled2.txt			\
			    IM ONSETS/unlabeled3.txt			\
	                    IM ONSETS/unlabeled4.txt			\
		 	    IM ONSETS/unlabeled5.txt			\
			    IM ONSETS/unlabeled6.txt			\
		            IM ONSETS/unlabeled7.txt			\
			    IM ONSETS/unlabeled8.txt			\
	-regress_stim_labels unlabeled1 unlabeled2 unlabeled3 unlabeled4 unlabeled5 unlabeled6 unlabeled7 			unlabeled8 empathy1						\
	-regress_run_clustsim yes					\
	-regress_basis_multi 'BLOCK(18,1)'				\
	-regress_est_blur_epits						\
	-regress_est_blur_errts

tcsh -xef proc.$subject.$label.noblur |& tee output.proc.$subject.$label.noblur

end

No, you should not need to create any new onset file. Use
the original onset file across all runs. The point of IM is to
output one beta per event.

Just add that IM option to the original afni_proc.py command.

  • rick

Okay, thanks. I just want to clarify though, that is a block design, not event-related. So I am confused how this would output a beta weight for each condition without knowing the timing of each block for each run? The existing onsets files only have onsets for condition, not block. So I was assuming I would need to revise the onsets to be like:
example onset 1:
18 #run 1 block 1

  • #run 2

example onset2:
56 #run1, block 2

  • #run2

example onset3:

  • #run1
    18 #run2, block 1

example onset4:

  • #run1
    56 #run2, block 2

For this example, there would be 4 blocks and I would be hoping to extract 4 stats (for each).

Oops. nevermind. Just understood this all. Thanks for pointing me toward IM.

Hey Rick,

Script with this command:
-regress_stim_types IM ONSETS/unlabeled.txt
It is thinking IM is a text file and outputting:
** A1D: failed to read data file IM
** failed to load stimulus timing file ‘IM’

Hi Daisy,

That -regress_stim_types option should only list the
stimulus types, like ‘times’ or ‘IM’. The timing files
(like ONSETS/unlabeled.txt) should still be listed via
-regress_stim_times.

  • rick