I am fairly new to python and Nipype so I appreciate this is probably very basic question. I would be most grateful for some advice as to how to run a standalone function multiple times for each participant giving multiple outputs for each participant.
The function is simply to reset the origin of the images. Each participant has a structural and functional image. This is a summary of what I have set up so far, and this works fine for resetting the origin for solely one of the images - i.e. the struc or the func.
def origin_reset(niftis): import required modules (function resets the origin) return reset_niftis
reset_origin = pe.Node(name=‘reset_origin’, interface=util.Function(input_names=[‘niftis’],
rs_prepro.connect([(infosource, selectfiles, [(‘subject_id’, ‘subject_id’)]),
(selectfiles, reset_origin, [(‘struc’, ‘niftis’)]),
(reset_origin, datasink, [(‘reset_niftis’, ‘reset’)])
I have got a bit stuck, however, in my attempts to run it for both the images.
rs_prepro.connect([(infosource, selectfiles, [('subject_id', 'subject_id')]), (selectfiles, reset_origin, [('struc', 'niftis')]), (selectfiles, reset_origin, [('func', 'niftis')]), (reset_origin, datasink, [('reset_niftis', 'reset')]) ])
The above method and variants of it does not seem to be the correct approach. I wondered whether I should be setting the reset_origin as a MapNode, or having a reset_origin.iterables line beneath it? Or perhaps I need to change the function to have multiple inputs/outputs?
Any help would be most appreciated