Skip to content

Commit 9eed5bc

Browse files
committed
fix: addressing joining issues in ME pathway
1 parent a7785d6 commit 9eed5bc

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

fmriprep/workflows/bold/base.py

+19-6
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,10 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False):
350350

351351
# BOLD buffer: an identity used as a pointer to either the original BOLD
352352
# or the STC'ed one for further use.
353-
boldbuffer = pe.Node(niu.IdentityInterface(fields=["bold_file"]), name="boldbuffer")
353+
boldbuffer = pe.Node(niu.IdentityInterface(fields=["bold_file", "name_source"]),
354+
name="boldbuffer")
355+
if multiecho:
356+
boldbuffer.synchronize = True
354357

355358
summary = pe.Node(
356359
FunctionalSummary(
@@ -482,10 +485,14 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False):
482485
# fmt:on
483486
else: # for meepi, iterate through stc_wf for all workflows
484487
meepi_echos = boldbuffer.clone(name="meepi_echos")
485-
meepi_echos.iterables = ("bold_file", bold_file)
488+
meepi_echos.iterables = [
489+
("bold_file", bold_file),
490+
("name_source", bold_file),
491+
]
486492
# fmt:off
487493
workflow.connect([
488494
(meepi_echos, bold_stc_wf, [("bold_file", "inputnode.bold_file")]),
495+
(meepi_echos, boldbuffer, [("name_source", "name_source")]),
489496
])
490497
# fmt:on
491498

@@ -498,7 +505,10 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False):
498505
# fmt:on
499506
else: # ME and skip-STC
500507
# for meepi, iterate over all meepi echos to boldbuffer
501-
boldbuffer.iterables = ("bold_file", bold_file)
508+
boldbuffer.iterables = [
509+
("bold_file", bold_file),
510+
("name_source", bold_file),
511+
]
502512

503513
# MULTI-ECHO EPI DATA #############################################
504514
if multiecho: # instantiate relevant interfaces, imports
@@ -976,9 +986,11 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False):
976986
use_fieldwarp=False,
977987
name="bold_bold_trans_wf",
978988
)
979-
bold_bold_trans_wf.inputs.inputnode.name_source = ref_file
980989
bold_bold_trans_wf.inputs.inputnode.fieldwarp = "identity"
981990

991+
if not multiecho:
992+
bold_bold_trans_wf.inputs.inputnode.name_source = ref_file
993+
982994
# fmt:off
983995
workflow.connect([
984996
# Connect bold_bold_trans_wf
@@ -987,9 +999,7 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False):
987999
("outputnode.xforms", "inputnode.hmc_xforms"),
9881000
]),
9891001
])
990-
# fmt:on
9911002

992-
# fmt:off
9931003
workflow.connect([
9941004
(bold_bold_trans_wf, bold_final, [("outputnode.bold", "bold")]),
9951005
(bold_bold_trans_wf, final_boldref_wf, [
@@ -999,6 +1009,9 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False):
9991009
(initial_boldref_wf, bold_t2s_wf, [
10001010
("outputnode.bold_mask", "inputnode.bold_mask"),
10011011
]),
1012+
(boldbuffer, bold_bold_trans_wf, [
1013+
("name_source", "inputnode.name_source"),
1014+
]),
10021015
(bold_bold_trans_wf, join_echos, [
10031016
("outputnode.bold", "bold_files"),
10041017
]),

0 commit comments

Comments
 (0)