RSFC if denoising included compcors and cosine regressors

Hi @ptaylor,

I used 3dTProject to denoise my data:

3dTproject -input orig_data.nii.gz -prefix cleaned_data.nii.gz -ort nuisance.1D -polort 2 -demean

Now, I'd like to compute RSFC parameters (particularly ALFF). Should I include the option -norm in my 3dRSFC call as I think you're suggesting here?

Also, when I ran 3dTproject, I regressed out compcors and related cosine regressors (from fmriprep). My understanding is that this is equivalent to doing high-pass filtering. In that case, I cannot use the residuals from 3dTProject in my 3dRSFC call because 3dRSFC requires non-filtered data, is that right?



On a minor start, I don't see -demean as an option for 3dTproject---and that aspect should be covered under -polort 2, even if it were.

It will be a bit different to use -norm in 3dRSFC vs the scale block in latter would be more appropriate for interpreting across runs, esp. if either the run lengths differ or their is censoring applied during processing (which means that the final degrees of freedom will differ, and the -norm option would not be so good for cross-run comparison of RSFC). Note you should be able to take your fMRIPrep output and put it into for final processing, like with the scale and regress blocks. You won't get all the full QC HTML info, but then you could scale the data helpfully, I think.

CompCor strikes me as different from highpass filtering, if we consider highpass filtering meaning to keep frequencies greater than, say 0.001 or 0.01 Hz (by adding regressors below the chosen frequency cutoff to the regression model). That kind of highpass filtering is akin to the -polort 2 or thereabouts (see the help for details on choosing an appropriate polort value, based on total run duration time): in each case, the purpose is to account for mean, linear and slow baseline drifts. CompCor is closer to ANATICOR, in that one makes regressors derived from non-GM tissue classes (e.g., with averaging or PCA) and adds those to the models. I am not sure what the cosine regressors form fMRIprep are---it is possible that those could be the highpass filtering part, depending on how they are constructed, but the details matter.

3dRSFC requires non-censored data. Most classical RSFC measures require using the Fourier Transform (FT) to calculate, and the FT assumes uniform sampling rates. FMRI data is acquired at constant TR (yay!) but censoring time points effectively creates "gaps" in the sampling (boo!). But there is a generalization of the FT, called the Lomb-Scargle transformation, which allows for frequency spectrum estimates of a time series in the case of non-regular gaps (yay!). And the programs 3dLombScargle and 3dAmpToRSFC are AFNI/FATCAT programs that can be used to estimate your RSFC in the present of censoring (yay!).


Thanks Paul!

I don't censor my data so your last point doesn't apply in my situation.

According to the fmriprep documentation:

fMRIPrep does high-pass filtering before running anatomical or temporal CompCor. Therefore, when using CompCor regressors, the corresponding cosine_XX regressors should also be included in the design matrix.

So, if I want to use the compcor regressors from fmriprep I'll need to include the cosine regressors as well. And based on this reply including them in the denoising is akin to high-pass filtering

It seems that the cosine regressors will be the same for datasets that have the same TR and number of volumes, as implemented here.

I used 3dTproject to denoise using the compcor + cosine regressors in my -ort file, which will be kind of doing high-pass filtering. The question is, will it be a problem for RSFC if I use the residuals from 3dTproject? Because you mentioned in a previous thread that I shouldn't do any sort of bandpass filtering if I intend to use RSFC.


My understanding is that fMRIPrep doesn't actually apply filtering to the data, but it provides regressors that can be assembled in different ways---is that correct? That would be preferable to applying regressors in piecemeal fashion, certainly, which has non-good mathematical properties.

From the description in the function you sent for estimating cosine regressors---"Create a cosine drift matrix with periods greater or equals to period_cut"---that does sound like it is just low frequency things. Basically, for each frequency you want to bandpass, you can include 2 regressors (a sin and cos pair, or cos-only regressors, which is valid by the glorious mathematics of Fourier Transforms). The sinusoid regressors should just depend on sampling rate and total number of points (the TR and number of volumes N, respectively), again as bit of Fourier Transform mathematics; delta_f in the transformed freq domain is 1/N*TR, and the fundamental harmonic F is 1/TR. (with the Nyquist frequency being half of that). So, that does all seem consistent.

Re. bandpassing and 3dRSFC: you should not do the higher-frequency part of bandpassing before doing RSFC; getting rid of the very low frequencies---those that are essentially baseline and sloooow drift---should be OK. A classical LFF bandpass range is 0.01 - 0.1 Hz, so here "very low" means frequencies <0.01 Hz, and the "higher-freq part" is frequencies >0.1 Hz. Pretty much all FMRI processing accounts for baseline (mean+slow drift), so that is to be expected, anyways.


Hi Paul,

Thank you again for your helpful reply!

Rick says here that high-pass filtering isn't an issue, it's more low-pass filtering that eats up most DOF.

But for the purposes of RSFC, is doing only high-pass filtering ok, or do you still advise against it? You mentioned that I cannot bandpass my time series, but I'm not sure if you meant doing both low- and high-pass filtering.

In the case of fmriprep, high-pass filtering is performed by including cosine regressors generated with discrete cosine basis, with a cutoff 128s during the denoising step. So, if I denoised using this high-pass filter, would it be ok to run 3dRSFC on the high-pass filtered data?


I (certainly!) agree with Rick. The application of a highpass band often means keeping frequencies above >0.001 or 0.01 Hz. (The "128 s cutoff" translates to a 1/128 = 0.008 Hz, which is essentially 0.01, and I think might specifically come from what SPM does?) Anyways, for a TR = 2s dataset, say, the Nyquist frequency is 0.5/2 = 0.25 Hz. So, we are talking about removing only a tiny fraction of DFs (which would be estimates as 0.001/0.25 =0.4% or 0.01/0.25=4% of them, say).

In contrast, low pass filtering would remove everything in the interval 0.1 Hz to 0.25 Hz, meaning that 0.15/0.25 = 60% of the DFs are removed (!) there.

For RSFC, doing only highpass should be fine. In most typical FMRI processing, something is done to regress out the baseline and slow drift features---these are all components that primarily live in the <0.001 or <0.01 Hz range. So, whether through explicit bandpassing or using low-order polynomials, many of those frequencies are purged, anyways. I was warning against doing LFF bandpassing (keeping only 0.01-0.1 Hz, for example) during processing.

I believe one can equivalently bandpass using sine+cosine pairs of frequencies, or only cosine, so I don't think that matters.

Running 3dRSFC on highpass-only filtered data should be fine.