High-pass filtering using xcp_d

Dear Experts,

I am using the xcp_d singularity to denoise fMRI data. I would like to do only high-pass filtering, instead of bandpass filtering.

My call to xcp_d is as follows:

 singularity run --cleanenv \
	-B [myhome]:/home/xcp_d \
	-B [myhome]/FSlicense.txt:/opt/freesurfer/license.txt \
	[myhome]/containers/xcp_d-0.3.0.simg \
	-v [fmriprepoutputfolder] \
	-v [outputfolder]
	-w [workingdir] \
	-participant --participant_label sub-${subid} -p 27P \
	--lower-bpf 0.008 --bpf-order 2 --nthreads 8

However, I noticed that if I use it like this, the default bandpass kick in with a --upper-bpf=0.08

So my question is, how can I not perform this bandpass but perform a highpass instead? Should I just put a very high value in --upper-bpf or is there a more elegant way?

Thank you very much,

Leonardo Tozzi

Hi @Leonardo_Tozzi,

Going to tag @tsalo to confirm what I am saying.

  1. The option to disable bandpass filtering was added in 0.3.1. I would suggest updating to the latest build (0.3.2) before running.
  2. If you disable the bandpass filter, you can pass in the cosine regressors from fMRIPrep which act as a high pass filter at (1/128) Hz. This is required if you are using aCompCor components, since they are calculated after high-pass filtering of the data.
  3. You can see in the code here the XCP_D will add the cosine regressors if you choose an aCompCor strategy (by virtue of high_pass in Nilearns load_confounds module). So, you would not have to pass cosine regressors in as a custom confound.

Does this make sense?

Best,
Steven

Thank you very much for your response!

How would I pass the cosine confounds to the call to xcp_d?

Thank you!

You can either just use an acompcor denoising strategy or see the documentation for custom confounds here Running XCP-D — xcp_d 0.3.2+20.g4db3a25 documentation

Dear Experts,

I have tried the aCompCor denoising strategy as you suggested. However, I have a follow-up question. In the report that is produced by xcp_d, I see this methods text:

First, outlier detection was performed. In order to identify high-motion outlier volumes, framewise displacement was calculated using the formula from @power_fd_dvars, with a head radius of 50 mm. Volumes with framewise displacement greater than 0.2 mm were flagged as outliers and excluded from nuisance regression [@power_fd_dvars].

Next, the BOLD data and confounds were mean-centered and linearly detrended.
The top 5 aCompCor principal components from the WM and CSF compartments were selected as nuisance regressors [@behzadi2007component], along with the six motion parameters and their temporal derivatives, mean white matter signal, mean CSF signal, and mean global signal [@benchmarkp;@satterthwaite_2013]. These nuisance regressors were regressed from the BOLD data using linear regression, as implemented in nilearn 0.9.2 [@nilearn]. Any volumes censored earlier in the workflow were then interpolated in the residual time series produced by the regression.

The processed BOLD was smoothed using Nilearn with a gaussian kernel size of 6.0 mm
(FWHM).

I am noticing that this text does not mention filtering. Is that normal?

Hard to say without knowing your exact command, since if you disabled bandpass filtering it makes sense for it not to be in the boilerplate. Since the filtering in acompcor happens by virtue of confound regression and not a dedicated filter, it may not be in the boilerplate explicitly.

So to clarify what you are saying: the cosine regressors are added as part of the aCompCor strategy automatically, but they are not mentioned in the boilerplate? I think that this is an important step that should be mentioned in the Methods explicitly, as some users might be unaware of it. Would it help if I opened a feature request for it to be added to the report?
Thank you!

I think that would be a good idea! It would be good for boilerplates to mention the cosine confounds explicitly.

I am sorry to reopen this issue, but I have noticed something. When using the acompcor denoising strategy with GSR, the data looks filtered with only a highpass as expected. However, one thing I have observed is that when running acompcor on the same data without GSR (-p acompcor option) the data still looks bandpass filtered (i.e. very smooth). Here is a plot.

Apologies for the bad Excel plot, but it should be enough to show what I mean. These are two time series of the same brain region denoised with acompcor, one with GSR, the other without. As you can see, the version with GSR looks way more “spiky”. I wonder why that is, could it be that the GSR is reintroducing some noise in my signal? Or is it that the bandpass kicks in again somehow when the GSR is turned off…?

In both cases, the call to xcp_d included the “–disable-bandpass-filter” option.

I have also noticed that the bandpass is mentioned in the method description in the HTML file. Could it be that somehow this setup bypasses the --disable-bandpass-filter?

this might be a better question for @tsalo

I am really sorry I reran the analysis after deleting all temporary files and actually I was wrong. I think this effect was maybe caused by some previous data that was not replaced by the new one. The data comes out as expected now, so not smoothed. Sorry for the alarm, feel free to remove my previous post or mark as solved!

3 Likes

Hi Steven,

Here I want to make sure that if I want to use acompcor or acompcor_gsr strategy,
the option of --disable-bandpass-filter should be added, right?

Thank you.

Hi @elenita and welcome to neurostars!

You can, but if you want to have a low pass filter, you can keep the bandpass filter (setting the highpass filter to 0 Hz since the cosine regressors will take care of high pass filtering).

Best,
Steven

Thank you! Is it that --lower-bpf 0 to put in the cosine regressors, and at the same time --upper-bpf 0.08 to preform low pass filter? for single-band data the upper threshold can be set at 0.1Hz. Does the single-band data refer to rest state fmri?

Cosine regressors will be put in regardless of what you put here, since you are using a compcor based denoising pipeline. Setting the --lower-bpf to 0 will just make sure you aren’t high-pass filtering twice. As a reminder, cosine regressors perform high pass filtering at 0.008 Hz (or 128 seconds).

Yup!

That would depend on how you the data were acquired.

Best,
Steven

1 Like

Hi Steven,

Thank you for the clear explaination. I attempted to set --lower-bpf 0, however an error occurred like this:

Traceback:
Traceback (most recent call last):
File “/usr/local/miniconda/lib/python3.8/site-packages/nipype/interfaces/base/core.py”, line 398, in run
runtime = self._run_interface(runtime)
File “/usr/local/miniconda/lib/python3.8/site-packages/xcp_d/interfaces/nilearn.py”, line 337, in _run_interface
) = denoise_with_nilearn(
File “/usr/local/miniconda/lib/python3.8/site-packages/xcp_d/utils/utils.py”, line 498, in denoise_with_nilearn
interpolated_filtered_bold = butter_bandpass(
File “/usr/local/miniconda/lib/python3.8/site-packages/xcp_d/utils/utils.py”, line 312, in butter_bandpass
b, a = butter(
File “/usr/local/miniconda/lib/python3.8/site-packages/scipy/signal/_filter_design.py”, line 3053, in butter
return iirfilter(N, Wn, btype=btype, analog=analog,
File “/usr/local/miniconda/lib/python3.8/site-packages/scipy/signal/_filter_design.py”, line 2465, in iirfilter
raise ValueError(“filter critical frequencies must be greater than 0”)
ValueError: filter critical frequencies must be greater than 0

You can try putting a very low value for the HPF (e.g. 0.000001).

1 Like