Trouble with Datagrabber in Nypype


I wanna use datagrabber in my Npype workflow but I’m running into som problems. It works fine right now when I’m running:

dg = Node(DataGrabber(infields=['subject_id', 'session_id' ],
                      outfields=['FLAIR', 'ADC', 't2star']),

# Location of the dataset folder
dg.inputs.base_directory = '/home/brain/Documents/data/iNPH/BIDS/bids_nii/'

# Necessary default parameters
dg.inputs.template = '*'
dg.inputs.sort_filelist = True

dg.inputs.field_template = {'FLAIR': 'sub-%s/ses-1/anat/*FLAIR.nii.gz',
                            'ADC': 'sub-%s/ses-1/dwi/*adc.nii.gz',
                            't2star': 'sub-%s/ses-1/func/*T2star.nii.gz'}

dg.inputs.template_args['FLAIR'] = [['subject_id']]
dg.inputs.template_args['ADC'] = [['subject_id']]
dg.inputs.template_args['t2star'] = [['subject_id']]

Worth to mention is that I have the IdentityInterface node which iterate over my subjects.

infosource = Node(IdentityInterface(fields=['subject_id', 'session_id']),
infosource.iterables = [('subject_id', subject_list),
                       ('session_id', ses_list)]

But as you can see, I’ve set the datagrabber to take data from ses-1 manually in field_template. What I really wanna do is to iterate over my different sessions the same way I iterate over my subjects.

Like: dg.inputs.field_template = {'FLAIR': 'sub-%s/ses-%s/anat/*FLAIR.nii.gz',

Anyone that could help me out?

Sencerely, Jesper