Nilearn.signal.clean and fmriprep cosine terms

Hi, I’m trying to use nilearn.interfaces.fmriprep.load_confounds and have a question about the cosine drift terms generated by fmriprep when calculating compcor.

When I use nilearn.signal.clean, it forces me to use a high_pass if I specify cosine as my filter, but my confounds already have cosine drift terms from the calculation of acompcor. Should I just specify the same high pass (1/128) in nilearn.signal.clean and remove the cosine drift terms from the loaded confounds? Or will these cosine drift terms be different from the ones calculated during fmriprep?

A related question, if I use the butterworth filter in nilearn.signal.clean, is it conceptually valid to use acompcor terms output by fmriprep since those acompcor terms were calculated using DCT?

Forgive me if these are obvious answers!

Hi @rhombencephalon and welcome to neurostars!

Do not specify cosine in this Nilearn step. Disable the filter of signal.clean and just include the cosine components from fmriprep.

I don’t think it will be a big deal if you just introduce a low pass filter (that is, do not re-highpass filter the data).


I should have mentioned, but I want to implement a band pass filter. So, when I select ‘cosine’ filter, it forces me to include a low_pass and a high_pass filter. This leads me to my previous questions!

Hi @rhombencephalon,

In that case, specify high_pass=None

Thanks so much for taking the time to reply, but specifying ‘None’ doesn’t work, I get an error that tells me that I need to specify a high_pass filter.

ValueError: Repetition time (t_r) and low cutoff frequency (high_pass) must be specified for cosine filtering.t_r=‘0.8’, high_pass=‘None’

Hi @rhombencephalon,

Probably because you specified cosine filtering and not butterworth.

Thanks so much for your quick replies, I’m concerned about using the butterworth filter together with the fmriprep cosine drift terms. From my understanding, using the butterworth filter in nilearn.signal.clean would lead to orthogonality between the low_pass filtered signal and the confounds which include the fmriprep cosine drift terms. Do you know if that is… conceptually kosher for the two filters to be orthogonal to each other? Such a recommendation was not listed in the cited Lindquist 2019 paper as far as I can tell.

Hi @rhombencephalon,

First, let me point out that Nilearn cosine filtering only does high-pass filtering, similar to fRMIPrep, as evidenced by the source code ( Indeed, modular processing is not ideal, as the paper points out. You should evaluate why you want to low-pass filter, as it is not a ubiquitously standard step and has controversies associated it with it (Neuroimaging Data Processing/Processing/Steps/Temporal Filtering - Wikibooks, open books for an open world):

While high-pass filtering is used in most studies, low-pass filtering is controversial. It has been shown to decrease detection sensitivity w/o really increasing specificity [4][5] Imposing a high level of autocorrelation on the signal it violates the temporal independency assumptions which are used for statistical testing. In rsfMRI it has been argued that band-pass filtering introduces spurious correlations, which should be accounted for by correcting for temporal filtering [6].


1 Like