My design is as follows:
-
Node
a
takes an iterfield withn
input files and produces 1 output file -
MapNode
b
takes an iterfield withn
input files and producesn
output files -
MapNode
c
takes the 1 output file froma
and processes it with then
output files ofb
to producen
new output files
Here is a minimal code example:
a = MapNode(..., iterfield=['in_file']) # output: 'out_files' (xn)
b = Node(..., iterfield=['in_file']) # output: 'out_file' (x1)
c = MapNode(..., iterfield=['in_files', 'in_file'])
wf.connect([
(a, b, [('out_files', 'in_file']),
(b, c, [('out_file', 'in_file']),
(a, c, [('out_files', 'in_files'])
])
This results in the following error:
ValueError: All iterfields of a MapNode have to have the same length.
in_file = ['/hidden-location1/file.nii']
in_files = ['/hidden-location2/file1.nii', '/hidden-location2/file2.nii', '/hidden-location2/file3.nii', '/hidden-location2/file4.nii', '/hidden-location2/file5.nii', '/hidden-location2/file6.nii', '/hidden-location2/file7.nii', '/hidden-location2/file8.nii', '/hidden-location2/file9.nii', '/hidden-location2/file10.nii']
I understand the problem, and that of course the lengths of the iterfields must match. I imagine the solution is to somehow repeat the contents of the in_file
list in c
so that its length matches the in_files
list (where each index is just a duplicate).
Any assistance would be greatly appreciated!