afniproc for amplitude modulation

Hi AFNI-sages. It was a while ago I ran amplitude modulation analysis in AFNI. I have a few questions to make sure I’m doing it right. Thanks in advance!

First assumation: This is the exampel to look at in the afni proc documentation:
NARPS. Applied NARPS example from AFNI. ~2~

          (recommended?  yes, reasonable for a complete analysis)

       An amplitude modulation task analysis.


  1. First thing I notice is that this pre-proc, in contrast to the non-AM task analysis, has anaticor (and thus freesurfer parcels) as recommended settings:

-anat_follower_ROI FS_wm_e epi SUMA/mask.aseg.wm.e1.nii.gz \
                 -anat_follower_ROI FS_REN_epi epi                          \
                     SUMA/aparc+aseg_REN_all.nii.gz                         \
                 -anat_follower_ROI FS_REN_anat anat                        \
                     SUMA/aparc+aseg_REN_all.nii.gz                         \
                 -anat_follower_erode FS_wm_e                               \
               -regress_anaticor_fast                                     \
                 -regress_anaticor_fwhm 20 
                  -regress_anaticor_label FS_wm_e                            \
                  -regress_make_corr_vols FS_wm_e                            \

Why is this? Is anaticor extra important for AM analysis?

  1. In the example there are two regressors, “Resp” and “NoResp”. I assume Resp has an amplitude modulator and NoResp does not.
    That is why Resp has the AM2 stim type and NoResp has the AM1 stim type.

-regress_stim_times timing/times.Resp.txt                  \
                     timing/times.NoResp.txt                                \
                 -regress_stim_labels Resp NoResp                           \
                 -regress_stim_types AM2 AM1                                \
                 -regress_basis_multi dmBLOCK                               \

With the regress basis “dmBlock” I assume the stim files should look something like this?

Resp: (dmBlock + AM2)
10.704311*-1.088090:0.0001 14.650165*-0.189424:0.0001 18.894507*0.520777:0.0001
(first onset at 10.7 seconds, with modulator -1.088.. with duration 0.0001

NoResp:  (dmBlock + AM1)
(first onset 6.59 with duration 0.0001, no modulation)

And if e.g. NoResp would be empty for a subject, then we can do something like:


  1. The contrast (gltsym) has this syntax:

                 -regress_opts_3dD -jobs 8 -gltsym 'SYM: Resp[1] -Resp[2]'  \
                     -glt_label 1 gain-loss -GOFORIT 10 

What is the meaning of Resp[1] -Resp[2]?
Does this mean Resp-no-modulation MINUS resp-with-modulation? The name of it is gain-loss.

We have only one AM2 regressor (feedback) which is modulated with a value related to their decsion making (the other regressor are missed responsen, that is why we use AM1 and no modulator). When running the pre-proc we end up with 2 feedbacks in the stats-file, I assumed the feedback#0_coef is the unmodulated feedback regressor coef and feedback#1_coef is the modulated feedback regressor coef.
Does -gltsym ‘SYM: Resp[1] -Resp[2]’ mean the contrast of those two? And what is the meaning of that versus just using feedback#1_coef in the subsequent ttests?

My code looks like this:

-regress_stim_types AM2 AM1 \
    -regress_stim_labels feedback miss \
    -regress_basis 'dmBLOCK' \

Should I add

-regress_opts_3dD -jobs 8 -gltsym 'SYM: feedback [1] -feedback [2]'  \
                     -glt_label 1 feed-feedAM

4 and final)
This is an event design. The stimuli is shorter than 1s.
Can I do what I did above and just use a super short dmBlock duration? Example from my AM2 regressor:
Using 0.0001s duration.


After running freesurfer + @SUMA_Make_Spec_FS:

@SUMA_Make_Spec_FS -sid $subject -NIFTI & PIDT2=$!

I do get all files asked for in the script apart from one. This is the documentation code:

-anat_follower_ROI FS_wm_e epi SUMA/mask.aseg.wm.e1.nii.gz \
                 -anat_follower_ROI FS_REN_epi epi                          \
                     SUMA/aparc+aseg_REN_all.nii.gz                         \
                 -anat_follower_ROI FS_REN_anat anat                        \
                     SUMA/aparc+aseg_REN_all.nii.gz                         \

I got these two in my SUMA dir:

-anat_follower_ROI FS_REN_epi epi SUMA/aparc+aseg_REN_all.nii.gz  \
-anat_follower_ROI FS_REN_anat anat    SUMA/aparc+aseg_REN_all.nii.gz   \

But I can’t find this file:

-anat_follower_ROI FS_wm_e epi SUMA/mask.aseg.wm.e1.nii.gz \

I did find this from an old global-process-pipeline link:

3dmask_tool -input aparc+aseg_REN_wmat.nii.gz \
               -dilate_input -1 -prefix mask.aseg.wm.e1.nii.gz

I ran that in my SUMA dir and got an eroded wm-mask. Is that correct?

Thanks again.

Hi Robin,

  1. Anaticor does not have anything in particular to do with AM analysis. It is just one method to try to remove some scanner, respiration or other artifacts. It was not a necessary part of the NARPS analysis.

  2. Resp actually has 2 amplitude modulators, while NoResp has none. However, we were still getting event durations from the timing files for the NoResp class, even though the durations were constant. So there was no actual duration modulation for NoResp. But it was coded with AM1 and dmBLOCK just to fit the style of the model and to get consistency in the meanings of the betas (e.g. BLOCK(4,1) would have yielded the same stats (ind and group) on NoResp, but would have altered the scaling of those betas).

Yes, the events look like that. With 2 amplitude modulators plus a duration, the first event for one subject was 4.071146:2.388 (so 14 and 6 were modulators, and the duration (until button press) was 2.388s).

The NoResp events all had duration 4.

For any runs without a NoResp response, we used -1:1, but -10:0.0001 is great.

  1. Resp[1] and Resp[2] refer to the betas of the 2 modulators. Resp[0] refers to the beta of the mean response. So Resp[1] -Resp[2] is the difference of modulation effects.

Indeed, feedback#0_coef is the unmodulated feedback beta and #1 is the modulated one. A contrast between the two would be encoded ‘SYM: feedback[0] -feedback[1]’. HOWEVER, that would suggest you have taken great care to make sure the magnitudes of the modulation parameters give it a sort of unit height. Otherwise the contrast would not be appropriate.

For example, if the modulators ranged between 0 and 100 (which would be demeaned in 3dDeconvolve), the betas might be 1/100th of the typical magnitude of the #0 coefs. I see a value near -1 for your modulator, which is encouraging.

  1. You say the stimuli are short, but are they consistent? Do they range from 0.1 to 0.8, or are they all near 0.6, for example? If they are consistent, there is no need to use dmBLOCK, you could use BLOCK(0.6,1), say, and still use AM2 (but not AM1).

For the FS output, the mask.aseg.wm.e1.nii.gz dataset was eroded by 1 voxel outside of, as you show in the global process link. So yes, you could do that if you chose. Though again, ANATICOR is not so necessary.

  • rick

Thanks Rick! That answered all my questions at once!!

I am trying to replicate the AM results a collegue did in SPM since the other fMRI-tasks has been analyzed in AFNI we want to keep it concistent in the paper.

I am no SPM person and I assume you guys don’t know it super well either(?). So regarding the durations: I was told it was an event design, and you just tell SPM that. I am trying to figure out what that means in terms of duration. I found this which has this segment:

What happens if I set the duration to zero in AFNI? What would be the corresponding way of doing it? Or I can prope my collegue for more information regarding the actual durations. She used the SPM event design option (this is why I like AFNI).

If I do change from the dmBLOCK way of making stim-files and use e.g. BLOCK(0.6,1), will that make a difference? Given I would use the same duration in the stimfile :0.6 as in BLOCK(0.6,1)? If there is no difference it would not be worth chaning the files =)

Hi Robin,

That is right, we are not experts in SPM… :slight_smile:

Indeed, the duration parameters are not allowed to be zero. Maybe just as a precaution, I’m not sure.

There is no difference between dmBLOCK with a 0.6 s event and BLOCK(0.6). There is a slight difference with BLOCK(0.6,1) in that is scales to unit height. Without that, a duration under 1s will tend to scale to a maximum of around that duration. So with a small duration, the “,1” is usually preferable.

But anyway, a small scalar effect will not alter any statistics, even at the group level. It should just scale all such betas uniformly.

I would expect any of GAM, SPMG1, BLOCK(0.6,1) or BLOCK(0.1,1) would be reasonable.

If you want to match very closely, SPMG1 might the basis function applied in SPM. There might also be differences in modeling drift. If you want to tell to use sinusoids, that is an option, too.

  • rick