Nipype FSL nuisance GLM for resting-state

Hei there,

I’m working on a nuisance GLM in nipype to obtain “cleaned” residuals from a resting-state fmri run. I’m adding nuisance regressors (fmriprep-derived confounds and retroicor regressors) to the GLM but I don’t have any task regressors to convolve. However, in the subject_info that pipes into fsl’s modelspec, I need to specify conditions and onsets. How can I circumvent this? I doesn’t seem to accept empty lists as inputs here…
Help is appreciated! Thanks!

def get_regressors_func(confounds_file,retroicor_file):
    import pandas as pd
    from nipype.interfaces.base import Bunch
    confounds = pd.read_csv(confounds_file, sep='\t')
    confounds = confounds.fillna(0)
    retroicor = pd.read_csv(retroicor_file, sep='\t', header = None)
    retroicor = retroicor.fillna(0)
    retroicor = retroicor.add_prefix('retroicor')
    
    subject_info = Bunch(conditions = [],
                         onsets = [],
                         durations = [],
                         regressors = [list(confounds.csf),
                                       list(confounds.white_matter),
                                       list(confounds.framewise_displacement),
                                       list(confounds.dvars),                       #or use std_dvars?
                                       list(confounds.rot_x),
                                       list(confounds.rot_y),
                                       list(confounds.rot_z),
                                       list(confounds.trans_x),
                                       list(confounds.trans_y),
                                       list(confounds.trans_z)] + 
                                      [list(confounds[col] for col in confounds.columns if 'cosine' in col)] +
                                      [list(retroicor[col] for col in retroicor.columns)],
                         
                         regressor_names = ['csf','wm','fd','dvars','rotx','roty','rotz','transx','transy','transz'] +
                                           [col for col in confounds.columns if 'cosine' in col] +
                                           [col for col in retroicor.columns])
    
    return subject_info

get_regressors = Node(interface=Function(function=get_regressors_func, input_names=['confounds_file','retroicor_file'], output_names=['output_bunch']),
                      name='get_regressors')

I’m not sure it answers your question, but if you need a clean signal of resting-state, you might use Nilearn.
You can send confounds in Nilearn masker functions (or clean) and receive a cleaned parcellated signal. See here for a simple example.

Turns out the nipype error from above resulted from a mistake in defining what should have been a mapnode as a standard node, so the above code itself doesn’t throw any errors. Even though it runs, I’m not sure if it makes sense to set-up the GLM in FSL this way, so I’ll definitely check out Nilearn. Thanks!