nipy / nipype

Workflows and interfaces for neuroimaging packages
https://nipype.readthedocs.org/en/latest/
Other
748 stars 530 forks source link

Problems with DataGrabber substitutions #1581

Open oesteban opened 8 years ago

oesteban commented 8 years ago
datasource = nio.DataGrabber(infields=['subject_id'],outfields=['anat_t1','anat_t2', 'func_bold', 'func_events'])

datasource.inputs.template_args=dict(anat_t2=[['subject_id', 'subject_id']],func_bold=[['subject_id', 'subject_id', [1, 2, 3]]], func_events=[['subject_id', 'subject_id', [1, 2, 3]]], anat_t1=[['subject_id', 'subject_id']])

datasource.inputs.field_template=dict(anat_t2='sub-%s/anat/sub-%s_inplaneT2.nii.gz', func_bold='sub-%s/func/sub-%s_task-balloonanalogrisktask_run-%.2d_bold.nii.gz', func_events= 'sub-%s/func/sub-%s_task-balloonanalogrisktask_run-%.2d_events.tsv', anat_t1= 'sub-%s/anat/sub-%s_T1w.nii.gz')

yields:

In [14]: grabbed = grabber.run()
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-14-655eeb5e5ee6> in <module>()
----> 1 grabbed = grabber.run()

/home/ghislain/workspace/nipype/nipype/interfaces/base.py in run(self, **inputs)
   1042         try:
   1043             runtime = self._run_wrapper(runtime)
-> 1044             outputs = self.aggregate_outputs(runtime)
   1045             runtime.endTime = dt.isoformat(dt.utcnow())
   1046             timediff = parseutc(runtime.endTime) - parseutc(runtime.startTime)

/home/ghislain/workspace/nipype/nipype/interfaces/base.py in aggregate_outputs(self, runtime, needed_outputs)
   1113         """ Collate expected outputs and check for existence
   1114         """
-> 1115         predicted_outputs = self._list_outputs()
   1116         outputs = self._outputs()
   1117         if predicted_outputs:

/home/ghislain/workspace/nipype/nipype/interfaces/io.py in _list_outputs(self)
   1160                             arg = getattr(self.inputs, arg)
   1161                         if isinstance(arg, list):
-> 1162                             argtuple.append(arg[i])
   1163                         else:
   1164                             argtuple.append(arg)

IndexError: list index out of range
Interface DataGrabber failed to run.
satra commented 8 years ago

oscar: can you clarify the scenario here? is it give me functional runs [1, 2, 3] from each subject?

is this different from this:

http://nipype.readthedocs.io/en/latest/users/grabbing_and_sinking.html#a-more-realistic-use-case

oesteban commented 8 years ago

This issue was reported in the gitter channel by @mvbnoel and @ghisvail. I would invite them to track this issue here, rather than in gitter.

satra commented 8 years ago

http://nbviewer.jupyter.org/urls/dl.dropbox.com/s/s3i2fwmuct01geg/basic_data_input.ipynb