Can you use AFNI's 3dFWHMx with SPM's residual data?

The following was a conversation on the message boards of my old blog, and I thought it might be interesting to those of you using AFNI tools on SPM data. As I mention below, I'm not sure whether the following approach works, but it seemed reasonable. If anyone else has any thoughts, I'd like to hear them in the comments section below!

Hi Andy, 
I've done all my analyses in SPM8, but I'd like to use 3dClustSim for cluster level correction. I'm wondering if instead of using AFNI's 3dFWHM to get estimates of the smoothness, can I use the effective smoothness values listed at the bottom of the results file from my SPM.mat?

The SPM smoothness estimates Val is referring to

The SPM smoothness estimates Val is referring to

Or are those the "traditional" smoothness values you mention and I've missed the point of doing the -acf? If you recommend using 3dFWHM function, can you tell me what these inputs refer to if I have files generated via SPM? 3dFWHMx -mask mask+tlrc.HEAD -acf tmp.txt errts+tlrc.HEAD

Thank you so much for your helpful blog and videos!


Hi Val,

Yes, you should be able to use 3dFWHMx on the residuals of the SPM data. I wouldn't use the estimated FWHMx values you see at the bottom of the SPM results window, as they probably underestimate the true smoothness of the data.

If you want to use AFNI's 3dFWHMx, here's what the options refer to (and what they correspond to in the SPM dataset, surrounded by brackets):

-mask [mask.nii]: Refers to a mask covering the whole brain and excluding non-brain material (e.g., air)

-acf tmp.txt: Computes the autocorrelation function that fits an updated model of the smoothness (you can actually omit the tmp.txt part, I'm not sure what the output in the tmp.txt file means)

errts+tlrc.HEAD [ResMS.nii]: Refers to the residual time series (although in SPM, this is a single volume, not a time series; and it is the mean square of the residuals, not the residuals themselves)

Note that there's another option in 3dFWHMx called 2difMAD, which is used for single-volume residual datasets (such as PET images). It might be applicable in this case since the ResMS.nii image is a single volume, but in my experience the difference is negligible between including the 2difMAD option and omitting it, at least for fMRI data.

Here's what I would recommend:

1. Calculate the square root of the ResMS.nii image to "undo" the mean square scaling of the residuals: 3dcalc -a ResMS.nii -expr 'sqrt(a)' -prefix MS.nii

2. Use this MS.nii dataset to estimate your FWHMx: 3dFWHMx -acf -mask mask.nii MS.nii

3. Use the second row of the ACF output with 3dClustSim to estimate your updated clusters.

Again, I'm not 100% sure about this entire procedure - for example, taking the square root of the ResMS.nii dataset. But in my simulations it provided smoothness estimates that were comparable to what I had seen when analyzing AFNI data with similar smoothing kernels.

Good luck!