Problem with processing fMRIPrep output using Nilearn - strong global signal after motion regression

Hello everyone,

I’m new to both neuroimaging and this site. My name is Szymon, and I’m an MD currently pursuing a PhD in whole-brain modeling. I would be extremely grateful for any assistance with the following problem:

I am currently working with data from the UCLA Consortium for Neuropsychiatric Phenomics LA5c Study that has been preprocessed using fMRIPrep. I have obtained resting-state data for several healthy subjects. My objective is to parcelate signals using the Schaefer 100 atlas, regress out motion parameters (I was trying with three translational and three rotational) and to apply a filter to the signals within the 0.01-0.1 Hz frequency range. For these tasks, I am using Nilearn and have written below Python code. As a preliminary step, I have eliminated subjects whose data show translations (X, Y, Z) greater than 1.5 mm and rotations (RotX, RotY, RotZ) exceeding 1.5 degrees.

fmri_filename = f’{subject}_task-rest_bold_space-MNI152NLin2009cAsym_preproc.nii’

    atlas_filename = 'Schaefer2018_100Parcels_7Networks_order_FSLMNI152_2mm.nii'
    confounds_filename = f'{subject}_task-rest_bold_confounds.tsv'
    confounds = pd.read_csv(confounds_filename, sep='\t')
    motion_parameters = confounds[['X', 'Y', 'Z', 'RotX', 'RotY', 'RotZ']]
    masker = input_data.NiftiLabelsMasker(labels_img=atlas_filename, standardize='zscore_sample',
                                      memory='nilearn_cache', verbose=5)
    time_series = masker.fit_transform(fmri_filename, confounds=motion_parameters.values)
    filtered_time_series = signal.clean(time_series, detrend=True, standardize='zscore_sample', low_pass=0.1, high_pass=0.01, t_r=2.0)

Everything is functioning, but the output Functional Connectivity (FC) matrix exhibits a strong global signal, making it appear incorrect, as evident in the plot. While the situation seems slightly better for some participants, with correlations reaching -0.4, I believe the underlying problem persists. As this is my first fMRI analysis, I suspect I might be making a fundamental error. Based on the output, I’m considering possibilities such as incorrect motion regression (I would like to clarify that I do not intend to regress out the global signal) or using an atlas resolution that doesn’t match my data. Additionally, I have two basic follow-up questions:
a) Is it correct to assume that the columns X, Y, Z in the confounds file correspond to translations in three directions measured in millimeters?
b) Is it correct to assume that the columns rotX, rotY, rotZ in the confounds file correspond to rotations in three directions measured in radians?

I would be grateful for any advice, particularly from someone familiar with the specifics of the UCLA dataset.

Thank you in advance,

Hu @Szym.Ty and welcome to neurostars!

Not a direct answer to your question, but have you considered running XCP_D? GitHub - PennLINC/xcp_d: Post-processing of fMRIPrep, NiBabies, and HCP outputs It will automate all of those steps for you.


The fMRIPrep motion parameter confounds are currently named trans_[x|y|z] and rot_[x|y|z], but it seems like your data were processed with an earlier version. I would recommend figuring out which version was used and looking at the fMRIPrep documentation for that version specifically.

However, in any case, the translation motion parameters are indeed in millimeters and the rotations are in radians.

As XCP-D’s primary developer, I am always happy to recommend using it (thanks @Steven!). However, if you don’t want to commit to using a full BIDS App, you can try using the confound strategies (combinations of confound regressors that have been benchmarked in various papers) in Nilearn’s load_confounds_strategy.

I would also recommend sorting the Schaefer parcels by their network and including the network labels and boundary lines in your heatmap, to better see them.

Thank you all for your responses - they were truly helpful. I’ve decided against using XCP-D for now, as it appears excessive for my relatively simple setup, especially since I’m using an M1 processor. However, the software does look intriguing, and I will definitely consider it for future projects.

Regarding my issue, I consulted with a few experts, and it seems that the matrices are correct for my settings, so there was no issue after all. Also, it turns out that trans_x, trans_y, trans_z were indeed labeled as x, y, z in older versions of fMRIPrep. Thank you for clarifying my concerns about units.