From 0ad307b66e5c97e07aa4ca0acf43abaeb4e3431e Mon Sep 17 00:00:00 2001 From: Oscar Esteban Date: Wed, 20 Oct 2021 11:05:34 +0200 Subject: [PATCH 01/10] fix: ME | Revise SDC compute graph Although I brought up the issue within #2530 and got some mildly opposed initial opinion from @effigies (https://github.com/nipreps/fmriprep/pull/2530#issuecomment-947147250), I've come to think that we should provide the T2star workflow with HMC'ed and SDC'ed echos (confirmation awaiting: https://github.com/nipreps/fmriprep/pull/2608#pullrequestreview-784145171). This comes as an issue related to #2606. This PR proposes that individual echoes are HMC'ed (and SDC'ed when fieldmaps are available) before calculating the optimal combination and the T2star map. I believe this may be beneficial when we combine SDC with modulation by the Jacobian of the distortion (nipreps/sdcflows#238) because that might help restore some (little, admittedly) of the dropout of the later echoes in distorted regions. I would expect more voxels will be deemed as acceptable for the exponential fitting for this reason. It also conceptually simplifies a little, as both SE and ME paths look more alike, and only the little hacks to generate ME iterables and the ``boldbuffer`` are now necessary. Otherwise, SDC would be inserted at a much later stage for ME only. --- fmriprep/workflows/bold/base.py | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/fmriprep/workflows/bold/base.py b/fmriprep/workflows/bold/base.py index 684691c79..6ec411624 100644 --- a/fmriprep/workflows/bold/base.py +++ b/fmriprep/workflows/bold/base.py @@ -488,14 +488,15 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False): (meepi_echos, bold_stc_wf, [("bold_file", "inputnode.bold_file")]), ]) # fmt:on - elif not multiecho: # STC is too short or False + + # bypass STC from original BOLD in both SE and ME cases + elif not multiecho: # SE and skip-STC # fmt:off - # bypass STC from original BOLD to the splitter through boldbuffer workflow.connect([ (initial_boldref_wf, boldbuffer, [("outputnode.bold_file", "bold_file")]), ]) # fmt:on - else: + else: # ME and skip-STC # for meepi, iterate over all meepi echos to boldbuffer boldbuffer.iterables = ("bold_file", bold_file) @@ -999,9 +1000,6 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False): ]), ] if not multiecho else [ - (bold_bold_trans_wf, join_echos, [ - ("outputnode.bold", "bold_files"), - ]), (join_echos, final_boldref_wf, [("bold_files", "inputnode.bold_file")]), # use reference image mask used by bold_bold_trans_wf (bold_bold_trans_wf, bold_t2s_wf, [ @@ -1087,6 +1085,8 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False): ("outputnode.xforms", "inputnode.hmc_xforms")]), (initial_boldref_wf, sdc_report, [ ("outputnode.ref_image", "before")]), + (bold_split, unwarp_wf, [ + ("out_files", "inputnode.distorted")]), (unwarp_wf, final_boldref_wf, [ ("outputnode.corrected_ref", "inputnode.bold_file"), ]), @@ -1096,12 +1096,11 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False): (inputnode, ds_report_sdc, [("bold_file", "source_file")]), (sdc_report, ds_report_sdc, [("out_report", "in_file")]), # remaining workflow connections - (unwarp_wf, bold_std_trans_wf, [ + (unwarp_wf, bold_t1_trans_wf, [ # TEMPORARY: For the moment we can't use frame-wise fieldmaps (("outputnode.fieldwarp", _pop), "inputnode.fieldwarp"), ]), - (unwarp_wf, bold_final, [("outputnode.corrected", "bold")]), - (unwarp_wf, bold_t1_trans_wf, [ + (unwarp_wf, bold_std_trans_wf, [ # TEMPORARY: For the moment we can't use frame-wise fieldmaps (("outputnode.fieldwarp", _pop), "inputnode.fieldwarp"), ]), @@ -1111,15 +1110,15 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False): if not multiecho: # fmt:off workflow.connect([ - (bold_split, unwarp_wf, [ - ("out_files", "inputnode.distorted")]), + (unwarp_wf, bold_final, [("outputnode.corrected", "bold")]), ]) # fmt:on else: # fmt:off workflow.connect([ - (split_opt_comb, unwarp_wf, [ - ("out_files", "inputnode.distorted")]) + (unwarp_wf, join_echos, [ + ("outputnode.outputnode", "bold_files"), + ]), ]) # fmt:on From d903174ab75768f42a7718c2016f1ea47bb72e05 Mon Sep 17 00:00:00 2001 From: Oscar Esteban Date: Wed, 20 Oct 2021 11:29:26 +0200 Subject: [PATCH 02/10] fix: revise bad connection naming, clean up style --- fmriprep/workflows/bold/base.py | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/fmriprep/workflows/bold/base.py b/fmriprep/workflows/bold/base.py index 6ec411624..a06224e74 100644 --- a/fmriprep/workflows/bold/base.py +++ b/fmriprep/workflows/bold/base.py @@ -1105,23 +1105,15 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False): (("outputnode.fieldwarp", _pop), "inputnode.fieldwarp"), ]), ]) + + # Connect corrected ouputs depending on whether it is SE or ME + workflow.connect([ + (unwarp_wf, bold_final, [("outputnode.corrected", "bold")]), + ] if not multiecho else [ + (unwarp_wf, join_echos, [("outputnode.corrected", "bold_files")]), + ]) # fmt:on - if not multiecho: - # fmt:off - workflow.connect([ - (unwarp_wf, bold_final, [("outputnode.corrected", "bold")]), - ]) - # fmt:on - else: - # fmt:off - workflow.connect([ - (unwarp_wf, join_echos, [ - ("outputnode.outputnode", "bold_files"), - ]), - ]) - # fmt:on - return workflow From bc203a3807f6b1debbb20e55c3eb4a7b195d8b92 Mon Sep 17 00:00:00 2001 From: Oscar Esteban Date: Wed, 20 Oct 2021 11:43:49 +0200 Subject: [PATCH 03/10] sty: cosmetic change to connection --- fmriprep/workflows/bold/base.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/fmriprep/workflows/bold/base.py b/fmriprep/workflows/bold/base.py index a06224e74..c78656419 100644 --- a/fmriprep/workflows/bold/base.py +++ b/fmriprep/workflows/bold/base.py @@ -641,9 +641,7 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False): (join_echos, bold_t2s_wf, [("bold_files", "inputnode.bold_file")]), (bold_t2s_wf, split_opt_comb, [("outputnode.bold", "in_file")]), (split_opt_comb, bold_t1_trans_wf, [("out_files", "inputnode.bold_split")]), - (bold_t2s_wf, bold_final, [ - ("outputnode.bold", "bold"), - ]), + (bold_t2s_wf, bold_final, [("outputnode.bold", "bold")]), ]) # fmt:on From a720d1a7d7806425470b4f7a72799b28d9463e55 Mon Sep 17 00:00:00 2001 From: Oscar Esteban Date: Thu, 21 Oct 2021 10:25:55 +0200 Subject: [PATCH 04/10] fix: broken SE workflow path, PEP8 error --- fmriprep/workflows/bold/base.py | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/fmriprep/workflows/bold/base.py b/fmriprep/workflows/bold/base.py index c78656419..734639662 100644 --- a/fmriprep/workflows/bold/base.py +++ b/fmriprep/workflows/bold/base.py @@ -984,27 +984,22 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False): (bold_hmc_wf, bold_bold_trans_wf, [ ("outputnode.xforms", "inputnode.hmc_xforms"), ]), + (bold_bold_trans_wf, final_boldref_wf, [ + ("outputnode.bold", "inputnode.bold_file"), + ]), ]) # fmt:on # fmt:off - workflow.connect( - [ - (bold_bold_trans_wf, final_boldref_wf, [ - ("outputnode.bold", "inputnode.bold_file"), - ]), - (bold_bold_trans_wf, bold_final, [ - ("outputnode.bold", "bold"), - ]), - ] if not multiecho - else [ - (join_echos, final_boldref_wf, [("bold_files", "inputnode.bold_file")]), - # use reference image mask used by bold_bold_trans_wf - (bold_bold_trans_wf, bold_t2s_wf, [ - (("outputnode.bold_mask", pop_file), "inputnode.bold_mask"), - ]), - ] - ) + workflow.connect([ + (bold_bold_trans_wf, bold_final, [("outputnode.bold", "bold")]), + ] if not multiecho else [ + (bold_bold_trans_wf, join_echos, [("outputnode.bold", "bold_files")]), + # use reference image mask used by bold_bold_trans_wf + (bold_bold_trans_wf, bold_t2s_wf, [ + (("outputnode.bold_mask", pop_file), "inputnode.bold_mask"), + ]), + ]) # fmt:on return workflow @@ -1103,7 +1098,7 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False): (("outputnode.fieldwarp", _pop), "inputnode.fieldwarp"), ]), ]) - + # Connect corrected ouputs depending on whether it is SE or ME workflow.connect([ (unwarp_wf, bold_final, [("outputnode.corrected", "bold")]), From 6ac3f816e052a64a07e56217704f14b169772592 Mon Sep 17 00:00:00 2001 From: Oscar Esteban Date: Thu, 21 Oct 2021 17:07:59 +0200 Subject: [PATCH 05/10] fix: use joined fields when calculating final boldref --- fmriprep/workflows/bold/base.py | 95 +++++++++++++++++++++++++-------- 1 file changed, 73 insertions(+), 22 deletions(-) diff --git a/fmriprep/workflows/bold/base.py b/fmriprep/workflows/bold/base.py index 734639662..693781c93 100644 --- a/fmriprep/workflows/bold/base.py +++ b/fmriprep/workflows/bold/base.py @@ -507,7 +507,7 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False): inputnode.inputs.bold_file = ref_file # Replace reference w first echo join_echos = pe.JoinNode( - niu.IdentityInterface(fields=["bold_files"]), + niu.IdentityInterface(fields=["bold_files", "bold_masks"]), joinsource=("meepi_echos" if run_stc is True else "boldbuffer"), joinfield=["bold_files"], name="join_echos", @@ -984,20 +984,26 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False): (bold_hmc_wf, bold_bold_trans_wf, [ ("outputnode.xforms", "inputnode.hmc_xforms"), ]), - (bold_bold_trans_wf, final_boldref_wf, [ - ("outputnode.bold", "inputnode.bold_file"), - ]), ]) # fmt:on # fmt:off workflow.connect([ (bold_bold_trans_wf, bold_final, [("outputnode.bold", "bold")]), + (bold_bold_trans_wf, final_boldref_wf, [ + ("outputnode.bold", "inputnode.bold_file"), + ]), ] if not multiecho else [ - (bold_bold_trans_wf, join_echos, [("outputnode.bold", "bold_files")]), + (bold_bold_trans_wf, join_echos, [ + ("outputnode.bold", "bold_files"), + ("outputnode.bold_mask", "bold_masks"), + ]), # use reference image mask used by bold_bold_trans_wf - (bold_bold_trans_wf, bold_t2s_wf, [ - (("outputnode.bold_mask", pop_file), "inputnode.bold_mask"), + (join_echos, bold_t2s_wf, [ + (("bold_masks", pop_file), "inputnode.bold_mask"), + ]), + (join_echos, final_boldref_wf, [ + ("bold_files", "inputnode.bold_file"), ]), ]) # fmt:on @@ -1007,7 +1013,6 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False): SimpleBeforeAfterRPT as SimpleBeforeAfter, ) from niworkflows.interfaces.utility import KeySelect - from sdcflows.utils.misc import front as _pop from sdcflows.workflows.apply.registration import init_coeff2epi_wf from sdcflows.workflows.apply.correction import init_unwarp_wf @@ -1080,31 +1085,77 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False): ("outputnode.ref_image", "before")]), (bold_split, unwarp_wf, [ ("out_files", "inputnode.distorted")]), - (unwarp_wf, final_boldref_wf, [ - ("outputnode.corrected_ref", "inputnode.bold_file"), - ]), (final_boldref_wf, sdc_report, [ ("outputnode.ref_image", "after"), ("outputnode.bold_mask", "wm_seg")]), (inputnode, ds_report_sdc, [("bold_file", "source_file")]), (sdc_report, ds_report_sdc, [("out_report", "in_file")]), + + ]) + # fmt:on + + if not multiecho: + # fmt:off + workflow.connect([ + (unwarp_wf, bold_final, [("outputnode.corrected", "bold")]), + # remaining workflow connections + (unwarp_wf, final_boldref_wf, [ + ("outputnode.corrected", "inputnode.bold_file"), + ]), + (unwarp_wf, bold_t1_trans_wf, [ + # TEMPORARY: For the moment we can't use frame-wise fieldmaps + (("outputnode.fieldwarp", pop_file), "inputnode.fieldwarp"), + ]), + (unwarp_wf, bold_std_trans_wf, [ + # TEMPORARY: For the moment we can't use frame-wise fieldmaps + (("outputnode.fieldwarp", pop_file), "inputnode.fieldwarp"), + ]), + ]) + # fmt:on + return workflow + + # Finalize connections if ME-EPI + join_sdc_echos = pe.JoinNode( + niu.IdentityInterface( + fields=[ + "fieldmap", + "fieldwarp", + "corrected", + "corrected_ref", + "corrected_mask", + ] + ), + joinsource=("meepi_echos" if run_stc is True else "boldbuffer"), + joinfield=["bold_files"], + name="join_sdc_echos", + ) + + def _dpop(list_of_lists): + return list_of_lists[0][0] + + # fmt:off + workflow.connect([ + (unwarp_wf, join_echos, [("outputnode.corrected", "bold_files")]), + (unwarp_wf, join_sdc_echos, [ + ("outputnode.fieldmap", "fieldmap"), + ("outputnode.fieldwarp", "fieldwarp"), + ("outputnode.corrected", "corrected"), + ("outputnode.corrected_ref", "corrected_ref"), + ("outputnode.corrected_mask", "corrected_mask"), + ]), # remaining workflow connections - (unwarp_wf, bold_t1_trans_wf, [ + (join_sdc_echos, final_boldref_wf, [ + ("corrected", "inputnode.bold_file"), + ]), + (join_sdc_echos, bold_t1_trans_wf, [ # TEMPORARY: For the moment we can't use frame-wise fieldmaps - (("outputnode.fieldwarp", _pop), "inputnode.fieldwarp"), + (("fieldwarp", _dpop), "inputnode.fieldwarp"), ]), - (unwarp_wf, bold_std_trans_wf, [ + (join_sdc_echos, bold_std_trans_wf, [ # TEMPORARY: For the moment we can't use frame-wise fieldmaps - (("outputnode.fieldwarp", _pop), "inputnode.fieldwarp"), + (("fieldwarp", _dpop), "inputnode.fieldwarp"), ]), ]) - - # Connect corrected ouputs depending on whether it is SE or ME - workflow.connect([ - (unwarp_wf, bold_final, [("outputnode.corrected", "bold")]), - ] if not multiecho else [ - (unwarp_wf, join_echos, [("outputnode.corrected", "bold_files")]), - ]) # fmt:on return workflow From b67636b56ab4cce2f716b29480d38acc99d2071c Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Thu, 21 Oct 2021 14:52:50 -0400 Subject: [PATCH 06/10] FIX: Connect unwarped bold masks to join_echos --- fmriprep/workflows/bold/base.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fmriprep/workflows/bold/base.py b/fmriprep/workflows/bold/base.py index 693781c93..1eb2fcad7 100644 --- a/fmriprep/workflows/bold/base.py +++ b/fmriprep/workflows/bold/base.py @@ -1135,7 +1135,10 @@ def _dpop(list_of_lists): # fmt:off workflow.connect([ - (unwarp_wf, join_echos, [("outputnode.corrected", "bold_files")]), + (unwarp_wf, join_echos, [ + ("outputnode.corrected", "bold_files"), + ("outputnode.corrected_mask", "bold_masks"), + ]), (unwarp_wf, join_sdc_echos, [ ("outputnode.fieldmap", "fieldmap"), ("outputnode.fieldwarp", "fieldwarp"), From e43a8fd8577834671210ad15257862501e7774f2 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Thu, 21 Oct 2021 16:30:19 -0400 Subject: [PATCH 07/10] FIX: Connect up bold_t2s_wf.inputs.bold_mask unconditionally --- fmriprep/workflows/bold/base.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/fmriprep/workflows/bold/base.py b/fmriprep/workflows/bold/base.py index 1eb2fcad7..c39f6333d 100644 --- a/fmriprep/workflows/bold/base.py +++ b/fmriprep/workflows/bold/base.py @@ -638,7 +638,10 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False): (inputnode, func_derivatives_wf, [ (("bold_file", combine_meepi_source), "inputnode.source_file"), ]), - (join_echos, bold_t2s_wf, [("bold_files", "inputnode.bold_file")]), + (join_echos, bold_t2s_wf, [ + ("bold_files", "inputnode.bold_file"), + (("bold_masks", pop_file), "inputnode.bold_mask"), + ]), (bold_t2s_wf, split_opt_comb, [("outputnode.bold", "in_file")]), (split_opt_comb, bold_t1_trans_wf, [("out_files", "inputnode.bold_split")]), (bold_t2s_wf, bold_final, [("outputnode.bold", "bold")]), @@ -998,10 +1001,6 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False): ("outputnode.bold", "bold_files"), ("outputnode.bold_mask", "bold_masks"), ]), - # use reference image mask used by bold_bold_trans_wf - (join_echos, bold_t2s_wf, [ - (("bold_masks", pop_file), "inputnode.bold_mask"), - ]), (join_echos, final_boldref_wf, [ ("bold_files", "inputnode.bold_file"), ]), From a7785d6c055bdecd0f093529b110b7d6e87ccc67 Mon Sep 17 00:00:00 2001 From: Oscar Esteban Date: Fri, 22 Oct 2021 09:29:40 +0200 Subject: [PATCH 08/10] fix: revise @effigies' b67636b & e43a8fd Turns out that our bold-to-bold resampling workflow has fake inputs and outputs called ``bold_mask``. That made me believe that, if we were joining the bold echoes from the bold-to-bold resampling workflow, we could do the same with the mask. Looking into this in depth made me realize of the confusing i/o spec of the workflow, and also of the fact that it is unnecessary to join anything in the absence of fieldwarp because the mask is the same you calculated with the initial boldref. So I connected that one and locally seems to be functioning okay. Hopefully, this was the last bit of this not-so-trivial attempt to organize the ME-EPI pathway. I'm already shaking by thinking at some point we will need a similar in-depth revision of the SBRef dealings... --- fmriprep/workflows/bold/base.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/fmriprep/workflows/bold/base.py b/fmriprep/workflows/bold/base.py index c39f6333d..72a08db22 100644 --- a/fmriprep/workflows/bold/base.py +++ b/fmriprep/workflows/bold/base.py @@ -507,7 +507,7 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False): inputnode.inputs.bold_file = ref_file # Replace reference w first echo join_echos = pe.JoinNode( - niu.IdentityInterface(fields=["bold_files", "bold_masks"]), + niu.IdentityInterface(fields=["bold_files"]), joinsource=("meepi_echos" if run_stc is True else "boldbuffer"), joinfield=["bold_files"], name="join_echos", @@ -640,7 +640,6 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False): ]), (join_echos, bold_t2s_wf, [ ("bold_files", "inputnode.bold_file"), - (("bold_masks", pop_file), "inputnode.bold_mask"), ]), (bold_t2s_wf, split_opt_comb, [("outputnode.bold", "in_file")]), (split_opt_comb, bold_t1_trans_wf, [("out_files", "inputnode.bold_split")]), @@ -997,9 +996,11 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False): ("outputnode.bold", "inputnode.bold_file"), ]), ] if not multiecho else [ + (initial_boldref_wf, bold_t2s_wf, [ + ("outputnode.bold_mask", "inputnode.bold_mask"), + ]), (bold_bold_trans_wf, join_echos, [ ("outputnode.bold", "bold_files"), - ("outputnode.bold_mask", "bold_masks"), ]), (join_echos, final_boldref_wf, [ ("bold_files", "inputnode.bold_file"), @@ -1136,7 +1137,6 @@ def _dpop(list_of_lists): workflow.connect([ (unwarp_wf, join_echos, [ ("outputnode.corrected", "bold_files"), - ("outputnode.corrected_mask", "bold_masks"), ]), (unwarp_wf, join_sdc_echos, [ ("outputnode.fieldmap", "fieldmap"), @@ -1149,6 +1149,9 @@ def _dpop(list_of_lists): (join_sdc_echos, final_boldref_wf, [ ("corrected", "inputnode.bold_file"), ]), + (join_sdc_echos, bold_t2s_wf, [ + ("corrected_mask", "inputnode.bold_mask"), + ]), (join_sdc_echos, bold_t1_trans_wf, [ # TEMPORARY: For the moment we can't use frame-wise fieldmaps (("fieldwarp", _dpop), "inputnode.fieldwarp"), From 9eed5bc77531840e412fe6aa18ad75435d51cea0 Mon Sep 17 00:00:00 2001 From: Oscar Esteban Date: Fri, 22 Oct 2021 12:28:24 +0200 Subject: [PATCH 09/10] fix: addressing joining issues in ME pathway --- fmriprep/workflows/bold/base.py | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/fmriprep/workflows/bold/base.py b/fmriprep/workflows/bold/base.py index 72a08db22..81545daad 100644 --- a/fmriprep/workflows/bold/base.py +++ b/fmriprep/workflows/bold/base.py @@ -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( @@ -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 @@ -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 @@ -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 @@ -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, [ @@ -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"), ]), From 7fc382e465f0d65a8db73bed35b58aed162f507a Mon Sep 17 00:00:00 2001 From: Oscar Esteban Date: Fri, 22 Oct 2021 14:31:55 +0200 Subject: [PATCH 10/10] fix: missing formatting interpolation placement in interface input --- fmriprep/interfaces/multiecho.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fmriprep/interfaces/multiecho.py b/fmriprep/interfaces/multiecho.py index 2b5eefa08..52dcde9d1 100644 --- a/fmriprep/interfaces/multiecho.py +++ b/fmriprep/interfaces/multiecho.py @@ -56,9 +56,8 @@ class T2SMapInputSpec(CommandLineInputSpec): mandatory=True, minlen=3, desc='echo times') - mask_file = File(argstr='--mask', + mask_file = File(argstr='--mask %s', position=3, - mandatory=False, desc='mask file', exists=True) fittype = traits.Enum('curvefit', 'loglin', @@ -95,6 +94,7 @@ class T2SMap(CommandLine): >>> t2smap.cmdline # doctest: +ELLIPSIS 't2smap -d sub-01_run-01_echo-1_bold.nii.gz sub-01_run-01_echo-2_bold.nii.gz \ sub-01_run-01_echo-3_bold.nii.gz -e 13.0 27.0 43.0 --fittype curvefit' + """ _cmd = 't2smap' input_spec = T2SMapInputSpec