Voxelwise sliding window time-average in AFNI

Hello folks,

I was wondering if there was an AFNi function that can do a sliding average over several time-steps to have a better rendering in 1dplots ?

I want to avoid big spikes in the time-series data I have.
Because my task in a block design, I would like to have a sliding average rendered.

Does anybody know of any simple way to do this ?

Thanks for any tips.

S.

1 Like

The program 3dTsmooth (very old) can take as input a 3D+time dataset and output a new dataset where each voxel time series has been smoothed in such a way.

1 Like

3dTsmooth is indeed the most straightforward way to solve this problem, and that program has options for controlling the kind of filtering that is done. If you want to do something a little differently, you can create your own temporal neighborhoods with 3dcalc. From the 3dcalc help:

   -a fred+orig -b 'a[0,0,0,1]' -c 'a[0,0,0,-1]' -expr 'median(a,b,c)'
...
 The median smoothing example can thus be abbreviated as

   -a fred+orig -b a+l -c a-l -expr 'median(a,b,c)'
1 Like

Thank you both for your help.

This is indeed exactly what I needed.

Thank you
sb

If you are just interested in looking at the plots in the AFNI GUI, you can use the "Opt->Tran 1D" menu to choose a time filter such as "Adaptive Mean".

1 Like