0

我正在尝试为规范化/共同注册构建工作流程。这是我的 DataGrabber

data_grabber = Node(interface=DataGrabber(infields=['subject_id'], 
                                      outfields=['t1', 'flair', 'les','ref']),
               name ='data_grabber')
data_grabber.inputs.base_directory = base_dir
data_grabber.inputs.template = '*'
data_grabber.inputs.sort_filelist = True
data_grabber.inputs.field_template = dict(t1='T1/%s_BL_T1.nii',
                                   flair='FLAIR/%s_BL_FLAIR.nii',
                                   les='Lesions/%s_BL_FLAIR*.nii',
                                    ref='/usr/share/data/fsl-mni152-templates/%s')
data_grabber.inputs.template_args = dict(t1=[['subject_id']],
                                   flair=[['subject_id']],
                                   les=[['subject_id']],
                                    ref=[['MNI152_T1_1mm.nii.gz']])

data_grabber.inputs.subject_id = [217, 221]

当我只尝试一个主题时,一切运行都没有问题,如果有更多主题,我会收到以下错误。

TraitError: The 'in_file' trait of a FLIRTInputSpec instance must be an existing file name, but a value of ['/[...]/FLAIR/217_BL_FLAIR.nii', '/[...]/FLAIR/221_BL_FLAIR.nii'] <class 'list'> was specified.
Error setting node input:
Node: flair_norm
input: in_file
results_file: /[...]/data_grabber/result_data_grabber.pklz
value: ['/[...]/FLAIR/217_BL_FLAIR.nii', '/[...]/FLAIR/221_BL_FLAIR.nii']
4

1 回答 1

0

DataGrabber 只接受一个 in_file。您需要将 DataGrabber 放入 MapNode:

data_grabber = MapNode(
    interface = DataGrabber(
        infields = ['subject_id'],
        outfields = ['t1', 'flair', 'les','ref']
    ),
    iterfields = ['in_file'],
    name = 'data_grabber'
)
于 2018-12-26T20:40:56.123 回答