Skip to content

Commit

Permalink
fix: addressing joining issues in ME pathway
Browse files Browse the repository at this point in the history
  • Loading branch information
oesteban committed Oct 22, 2021
1 parent a7785d6 commit 9eed5bc
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions fmriprep/workflows/bold/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,10 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False):

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

summary = pe.Node(
FunctionalSummary(
Expand Down Expand Up @@ -482,10 +485,14 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False):
# fmt:on
else: # for meepi, iterate through stc_wf for all workflows
meepi_echos = boldbuffer.clone(name="meepi_echos")
meepi_echos.iterables = ("bold_file", bold_file)
meepi_echos.iterables = [
("bold_file", bold_file),
("name_source", bold_file),
]
# fmt:off
workflow.connect([
(meepi_echos, bold_stc_wf, [("bold_file", "inputnode.bold_file")]),
(meepi_echos, boldbuffer, [("name_source", "name_source")]),
])
# fmt:on

Expand All @@ -498,7 +505,10 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False):
# fmt:on
else: # ME and skip-STC
# for meepi, iterate over all meepi echos to boldbuffer
boldbuffer.iterables = ("bold_file", bold_file)
boldbuffer.iterables = [
("bold_file", bold_file),
("name_source", bold_file),
]

# MULTI-ECHO EPI DATA #############################################
if multiecho: # instantiate relevant interfaces, imports
Expand Down Expand Up @@ -976,9 +986,11 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False):
use_fieldwarp=False,
name="bold_bold_trans_wf",
)
bold_bold_trans_wf.inputs.inputnode.name_source = ref_file
bold_bold_trans_wf.inputs.inputnode.fieldwarp = "identity"

if not multiecho:
bold_bold_trans_wf.inputs.inputnode.name_source = ref_file

# fmt:off
workflow.connect([
# Connect bold_bold_trans_wf
Expand All @@ -987,9 +999,7 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False):
("outputnode.xforms", "inputnode.hmc_xforms"),
]),
])
# fmt:on

# fmt:off
workflow.connect([
(bold_bold_trans_wf, bold_final, [("outputnode.bold", "bold")]),
(bold_bold_trans_wf, final_boldref_wf, [
Expand All @@ -999,6 +1009,9 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False):
(initial_boldref_wf, bold_t2s_wf, [
("outputnode.bold_mask", "inputnode.bold_mask"),
]),
(boldbuffer, bold_bold_trans_wf, [
("name_source", "inputnode.name_source"),
]),
(bold_bold_trans_wf, join_echos, [
("outputnode.bold", "bold_files"),
]),
Expand Down

0 comments on commit 9eed5bc

Please sign in to comment.