Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Collate fieldmap coefficients into list of lists #317

Merged
merged 2 commits into from
Dec 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion sdcflows/workflows/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,15 @@ def init_fmap_preproc_wf(

workflow = Workflow(name=name)

out_fields = ("fmap", "fmap_ref", "fmap_coeff", "fmap_mask", "fmap_id", "method")
out_fields = ("fmap", "fmap_coeff", "fmap_ref", "fmap_mask", "fmap_id", "method")
out_merge = {
f: pe.Node(niu.Merge(len(estimators)), name=f"out_merge_{f}")
for f in out_fields
}
# Fieldmaps and coefficient files can come in pairs, ensure they are not flattened
out_merge["fmap"].inputs.no_flatten = True
out_merge["fmap_coeff"].inputs.no_flatten = True

outputnode = pe.Node(niu.IdentityInterface(fields=out_fields), name="outputnode")

workflow.connect(
Expand Down
14 changes: 12 additions & 2 deletions sdcflows/workflows/tests/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,15 @@ def test_fmap_wf(tmpdir, workdir, outdir, bids_layouts, dataset, subject):
if workdir:
wf.base_dir = str(workdir)

if os.getenv("GITHUB_ACTIONS") != "true":
wf.run(plugin="Linear")
if os.getenv("GITHUB_ACTIONS") == "true":
return

res = wf.run(plugin="Linear")

# Regression test for when out_merge_fmap_coeff was flattened and would
# have twice as many elements as the other nodes
assert all(
len(node.result.outputs.out) == len(estimators)
for node in res.nodes
if node.name.startswith("out_merge_")
)