With the preprocessed bold data from fMRIPrep I would like to perform denoising using the generated confounds tsv file. I decided to remove the 6 motion parameters, cosines, and some aCompCor components but wanted to validate that the order of operations is correct. As an example, I will use the nilearn.image.clean_img function.
data = clean_img(data, detrend=False, standardize=False, confounds=[motion])
data = clean_img(data, detrend=False, standardize=False, confounds=[cosines])
data = clean_img(data, detrend=False, standardize=False, confounds=[acompcor])
The idea is to first remove the motion parameters since they were estimated without any prior high-pass filtering. As a next step, I apply the high-pass filtering via the cosines as this is required to filter out the aCompCor components. Finally, the aCompCor confounds can be regressed out of the data.
Now my question is whether these steps are correct and have to be taken separately or whether I can simply include all confounds at once. Also, I am wondering if I can now detrend my data after the 3 steps, since detrending is typically done before any confounds are removed. If I understood it right, fMRIPrep does not detrend the data before estimating the aCompCor confounds though.
The cosines should take care of removing the low frequency noise removing the need for any additional detrending, see this section of fmriprep for details (specifically look for the Discrete cosine-basis regressors heading).
If anything wasn’t clear or if I mis-stated something, please ask/add a response.
Thanks a lot for the fast reply, that clarified a lot!
The only thing I’m still wondering about is whether including the motion parameters (which were based on non-detrended data) and aCompCor parameters (which were based on detrended data) might introduce a trend again into the denoised functional data when all confounds are used at the same time. Do you think this might be an issue?
Provided you have the low-frequency cosines basis in your confound models, then it doesn’t matter that motion parameters were not detrended. The residuals after regression will be orthogonal to the cosines, i.e. detrended.
Just to follow up on the standardization question - is it recommended to standardize the signal after fmriprep? I don’t think fmriprep does this, from what I can tell, correct?