Censoring Volumes: change stim_times.1D?

AFNI version info (afni -ver):
Version AFNI_20.2.16 'Aulus Vitellius'

Hello!

I am analyzing ER-task fMRI data in two ways. First, I did a standard univariate analysis with a contrast between two experimental conditions. Now, I am trying to do a multivariate analysis.

Question 1: I have stim times for each participant in two files (based on experimental condition), sub-xxx-congruent.1d and sub-xxx-incongruent.1d. For the multivariate analysis, do I need to make new 1d files that contain all the stim times per run? (I have previously tried it as shown below, but not sure if this is correct).

Question 2: I would like to censor spike volumes that I have identified based on framewise displacement. In the AFNI documentation for 3dDeconvolve, I saw that this can be done by adding a clist file with the -CENSORTR clist option. My question is whether I need to adjust the stim times files? Since volumes (TRs) and stimulus presentations are not aligned, this would be difficult. Does 3dDeconvolve 'understand' to ignore stim times corresponding to censored volumes?

Question 3: In addition to using stim_times_IM, do I need to make any other changes?

Thank you,
Priya


3dDeconvolve -input *preproc_bold.nii.gz \                                     \
-mask full_mask.nii					     \
-polort A                                                             \
-num_stimts 8                                                                \
-stim_times_IM 1 sub-${subj}_congruent.1D 'BLOCK(1,1)'                        \
-stim_label 1 congruent                                              \
-stim_times_IM 2 sub-${subj}_incongruent.1D 'BLOCK(1,1)'             \
-stim_label 2 incongruent              \
-stim_file 3 trans_x.txt'[0]' -stim_base 3 -stim_label 3 trans_x   \
-stim_file 4 trans_y.txt'[0]' -stim_base 4 -stim_label 4 trans_y  \
-stim_file 5 trans_z.txt'[0]' -stim_base 5 -stim_label 5 trans_z    \
-stim_file 6 rot_x.txt'[0]' -stim_base 6 -stim_label 6 rot_x     \
-stim_file 7 rot_y.txt'[0]' -stim_base 7 -stim_label 7 rot_y     \
-stim_file 8 rot_z.txt'[0]' -stim_base 8 -stim_label 8 rot_z     \
#-gltsym 'SYM: incongruent -congruent'				     \
#-glt_label 1 incong_minus_cong					     \
-fout -tout -x1D X.xmat.1D -xjpeg X.jpg                                  \
-x1D_uncensored X.nocensor.xmat.1D                                       \
-bucket multi_stats.$subj \

Hi Priya,

To be sure of your wording, what changes are you currently making when going from univariate to multivariate analysis? Do you just mean including both conditions in the regression? I would like to understand how IM fits in to this, vs having multiple variables.

  1. Use of -stim_times_IM works with the same timing files as with -stim_times, except that 3dDeconvolve would then put each response into its own regressor, vs putting the sum of all responses into a single regressor.

So what you have looks okay, assuming the timing files are okay.

  1. Censoring censors time points (or volumes), not stimulus events. One stimulus has an ideal BOLD responses (based on BLOCK(1,1) here). A censored TR will omit that single time point from the regression matrix, regardless of the stimulus timing.

Censoring is done in afni_proc.py using -censor, passing a 1D file that is all 1's for the time series, except for being 0 at any time point to censor out. That scripts more nicely than using -CENSORTR, though of course either way is fine. The actual stimulus timing is based on having no censoring, do not adjust it.

  1. Not based on what you have said.

It might be a good idea to provide specific details, since this is new to you.

  • show the actual contents of one of the congruent.1D files
  • show precisely what you are using for censoring (if -censor, just show part of the file, if -CENSORTR, you can show it all)
  • show how you convert from motion parameters to censoring
  • state the TR, number of time points, and number of runs

We might be able to respond more concretely that way.

  • rick

Thanks, Rick. That all makes sense.

I am going to do an RSA, so I want a set of betas and associated t-statistics for each stimulus. My understanding is that using stim_times_IM will give these rather than just one for congruent and one for congruent (and one for any specified contrast, such as incongruent-congruent), and this way I don't have to manually specify a variable for each stimulus. I had previously done a multivariate analysis this way and the resulting sub-briks had e.g. t-tests for congruent1...congruentX and incongruent1...incongruentX, which was not a problem for analysis. I was just going over it again and wanted to make sure there was no problem with doing it this way rather than putting all the stimulus onset times into a single file regardless of condition. Maybe I was just over thinking.

Similarly, I know the timing for stimuli and for TRs is different, but I didn't know if interrupting the TR time series would throw off the analysis that takes the stimulus time series into account, even though the stimulus presentations and TRs are not aligned. In fact, as they are deliberately unaligned (jittered) to sample different points in the HRF. I just wanted to double check.

I did the preprocessing using fmripreprocess, so from there I used the framewise displacement. I identified any volumes with FD greater than a threshold (.5 mm) to be censored and wrote their indices to a text file. Not 100% sure about the formatting but you can see an example below :slight_smile:

Here is an example congruent.1D file for one participant:

1 15.03 27.491 36.036 78.162 86.726 103.784 116.326 133.4 141.93 150.427 171.514 180.043 188.574 197.134 205.696 214.223 226.752 239.296 247.841 260.368 272.926 281.454 290.001 302.528 311.074 319.606
2 28.056 45.129 57.674 74.782 83.31 91.872 104.416 112.944 121.474 130.005 147.11 159.637 168.182 180.726 197.819 206.363 218.889 227.415 235.948 244.457 257.001 274.111 282.623 295.148 307.692 316.238
3 70.291 78.819 87.314 116.916 125.429 137.952 146.5 159.026 175.136 196.191 208.734 221.278 229.824 238.349 250.895 263.421 271.967 280.513 288.026 296.541 305.083 313.612 321.143 329.654 338.216 346.744
4 19.145 31.621 40.138 52.694 61.209 69.735 78.264 99.354 120.422 128.971 141.514 150.077 171.149 179.677 188.223 196.735 205.283 217.824 226.352 234.915 243.444 260.502 269.03 286.087 298.614 319.654
5 17.368 34.422 42.951 51.513 60.025 72.549 81.081 93.605 102.17 110.681 123.191 144.262 156.807 177.862 186.426 207.514 216.027 224.572 233.117 250.176 271.264 279.775 292.303 300.832 309.377 317.889
6 15.758 32.799 53.871 66.398 74.961 87.505 96.029 108.592 117.105 125.653 142.741 151.304 163.83 172.361 193.448 201.961 214.52 223.048 235.609 252.666 261.212 273.738 282.285 290.844 299.377 307.919

Here is an example censorTR file for one run for one participant who happened to be more wiggly than most:

1:2
1:16..18
1:30..31
1:61
1:63
1:81
1:125..126
1:187
1:202..203
1:212..213
1:216

Let me know if these details help.

Thanks again for your help.

Should the censortr file look like this instead?

1:2 16..18 30..31 61 63 81 125..126 187 202..203 212..213 216

Yes, while not required here since the basis functions are the same, it is good to use 2 different regressor names, just to make bookkeeping easier. Otheriwse, you would have to know the order of events across the classes. And even if you do, it seems convenient to have all congruent betas together, followed by all incongruent betas.

Indeed, 3dDeconvolve sets up a full regression matrix as if there is no censoring, and then removes the censored time points. So in that setup phase, all timing is applied appropriately. The -x1D_uncensored X.nocensor.xmat.1D option will request that uncensored matrix to be output as well.

The congruent.1D file seems to have 6 runs, is that true? Just to be sure, there should not be any run index at the start of each row. You might just have that for clarity here. Otherwise, it looks good.

That first CENSORTR file looks okay, though it could be horizontal, too. If the events are spaced out, they should each have a leading RUN: , as in the first example.

  • rick

Great, thank you! Yes, there are 6 runs.