Preparing fMRI data for FFT

Hello everyone,

I’m currently interested in performing an FFT of my resting-state data. First, I’m using the fmriprep pipeline to get the confounds/transform my data to MNI space:

Following this I’m running a glm with these confounds:

from nilearn.glm.first_level import FirstLevelModel
fmri_glm = FirstLevelModel(t_r=0.720, 
                           hrf_model=None, 
                           drift_model=None, 
                           high_pass=None, 
                           drift_order=None, 
                           fir_delays=[0], 
                           min_onset=-24, 
                           mask_img=run_mask, 
                           target_affine=None, 
                           target_shape=None, 
                           smoothing_fwhm=None, 
#                            memory=Memory(location=None), 
                           memory_level=1, 
                           standardize=False, 
                           signal_scaling=0, 
                           noise_model='ar1', 
                           verbose=0, 
                           n_jobs=n_jobs, 
                           minimize_memory=False, 
                           subject_label=None)

fmri_glm = fmri_glm.fit(nilearn.image.index_img(run,range(start_index,run.get_fdata().shape[3])), 
                        design_matrices = conf.loc[start_index:])

I then get the residuals from this confound-only glm, as my de-noised data

dat = fmri_glm.residuals[0].get_fdata()

Following this, I run voxel-wise fft. Is this an optimal pipeline?

Thanks,

Tom

Hi Tom,

You might want to try nilearn.image.clean_img (Nilearn: Statistical Analysis for NeuroImaging in Python — Machine learning for NeuroImaging). It seems to save you a step, and does not, to my knowledge, presume a certain structure to the noise (in your code, the noise is modeled as a first-order autoregressuve function). When you don’t include the signal in your model, your residuals will include both signal and noise.

Best,
Steven

Awesome, thanks for the input @Steven – I appreciate it!

1 Like