3dTSmooth: What exactly it does

Hello AFNI gurus, happy new year;

I’m trying to replicate an AFNI routine in MATLAB. We first do a periodogram of an fMRI time series, then smooth it with the following command:

3dTsmooth -hamming 7 periodogrammed_fMRI

I tried to read the documentation of 3dTsmooth and it was a bit unclear to me. Does it applies a hamming window of 7 time points as windows to data. For example, if the fMRI time series is 150 time points, does it apply the filter to first 7 time points (0-6), then the second 7 (1-7) then the third etc. until reaches the end? I tried to read the source code too only to realize I don’t know C. So, any help is greatly appreciated.

Best and to many years with AFNI,

The main confusing part in C about 3dTsmooth is that the pointer to the weighting function is used instead of calling the function directly. In my reading of the code, it does not jump from one set to the next, as you had guessed. The hamming function, like the other functions, provides a moving weighted average of some sort as it moves through time a single time point at a time. Each iteration through time, it uses the specified kernel size to weigh the time points before, during and after, in order to replace that time point. The hamming function (hamming_window()) uses a cosine function for its smoothing operation while the default 3 point linear filter is a bit easier to understand in the help.

Thanks so much!