Skip to content

Commit 4b271a5

Browse files
authored
Merge pull request #317 from effigies/fix/collate_coeffs
FIX: Collate fieldmap coefficients into list of lists
2 parents b11551e + 16df78c commit 4b271a5

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

sdcflows/workflows/base.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,15 @@ def init_fmap_preproc_wf(
8787

8888
workflow = Workflow(name=name)
8989

90-
out_fields = ("fmap", "fmap_ref", "fmap_coeff", "fmap_mask", "fmap_id", "method")
90+
out_fields = ("fmap", "fmap_coeff", "fmap_ref", "fmap_mask", "fmap_id", "method")
9191
out_merge = {
9292
f: pe.Node(niu.Merge(len(estimators)), name=f"out_merge_{f}")
9393
for f in out_fields
9494
}
95+
# Fieldmaps and coefficient files can come in pairs, ensure they are not flattened
96+
out_merge["fmap"].inputs.no_flatten = True
97+
out_merge["fmap_coeff"].inputs.no_flatten = True
98+
9599
outputnode = pe.Node(niu.IdentityInterface(fields=out_fields), name="outputnode")
96100

97101
workflow.connect(

sdcflows/workflows/tests/test_base.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,15 @@ def test_fmap_wf(tmpdir, workdir, outdir, bids_layouts, dataset, subject):
6262
if workdir:
6363
wf.base_dir = str(workdir)
6464

65-
if os.getenv("GITHUB_ACTIONS") != "true":
66-
wf.run(plugin="Linear")
65+
if os.getenv("GITHUB_ACTIONS") == "true":
66+
return
67+
68+
res = wf.run(plugin="Linear")
69+
70+
# Regression test for when out_merge_fmap_coeff was flattened and would
71+
# have twice as many elements as the other nodes
72+
assert all(
73+
len(node.result.outputs.out) == len(estimators)
74+
for node in res.nodes
75+
if node.name.startswith("out_merge_")
76+
)

0 commit comments

Comments
 (0)