From 9f7278685a05dad7f3406bc8c8af8dd98f2f840b Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Thu, 9 Sep 2021 08:41:58 -0400 Subject: [PATCH 01/21] FIX: Restore SyN-SDC --- fmriprep/workflows/base.py | 56 ++++++++++++++++++++++++++++++++------ 1 file changed, 47 insertions(+), 9 deletions(-) diff --git a/fmriprep/workflows/base.py b/fmriprep/workflows/base.py index c209426f0..7abfa970f 100644 --- a/fmriprep/workflows/base.py +++ b/fmriprep/workflows/base.py @@ -312,11 +312,10 @@ def init_single_subject_wf(subject_id): return workflow fmap_estimators = None - # TODO 21.0.0: Implement SyN - if any((config.workflow.use_syn_sdc, config.workflow.force_syn)): - config.loggers.workflow.critical("SyN processing is not yet implemented.") - if "fieldmaps" not in config.workflow.ignore: + if any(("fieldmaps" not in config.workflow.ignore, + config.workflow.use_syn_sdc, + config.workflow.force_syn)): from sdcflows.utils.wrangler import find_estimators # SDC Step 1: Run basic heuristics to identify available data for fieldmap estimation @@ -324,8 +323,8 @@ def init_single_subject_wf(subject_id): fmap_estimators = find_estimators( layout=config.execution.layout, subject=subject_id, - fmapless=False, # config.workflow.use_syn_sdc, - force_fmapless=False, # config.workflow.force_syn, + fmapless=config.workflow.use_syn_sdc, + force_fmapless=config.workflow.force_syn, ) config.loggers.workflow.debug( @@ -333,6 +332,14 @@ def init_single_subject_wf(subject_id): f"{[e.method for e in fmap_estimators]}" ) + if "fieldmaps" in config.workflow.ignore: + fmap_estimators = [f for f in fmap_estimators + if f.method == fm.EstimatorType.ANAT] + config.loggers.workflow.debug( + "Ignoring fieldmap scans, using anatomical estimators: " + f"{[e.method for e in fmap_estimators]}" + ) + # Append the functional section to the existing anatomical exerpt # That way we do not need to stream down the number of bold datasets anat_preproc_wf.__postdesc__ = (anat_preproc_wf.__postdesc__ or '') + """ @@ -424,13 +431,44 @@ def init_single_subject_wf(subject_id): getattr(fmap_wf.inputs, f"in_{estimator.bids_id}").metadata = [ s.metadata for s in estimator.sources ] - continue - if estimator.method == fm.EstimatorType.PEPOLAR: + elif estimator.method == fm.EstimatorType.PEPOLAR: raise NotImplementedError( "Sophisticated PEPOLAR schemes are unsupported." ) - # TODO: SyN fieldmap processing + + elif estimator.method == fm.EstimatorType.ANAT: + from sdcflows.workflows.fit.syn import init_syn_preprocessing_wf + sources = [str(s.path) for s in estimator.sources if s.suffix == "bold"] + layout = config.execution.layout + syn_preprocessing_wf = init_syn_preprocessing_wf( + omp_nthreads=config.nipype.omp_nthreads, + debug=config.execution.sloppy, + auto_bold_nss=True, + t1w_inversion=True, + name=f"syn_preprocessing_{estimator.bids_ids}", + ) + syn_preprocessing_wf.inputs.inputnode.in_epis = sources + syn_preprocessing_wf.inputs.inputnode.in_meta = [ + layout.get_metadata(s) for s in sources + ] + + # fmt:off + workflow.connect([ + (anat_preproc_wf, syn_preprocessing_wf, [ + ("outputnode.t1w_preproc", "inputnode.in_anat"), + ("outputnode.t1w_mask", "inputnode.mask_anat"), + ("outputnode.std2anat_xfm", "inputnode.std2anat_xfm"), + ]), + (syn_preprocessing_wf, fmap_wf, [ + ("outputnode.epi_ref", f"in_{estimator.bids_id}.epi_ref"), + ("outputnode.epi_mask", f"in_{estimator.bids_id}.epi_mask"), + ("outputnode.anat_ref", f"in_{estimator.bids_id}.anat_ref"), + ("outputnode.anat_mask", f"in_{estimator.bids_id}.anat_mask"), + ("outputnode.sd_prior", f"in_{estimator.bids_id}.sd_prior"), + ]), + ]) + # fmt:on return workflow From 52f7eb5a6bee50d8c5bb8349b38540d3327b2081 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Fri, 10 Sep 2021 13:01:24 -0400 Subject: [PATCH 02/21] FIX: Make sure variables exist before referencing --- fmriprep/workflows/base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fmriprep/workflows/base.py b/fmriprep/workflows/base.py index 7abfa970f..47643ac7d 100644 --- a/fmriprep/workflows/base.py +++ b/fmriprep/workflows/base.py @@ -311,6 +311,7 @@ def init_single_subject_wf(subject_id): if anat_only: return workflow + from sdcflows import fieldmaps as fm fmap_estimators = None if any(("fieldmaps" not in config.workflow.ignore, @@ -380,7 +381,6 @@ def init_single_subject_wf(subject_id): return workflow from sdcflows.workflows.base import init_fmap_preproc_wf - from sdcflows import fieldmaps as fm fmap_wf = init_fmap_preproc_wf( debug="fieldmaps" in config.execution.debug, @@ -446,7 +446,7 @@ def init_single_subject_wf(subject_id): debug=config.execution.sloppy, auto_bold_nss=True, t1w_inversion=True, - name=f"syn_preprocessing_{estimator.bids_ids}", + name=f"syn_preprocessing_{estimator.bids_id}", ) syn_preprocessing_wf.inputs.inputnode.in_epis = sources syn_preprocessing_wf.inputs.inputnode.in_meta = [ From fbc8b90d865ffffab2f526e2f6bb576c38b8da9d Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Fri, 10 Sep 2021 16:21:52 -0400 Subject: [PATCH 03/21] FIX: Pass imputed metadata to syn_preprocessing and unwarp --- fmriprep/workflows/base.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/fmriprep/workflows/base.py b/fmriprep/workflows/base.py index 47643ac7d..f68adf4cf 100644 --- a/fmriprep/workflows/base.py +++ b/fmriprep/workflows/base.py @@ -440,7 +440,7 @@ def init_single_subject_wf(subject_id): elif estimator.method == fm.EstimatorType.ANAT: from sdcflows.workflows.fit.syn import init_syn_preprocessing_wf sources = [str(s.path) for s in estimator.sources if s.suffix == "bold"] - layout = config.execution.layout + source_meta = [s.metadata for s in estimator.sources if s.suffix == "bold"] syn_preprocessing_wf = init_syn_preprocessing_wf( omp_nthreads=config.nipype.omp_nthreads, debug=config.execution.sloppy, @@ -449,9 +449,7 @@ def init_single_subject_wf(subject_id): name=f"syn_preprocessing_{estimator.bids_id}", ) syn_preprocessing_wf.inputs.inputnode.in_epis = sources - syn_preprocessing_wf.inputs.inputnode.in_meta = [ - layout.get_metadata(s) for s in sources - ] + syn_preprocessing_wf.inputs.inputnode.in_meta = source_meta # fmt:off workflow.connect([ @@ -470,6 +468,14 @@ def init_single_subject_wf(subject_id): ]) # fmt:on + # TotalReadoutTime is calculated or imputed by find_estimators + # Use enhanced metadata for SyN-SDC + from .bold.base import _get_wf_name + for func_preproc_wf in func_preproc_wfs: + for source, meta in zip(sources, source_meta): + if func_preproc_wf.name == _get_wf_name(source): + func_preproc_wf.inputs.unwarp_wf.inputnode.metadata = meta + return workflow From 5936720c386e36045de80b22d1b1875370b9426a Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Tue, 14 Sep 2021 14:44:36 -0400 Subject: [PATCH 04/21] ENH: Fail if SyN is requested but cannot be run --- fmriprep/workflows/base.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fmriprep/workflows/base.py b/fmriprep/workflows/base.py index f68adf4cf..f2016da18 100644 --- a/fmriprep/workflows/base.py +++ b/fmriprep/workflows/base.py @@ -328,6 +328,13 @@ def init_single_subject_wf(subject_id): force_fmapless=config.workflow.force_syn, ) + if config.workflow.use_syn_sdc and not fmap_estimators: + message = ("Fieldmap-less (SyN) estimation was requested, but " + "PhaseEncodingDirection information appears to be " + "absent.") + config.loggers.workflow.error(message) + raise ValueError(message) + config.loggers.workflow.debug( f"{len(fmap_estimators)} fieldmap estimators found: " f"{[e.method for e in fmap_estimators]}" From f9f9c8578efc464f5ac9aeec91a4f357c72689a3 Mon Sep 17 00:00:00 2001 From: Oscar Esteban Date: Wed, 15 Sep 2021 17:34:56 +0200 Subject: [PATCH 05/21] enh: update workflows to account for new resampling **multi-echo not yet covered!!!!** --- fmriprep/workflows/bold/base.py | 1 - 1 file changed, 1 deletion(-) diff --git a/fmriprep/workflows/bold/base.py b/fmriprep/workflows/bold/base.py index d0af5772c..8ebac9707 100644 --- a/fmriprep/workflows/bold/base.py +++ b/fmriprep/workflows/bold/base.py @@ -1101,7 +1101,6 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False): (("outputnode.fieldwarp", _pop), "inputnode.fieldwarp"), ]), (unwarp_wf, bold_final, [("outputnode.corrected", "bold")]), - ]) # fmt:on From a4878e237dc89e5a38bf4fa10e22fb9de07baddc Mon Sep 17 00:00:00 2001 From: Oscar Esteban Date: Thu, 23 Sep 2021 11:27:45 +0200 Subject: [PATCH 06/21] pin: sdcflows on feature branch --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 1a7e8ae3f..86ddca685 100644 --- a/setup.cfg +++ b/setup.cfg @@ -31,7 +31,7 @@ install_requires = psutil >= 5.4 pybids >= 0.12.1 requests - sdcflows @ git+https://github.com/nipreps/sdcflows.git@master + sdcflows @ git+https://github.com/nipreps/sdcflows.git@fix/syn-revision smriprep ~= 0.8.0 tedana ~= 0.0.9 templateflow >= 0.6 From 51dfcb2f61492ab025903c2c37c124b54680527c Mon Sep 17 00:00:00 2001 From: Oscar Esteban Date: Fri, 1 Oct 2021 10:33:05 +0200 Subject: [PATCH 07/21] fix: fieldmapless tripped when several std spaces are available --- fmriprep/workflows/base.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/fmriprep/workflows/base.py b/fmriprep/workflows/base.py index f2016da18..58f24db39 100644 --- a/fmriprep/workflows/base.py +++ b/fmriprep/workflows/base.py @@ -445,7 +445,9 @@ def init_single_subject_wf(subject_id): ) elif estimator.method == fm.EstimatorType.ANAT: + from niworkflows.interfaces.utility import KeySelect from sdcflows.workflows.fit.syn import init_syn_preprocessing_wf + sources = [str(s.path) for s in estimator.sources if s.suffix == "bold"] source_meta = [s.metadata for s in estimator.sources if s.suffix == "bold"] syn_preprocessing_wf = init_syn_preprocessing_wf( @@ -458,12 +460,24 @@ def init_single_subject_wf(subject_id): syn_preprocessing_wf.inputs.inputnode.in_epis = sources syn_preprocessing_wf.inputs.inputnode.in_meta = source_meta + # Select "MNI152NLin2009cAsym" from standard references. + fmap_select_std = pe.Node( + KeySelect(fields=["std2anat_xfm"], key="MNI152NLin2009cAsym"), + name="fmap_select_std", + run_without_submitting=True, + ) + # fmt:off workflow.connect([ + (anat_preproc_wf, fmap_select_std, [ + ("outputnode.std2anat_xfm", "std2anat_xfm"), + ("outputnode.template", "keys")]), (anat_preproc_wf, syn_preprocessing_wf, [ ("outputnode.t1w_preproc", "inputnode.in_anat"), ("outputnode.t1w_mask", "inputnode.mask_anat"), - ("outputnode.std2anat_xfm", "inputnode.std2anat_xfm"), + ]), + (fmap_select_std, syn_preprocessing_wf, [ + ("std2anat_xfm", "inputnode.std2anat_xfm"), ]), (syn_preprocessing_wf, fmap_wf, [ ("outputnode.epi_ref", f"in_{estimator.bids_id}.epi_ref"), From 5a922d1270f0158ffc4eef7485fbd1981acdbea4 Mon Sep 17 00:00:00 2001 From: Oscar Esteban Date: Wed, 6 Oct 2021 16:57:44 +0200 Subject: [PATCH 08/21] enh: better integration of *SDCFlows*' unwarping This PR builds on top of #2547, unifying the final BOLDref computation. --- fmriprep/workflows/bold/base.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fmriprep/workflows/bold/base.py b/fmriprep/workflows/bold/base.py index 8ebac9707..acf68961a 100644 --- a/fmriprep/workflows/bold/base.py +++ b/fmriprep/workflows/bold/base.py @@ -628,6 +628,9 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False): (inputnode, func_derivatives_wf, [("bold_file", "inputnode.source_file")]), (bold_split, bold_t1_trans_wf, [("out_files", "inputnode.bold_split")]), (bold_hmc_wf, bold_t1_trans_wf, [("outputnode.xforms", "inputnode.hmc_xforms")]), + (final_boldref_wf, bold_final, [ + ("outputnode.ref_image", "boldref"), + ]), ]) # fmt:on else: # for meepi, use optimal combination From 49ca92a08e6183c67efe7ca9108c9a56fba31d05 Mon Sep 17 00:00:00 2001 From: Oscar Esteban Date: Wed, 6 Oct 2021 19:12:13 +0200 Subject: [PATCH 09/21] enh: remove unnecessary setting --- fmriprep/workflows/base.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/fmriprep/workflows/base.py b/fmriprep/workflows/base.py index 58f24db39..073b64523 100644 --- a/fmriprep/workflows/base.py +++ b/fmriprep/workflows/base.py @@ -488,15 +488,6 @@ def init_single_subject_wf(subject_id): ]), ]) # fmt:on - - # TotalReadoutTime is calculated or imputed by find_estimators - # Use enhanced metadata for SyN-SDC - from .bold.base import _get_wf_name - for func_preproc_wf in func_preproc_wfs: - for source, meta in zip(sources, source_meta): - if func_preproc_wf.name == _get_wf_name(source): - func_preproc_wf.inputs.unwarp_wf.inputnode.metadata = meta - return workflow From a3bab644d6647e1121525a9c1f536088d496c5e0 Mon Sep 17 00:00:00 2001 From: Oscar Esteban Date: Thu, 7 Oct 2021 15:36:17 +0200 Subject: [PATCH 10/21] fix: sloppy merge with master --- fmriprep/workflows/bold/base.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/fmriprep/workflows/bold/base.py b/fmriprep/workflows/bold/base.py index acf68961a..8ebac9707 100644 --- a/fmriprep/workflows/bold/base.py +++ b/fmriprep/workflows/bold/base.py @@ -628,9 +628,6 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False): (inputnode, func_derivatives_wf, [("bold_file", "inputnode.source_file")]), (bold_split, bold_t1_trans_wf, [("out_files", "inputnode.bold_split")]), (bold_hmc_wf, bold_t1_trans_wf, [("outputnode.xforms", "inputnode.hmc_xforms")]), - (final_boldref_wf, bold_final, [ - ("outputnode.ref_image", "boldref"), - ]), ]) # fmt:on else: # for meepi, use optimal combination From 5b3b39dd5f5c55bec4f9bc6a6e69567b589e3e50 Mon Sep 17 00:00:00 2001 From: Oscar Esteban Date: Thu, 7 Oct 2021 15:37:54 +0200 Subject: [PATCH 11/21] maint: update sdcflows dependency link pin --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 86ddca685..1a7e8ae3f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -31,7 +31,7 @@ install_requires = psutil >= 5.4 pybids >= 0.12.1 requests - sdcflows @ git+https://github.com/nipreps/sdcflows.git@fix/syn-revision + sdcflows @ git+https://github.com/nipreps/sdcflows.git@master smriprep ~= 0.8.0 tedana ~= 0.0.9 templateflow >= 0.6 From 60f17b22359654ae96f8b99934dd504e02e5fab4 Mon Sep 17 00:00:00 2001 From: Oscar Esteban Date: Mon, 18 Oct 2021 21:25:43 +0200 Subject: [PATCH 12/21] fix: set T1w inversion flag to ``False`` Co-authored-by: Chris Markiewicz Co-authored-by: Mathias Goncalves --- fmriprep/workflows/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fmriprep/workflows/base.py b/fmriprep/workflows/base.py index 073b64523..7d0553b95 100644 --- a/fmriprep/workflows/base.py +++ b/fmriprep/workflows/base.py @@ -454,7 +454,7 @@ def init_single_subject_wf(subject_id): omp_nthreads=config.nipype.omp_nthreads, debug=config.execution.sloppy, auto_bold_nss=True, - t1w_inversion=True, + t1w_inversion=False, name=f"syn_preprocessing_{estimator.bids_id}", ) syn_preprocessing_wf.inputs.inputnode.in_epis = sources From 9de0ac68397abf3c92f5e8c6085f27f7afc61099 Mon Sep 17 00:00:00 2001 From: Oscar Esteban Date: Mon, 18 Oct 2021 21:49:19 +0200 Subject: [PATCH 13/21] enh: inject pretend PE metadata in CircleCI tests --- .circleci/config.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 00ebd7c58..e61d756cb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -478,6 +478,12 @@ jobs: paths: - /tmp/ds005/work + - run: + name: Attempt run without PE metadata (should fail) + no_output_timeout: 2h + command: | + echo "TODO" + - run: name: Run full fMRIPrep on ds005 (LegacyMultiProc plugin) no_output_timeout: 2h @@ -486,6 +492,15 @@ jobs: if [ -f /tmp/.nofasttrack ]; then FASTRACK_ARG="" fi + + # Inject pretend metadata + echo '{"PhaseEncodingDirection": "j"}' >> /tmp/data/${DATASET}/bold.json + + # REMOVE in case the above works out + # json_sidecar=/tmp/data/${DATASET}/task-mixedgamblestask_bold.json + # awk 'NR==1{print; print " \"TotalReadoutTime\": 0.05,"} NR!=1' ${json_sidecar} > tmp && mv tmp ${json_sidecar} + # awk 'NR==1{print; print " \"PhaseEncodingDirection\": \"j\","} NR!=1' ${json_sidecar} > tmp && mv tmp ${json_sidecar} + fmriprep-docker -i nipreps/fmriprep:latest \ -e FMRIPREP_DEV 1 --user $(id -u):$(id -g) \ --network none \ @@ -879,6 +894,12 @@ jobs: paths: - /tmp/ds210/work + - run: + name: Attempt run without PE metadata (should fail) + no_output_timeout: 2h + command: | + echo "TODO" + - run: name: Run full fMRIPrep on ds000210 no_output_timeout: 2h @@ -887,6 +908,11 @@ jobs: if [ -f /tmp/.nofasttrack ]; then FASTRACK_ARG="" fi + + # Inject pretend metadata for SDCFlows not to crash + # TODO / open question - do all echos need the metadata? + echo '{"PhaseEncodingDirection": "j"}' >> /tmp/data/${DATASET}/task-cuedSGT_bold.json + fmriprep-docker -i nipreps/fmriprep:latest \ -e FMRIPREP_DEV 1 --user $(id -u):$(id -g) \ --config $PWD/nipype.cfg -w /tmp/${DATASET}/work \ From 283a3d5ffb272a406076174f9d500158bbd09f25 Mon Sep 17 00:00:00 2001 From: Oscar Esteban Date: Mon, 18 Oct 2021 22:50:39 +0200 Subject: [PATCH 14/21] fix: circleci tests failed for spurious reasons --- .circleci/config.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e61d756cb..2c88ec50b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -494,12 +494,9 @@ jobs: fi # Inject pretend metadata - echo '{"PhaseEncodingDirection": "j"}' >> /tmp/data/${DATASET}/bold.json - - # REMOVE in case the above works out - # json_sidecar=/tmp/data/${DATASET}/task-mixedgamblestask_bold.json - # awk 'NR==1{print; print " \"TotalReadoutTime\": 0.05,"} NR!=1' ${json_sidecar} > tmp && mv tmp ${json_sidecar} - # awk 'NR==1{print; print " \"PhaseEncodingDirection\": \"j\","} NR!=1' ${json_sidecar} > tmp && mv tmp ${json_sidecar} + json_sidecar=/tmp/data/${DATASET}/task-mixedgamblestask_bold.json + awk 'NR==1{print; print " \"TotalReadoutTime\": 0.05,"} NR!=1' ${json_sidecar} > tmp && mv tmp ${json_sidecar} + awk 'NR==1{print; print " \"PhaseEncodingDirection\": \"j\","} NR!=1' ${json_sidecar} > tmp && mv tmp ${json_sidecar} fmriprep-docker -i nipreps/fmriprep:latest \ -e FMRIPREP_DEV 1 --user $(id -u):$(id -g) \ @@ -911,7 +908,9 @@ jobs: # Inject pretend metadata for SDCFlows not to crash # TODO / open question - do all echos need the metadata? + chmod +w /tmp/data/${DATASET} echo '{"PhaseEncodingDirection": "j"}' >> /tmp/data/${DATASET}/task-cuedSGT_bold.json + chmod -R -w /tmp/data/${DATASET} fmriprep-docker -i nipreps/fmriprep:latest \ -e FMRIPREP_DEV 1 --user $(id -u):$(id -g) \ From b2c27ab60fee12b8ed5f21c301d77a5f727e1bba Mon Sep 17 00:00:00 2001 From: Oscar Esteban Date: Tue, 19 Oct 2021 09:39:56 +0200 Subject: [PATCH 15/21] fix: update ds005's ouputs listings with new outputs --- .circleci/ds005_bids_fasttrack_outputs.txt | 6 ++++++ .circleci/ds005_bids_outputs.txt | 6 ++++++ .circleci/ds005_legacy_fasttrack_outputs.txt | 6 ++++++ .circleci/ds005_legacy_outputs.txt | 6 ++++++ .circleci/ds005_legacy_partial_fasttrack_outputs.txt | 6 ++++++ .circleci/ds005_legacy_partial_outputs.txt | 6 ++++++ 6 files changed, 36 insertions(+) diff --git a/.circleci/ds005_bids_fasttrack_outputs.txt b/.circleci/ds005_bids_fasttrack_outputs.txt index f45fd93ac..5a6a8e982 100644 --- a/.circleci/ds005_bids_fasttrack_outputs.txt +++ b/.circleci/ds005_bids_fasttrack_outputs.txt @@ -9,6 +9,12 @@ bids/logs/CITATION.html bids/logs/CITATION.md bids/logs/CITATION.tex bids/sub-01 +bids/sub-01/fmap +bids/sub-01/fmap/sub-01_fmapid-auto00000_desc-coeff0_fieldmap.nii.gz +bids/sub-01/fmap/sub-01_fmapid-auto00000_desc-coeff1_fieldmap.nii.gz +bids/sub-01/fmap/sub-01_fmapid-auto00000_desc-magnitude_fieldmap.nii.gz +bids/sub-01/fmap/sub-01_fmapid-auto00000_desc-preproc_fieldmap.json +bids/sub-01/fmap/sub-01_fmapid-auto00000_desc-preproc_fieldmap.nii.gz bids/sub-01/func bids/sub-01/func/sub-01_task-mixedgamblestask_run-1_desc-confounds_timeseries.json bids/sub-01/func/sub-01_task-mixedgamblestask_run-1_desc-confounds_timeseries.tsv diff --git a/.circleci/ds005_bids_outputs.txt b/.circleci/ds005_bids_outputs.txt index ac4d943ce..c7db60bcd 100644 --- a/.circleci/ds005_bids_outputs.txt +++ b/.circleci/ds005_bids_outputs.txt @@ -40,6 +40,12 @@ bids/sub-01/anat/sub-01_space-MNI152NLin2009cAsym_dseg.nii.gz bids/sub-01/anat/sub-01_space-MNI152NLin2009cAsym_label-CSF_probseg.nii.gz bids/sub-01/anat/sub-01_space-MNI152NLin2009cAsym_label-GM_probseg.nii.gz bids/sub-01/anat/sub-01_space-MNI152NLin2009cAsym_label-WM_probseg.nii.gz +bids/sub-01/fmap +bids/sub-01/fmap/sub-01_fmapid-auto00000_desc-coeff0_fieldmap.nii.gz +bids/sub-01/fmap/sub-01_fmapid-auto00000_desc-coeff1_fieldmap.nii.gz +bids/sub-01/fmap/sub-01_fmapid-auto00000_desc-magnitude_fieldmap.nii.gz +bids/sub-01/fmap/sub-01_fmapid-auto00000_desc-preproc_fieldmap.json +bids/sub-01/fmap/sub-01_fmapid-auto00000_desc-preproc_fieldmap.nii.gz bids/sub-01/func bids/sub-01/func/sub-01_task-mixedgamblestask_run-1_desc-confounds_timeseries.json bids/sub-01/func/sub-01_task-mixedgamblestask_run-1_desc-confounds_timeseries.tsv diff --git a/.circleci/ds005_legacy_fasttrack_outputs.txt b/.circleci/ds005_legacy_fasttrack_outputs.txt index 8ba8bfd88..9f1db0804 100644 --- a/.circleci/ds005_legacy_fasttrack_outputs.txt +++ b/.circleci/ds005_legacy_fasttrack_outputs.txt @@ -9,6 +9,12 @@ fmriprep/logs/CITATION.html fmriprep/logs/CITATION.md fmriprep/logs/CITATION.tex fmriprep/sub-01 +fmriprep/sub-01/fmap +fmriprep/sub-01/fmap/sub-01_fmapid-auto00000_desc-coeff0_fieldmap.nii.gz +fmriprep/sub-01/fmap/sub-01_fmapid-auto00000_desc-coeff1_fieldmap.nii.gz +fmriprep/sub-01/fmap/sub-01_fmapid-auto00000_desc-magnitude_fieldmap.nii.gz +fmriprep/sub-01/fmap/sub-01_fmapid-auto00000_desc-preproc_fieldmap.json +fmriprep/sub-01/fmap/sub-01_fmapid-auto00000_desc-preproc_fieldmap.nii.gz fmriprep/sub-01/func fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-1_AROMAnoiseICs.csv fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-1_desc-confounds_timeseries.json diff --git a/.circleci/ds005_legacy_outputs.txt b/.circleci/ds005_legacy_outputs.txt index 18016f826..82901dc59 100644 --- a/.circleci/ds005_legacy_outputs.txt +++ b/.circleci/ds005_legacy_outputs.txt @@ -50,6 +50,12 @@ fmriprep/sub-01/anat/sub-01_space-MNI152NLin6Asym_dseg.nii.gz fmriprep/sub-01/anat/sub-01_space-MNI152NLin6Asym_label-CSF_probseg.nii.gz fmriprep/sub-01/anat/sub-01_space-MNI152NLin6Asym_label-GM_probseg.nii.gz fmriprep/sub-01/anat/sub-01_space-MNI152NLin6Asym_label-WM_probseg.nii.gz +fmriprep/sub-01/fmap +fmriprep/sub-01/fmap/sub-01_fmapid-auto00000_desc-coeff0_fieldmap.nii.gz +fmriprep/sub-01/fmap/sub-01_fmapid-auto00000_desc-coeff1_fieldmap.nii.gz +fmriprep/sub-01/fmap/sub-01_fmapid-auto00000_desc-magnitude_fieldmap.nii.gz +fmriprep/sub-01/fmap/sub-01_fmapid-auto00000_desc-preproc_fieldmap.json +fmriprep/sub-01/fmap/sub-01_fmapid-auto00000_desc-preproc_fieldmap.nii.gz fmriprep/sub-01/func fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-1_AROMAnoiseICs.csv fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-1_desc-confounds_timeseries.json diff --git a/.circleci/ds005_legacy_partial_fasttrack_outputs.txt b/.circleci/ds005_legacy_partial_fasttrack_outputs.txt index 65e965a78..095256f05 100644 --- a/.circleci/ds005_legacy_partial_fasttrack_outputs.txt +++ b/.circleci/ds005_legacy_partial_fasttrack_outputs.txt @@ -9,6 +9,12 @@ fmriprep/logs/CITATION.html fmriprep/logs/CITATION.md fmriprep/logs/CITATION.tex fmriprep/sub-01 +fmriprep/sub-01/fmap +fmriprep/sub-01/fmap/sub-01_fmapid-auto00000_desc-coeff0_fieldmap.nii.gz +fmriprep/sub-01/fmap/sub-01_fmapid-auto00000_desc-coeff1_fieldmap.nii.gz +fmriprep/sub-01/fmap/sub-01_fmapid-auto00000_desc-magnitude_fieldmap.nii.gz +fmriprep/sub-01/fmap/sub-01_fmapid-auto00000_desc-preproc_fieldmap.json +fmriprep/sub-01/fmap/sub-01_fmapid-auto00000_desc-preproc_fieldmap.nii.gz fmriprep/sub-01/func fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-2_AROMAnoiseICs.csv fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-2_desc-confounds_timeseries.json diff --git a/.circleci/ds005_legacy_partial_outputs.txt b/.circleci/ds005_legacy_partial_outputs.txt index 6456fc15f..c98d4e6c7 100644 --- a/.circleci/ds005_legacy_partial_outputs.txt +++ b/.circleci/ds005_legacy_partial_outputs.txt @@ -50,6 +50,12 @@ fmriprep/sub-01/anat/sub-01_space-MNI152NLin6Asym_dseg.nii.gz fmriprep/sub-01/anat/sub-01_space-MNI152NLin6Asym_label-CSF_probseg.nii.gz fmriprep/sub-01/anat/sub-01_space-MNI152NLin6Asym_label-GM_probseg.nii.gz fmriprep/sub-01/anat/sub-01_space-MNI152NLin6Asym_label-WM_probseg.nii.gz +fmriprep/sub-01/fmap +fmriprep/sub-01/fmap/sub-01_fmapid-auto00000_desc-coeff0_fieldmap.nii.gz +fmriprep/sub-01/fmap/sub-01_fmapid-auto00000_desc-coeff1_fieldmap.nii.gz +fmriprep/sub-01/fmap/sub-01_fmapid-auto00000_desc-magnitude_fieldmap.nii.gz +fmriprep/sub-01/fmap/sub-01_fmapid-auto00000_desc-preproc_fieldmap.json +fmriprep/sub-01/fmap/sub-01_fmapid-auto00000_desc-preproc_fieldmap.nii.gz fmriprep/sub-01/func fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_AROMAnoiseICs.csv fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_desc-confounds_timeseries.json From 215770c100e4f7b59e1d1e783af83e4903d14346 Mon Sep 17 00:00:00 2001 From: Oscar Esteban Date: Tue, 19 Oct 2021 09:41:05 +0200 Subject: [PATCH 16/21] fix: update ds210's ouputs listings with new outputs --- .circleci/ds210_fasttrack_outputs.txt | 6 ++++++ .circleci/ds210_outputs.txt | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/.circleci/ds210_fasttrack_outputs.txt b/.circleci/ds210_fasttrack_outputs.txt index d40943dc2..2704fc507 100644 --- a/.circleci/ds210_fasttrack_outputs.txt +++ b/.circleci/ds210_fasttrack_outputs.txt @@ -7,6 +7,12 @@ fmriprep/logs/CITATION.html fmriprep/logs/CITATION.md fmriprep/logs/CITATION.tex fmriprep/sub-02 +fmriprep/sub-02/fmap +fmriprep/sub-02/fmap/sub-02_run-1_fmapid-auto00000_desc-coeff0_fieldmap.nii.gz +fmriprep/sub-02/fmap/sub-02_run-1_fmapid-auto00000_desc-coeff1_fieldmap.nii.gz +fmriprep/sub-02/fmap/sub-02_run-1_fmapid-auto00000_desc-magnitude_fieldmap.nii.gz +fmriprep/sub-02/fmap/sub-02_run-1_fmapid-auto00000_desc-preproc_fieldmap.json +fmriprep/sub-02/fmap/sub-02_run-1_fmapid-auto00000_desc-preproc_fieldmap.nii.gz fmriprep/sub-02/func fmriprep/sub-02/func/sub-02_task-cuedSGT_run-1_desc-confounds_timeseries.json fmriprep/sub-02/func/sub-02_task-cuedSGT_run-1_desc-confounds_timeseries.tsv diff --git a/.circleci/ds210_outputs.txt b/.circleci/ds210_outputs.txt index aa9ea6b18..b2a31e7bf 100644 --- a/.circleci/ds210_outputs.txt +++ b/.circleci/ds210_outputs.txt @@ -26,6 +26,12 @@ fmriprep/sub-02/anat/sub-02_space-MNI152NLin2009cAsym_dseg.nii.gz fmriprep/sub-02/anat/sub-02_space-MNI152NLin2009cAsym_label-CSF_probseg.nii.gz fmriprep/sub-02/anat/sub-02_space-MNI152NLin2009cAsym_label-GM_probseg.nii.gz fmriprep/sub-02/anat/sub-02_space-MNI152NLin2009cAsym_label-WM_probseg.nii.gz +fmriprep/sub-02/fmap +fmriprep/sub-02/fmap/sub-02_run-1_fmapid-auto00000_desc-coeff0_fieldmap.nii.gz +fmriprep/sub-02/fmap/sub-02_run-1_fmapid-auto00000_desc-coeff1_fieldmap.nii.gz +fmriprep/sub-02/fmap/sub-02_run-1_fmapid-auto00000_desc-magnitude_fieldmap.nii.gz +fmriprep/sub-02/fmap/sub-02_run-1_fmapid-auto00000_desc-preproc_fieldmap.json +fmriprep/sub-02/fmap/sub-02_run-1_fmapid-auto00000_desc-preproc_fieldmap.nii.gz fmriprep/sub-02/func fmriprep/sub-02/func/sub-02_task-cuedSGT_run-1_desc-confounds_timeseries.json fmriprep/sub-02/func/sub-02_task-cuedSGT_run-1_desc-confounds_timeseries.tsv From 47c947d033c363e928ba5de3cbcd8530d670fe08 Mon Sep 17 00:00:00 2001 From: Oscar Esteban Date: Tue, 19 Oct 2021 12:01:28 +0200 Subject: [PATCH 17/21] fix: ensure the ME pathway does not crash at workflow build-time --- fmriprep/workflows/base.py | 26 +++++++++++++++++--------- fmriprep/workflows/bold/base.py | 12 ++++++++---- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/fmriprep/workflows/base.py b/fmriprep/workflows/base.py index 7d0553b95..c45cca4b3 100644 --- a/fmriprep/workflows/base.py +++ b/fmriprep/workflows/base.py @@ -335,17 +335,23 @@ def init_single_subject_wf(subject_id): config.loggers.workflow.error(message) raise ValueError(message) - config.loggers.workflow.debug( - f"{len(fmap_estimators)} fieldmap estimators found: " - f"{[e.method for e in fmap_estimators]}" - ) - - if "fieldmaps" in config.workflow.ignore: + if ( + "fieldmaps" in config.workflow.ignore + and [f for f in fmap_estimators + if f.method != fm.EstimatorType.ANAT] + ): + config.loggers.workflow.info( + 'Option "--ignore fieldmaps" was set, but either "--use-syn-sdc" ' + 'or "--force-syn" were given, so fieldmap-less estimation will be executed.' + ) fmap_estimators = [f for f in fmap_estimators if f.method == fm.EstimatorType.ANAT] - config.loggers.workflow.debug( - "Ignoring fieldmap scans, using anatomical estimators: " - f"{[e.method for e in fmap_estimators]}" + + if fmap_estimators: + config.loggers.workflow.info( + "B0 field inhomogeneity map will be estimated with " + f" the following {len(fmap_estimators)} estimators: " + f"{[e.method for e in fmap_estimators]}." ) # Append the functional section to the existing anatomical exerpt @@ -426,6 +432,8 @@ def init_single_subject_wf(subject_id): config.loggers.workflow.info(f"""\ Setting-up fieldmap "{estimator.bids_id}" ({estimator.method}) with \ <{', '.join(s.path.name for s in estimator.sources)}>""") + + # Mapped and phasediff can be connected internally by SDCFlows if estimator.method in (fm.EstimatorType.MAPPED, fm.EstimatorType.PHASEDIFF): continue diff --git a/fmriprep/workflows/bold/base.py b/fmriprep/workflows/bold/base.py index 8ebac9707..246ca16c7 100644 --- a/fmriprep/workflows/bold/base.py +++ b/fmriprep/workflows/bold/base.py @@ -252,15 +252,19 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False): from sdcflows.fieldmaps import get_identifier # Fallback to IntendedFor - bold_rel = re.sub( - r"^sub-[a-zA-Z0-9]*/", "", str(Path(bold_file).relative_to(layout.root)) + intended_rel = re.sub( + r"^sub-[a-zA-Z0-9]*/", + "", + str(Path( + bold_file if not multiecho else bold_file[0] + ).relative_to(layout.root)) ) - estimator_key = get_identifier(bold_rel) + estimator_key = get_identifier(intended_rel) if not estimator_key: has_fieldmap = False config.loggers.workflow.critical( - f"None of the available B0 fieldmaps are associated to <{bold_rel}>" + f"None of the available B0 fieldmaps are associated to <{bold_file}>" ) else: config.loggers.workflow.info(f"Found usable B0 fieldmap <{estimator_key}>") From dc45b4a9d78872cf5f8ff8f0c3dea1638eb767f6 Mon Sep 17 00:00:00 2001 From: Oscar Esteban Date: Wed, 20 Oct 2021 09:36:09 +0200 Subject: [PATCH 18/21] fix: errors in naming of ds005 outputs --- .circleci/ds005_legacy_partial_fasttrack_outputs.txt | 10 +++++----- .circleci/ds005_legacy_partial_outputs.txt | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.circleci/ds005_legacy_partial_fasttrack_outputs.txt b/.circleci/ds005_legacy_partial_fasttrack_outputs.txt index 095256f05..bdf7a0360 100644 --- a/.circleci/ds005_legacy_partial_fasttrack_outputs.txt +++ b/.circleci/ds005_legacy_partial_fasttrack_outputs.txt @@ -10,11 +10,11 @@ fmriprep/logs/CITATION.md fmriprep/logs/CITATION.tex fmriprep/sub-01 fmriprep/sub-01/fmap -fmriprep/sub-01/fmap/sub-01_fmapid-auto00000_desc-coeff0_fieldmap.nii.gz -fmriprep/sub-01/fmap/sub-01_fmapid-auto00000_desc-coeff1_fieldmap.nii.gz -fmriprep/sub-01/fmap/sub-01_fmapid-auto00000_desc-magnitude_fieldmap.nii.gz -fmriprep/sub-01/fmap/sub-01_fmapid-auto00000_desc-preproc_fieldmap.json -fmriprep/sub-01/fmap/sub-01_fmapid-auto00000_desc-preproc_fieldmap.nii.gz +fmriprep/sub-01/fmap/sub-01_run-2_fmapid-auto00000_desc-coeff0_fieldmap.nii.gz +fmriprep/sub-01/fmap/sub-01_run-2_fmapid-auto00000_desc-coeff1_fieldmap.nii.gz +fmriprep/sub-01/fmap/sub-01_run-2_fmapid-auto00000_desc-magnitude_fieldmap.nii.gz +fmriprep/sub-01/fmap/sub-01_run-2_fmapid-auto00000_desc-preproc_fieldmap.json +fmriprep/sub-01/fmap/sub-01_run-2_fmapid-auto00000_desc-preproc_fieldmap.nii.gz fmriprep/sub-01/func fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-2_AROMAnoiseICs.csv fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-2_desc-confounds_timeseries.json diff --git a/.circleci/ds005_legacy_partial_outputs.txt b/.circleci/ds005_legacy_partial_outputs.txt index c98d4e6c7..0f60c597e 100644 --- a/.circleci/ds005_legacy_partial_outputs.txt +++ b/.circleci/ds005_legacy_partial_outputs.txt @@ -51,11 +51,11 @@ fmriprep/sub-01/anat/sub-01_space-MNI152NLin6Asym_label-CSF_probseg.nii.gz fmriprep/sub-01/anat/sub-01_space-MNI152NLin6Asym_label-GM_probseg.nii.gz fmriprep/sub-01/anat/sub-01_space-MNI152NLin6Asym_label-WM_probseg.nii.gz fmriprep/sub-01/fmap -fmriprep/sub-01/fmap/sub-01_fmapid-auto00000_desc-coeff0_fieldmap.nii.gz -fmriprep/sub-01/fmap/sub-01_fmapid-auto00000_desc-coeff1_fieldmap.nii.gz -fmriprep/sub-01/fmap/sub-01_fmapid-auto00000_desc-magnitude_fieldmap.nii.gz -fmriprep/sub-01/fmap/sub-01_fmapid-auto00000_desc-preproc_fieldmap.json -fmriprep/sub-01/fmap/sub-01_fmapid-auto00000_desc-preproc_fieldmap.nii.gz +fmriprep/sub-01/fmap/sub-01_run-2_fmapid-auto00000_desc-coeff0_fieldmap.nii.gz +fmriprep/sub-01/fmap/sub-01_run-2_fmapid-auto00000_desc-coeff1_fieldmap.nii.gz +fmriprep/sub-01/fmap/sub-01_run-2_fmapid-auto00000_desc-magnitude_fieldmap.nii.gz +fmriprep/sub-01/fmap/sub-01_run-2_fmapid-auto00000_desc-preproc_fieldmap.json +fmriprep/sub-01/fmap/sub-01_run-2_fmapid-auto00000_desc-preproc_fieldmap.nii.gz fmriprep/sub-01/func fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_AROMAnoiseICs.csv fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_desc-confounds_timeseries.json From b9fbbdbf7533198d70ca363a6a305e4d8040d6fd Mon Sep 17 00:00:00 2001 From: Oscar Esteban Date: Wed, 20 Oct 2021 09:36:31 +0200 Subject: [PATCH 19/21] fix: multi-echo + SDC wiring issue --- fmriprep/workflows/bold/base.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/fmriprep/workflows/bold/base.py b/fmriprep/workflows/bold/base.py index 246ca16c7..fb7defcd8 100644 --- a/fmriprep/workflows/bold/base.py +++ b/fmriprep/workflows/bold/base.py @@ -267,7 +267,9 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False): f"None of the available B0 fieldmaps are associated to <{bold_file}>" ) else: - config.loggers.workflow.info(f"Found usable B0 fieldmap <{estimator_key}>") + config.loggers.workflow.info( + f"Found usable B0-map (fieldmap) estimator(s) <{', '.join(estimator_key)}> " + f"to correct <{bold_file}> for susceptibility-derived distortions.") # Check whether STC must/can be run run_stc = ( @@ -644,9 +646,6 @@ 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"), - ]), ]) # fmt:on @@ -1011,6 +1010,9 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False): (bold_bold_trans_wf, bold_t2s_wf, [ (("outputnode.bold_mask", pop_file), "inputnode.bold_mask"), ]), + (bold_t2s_wf, bold_final, [ + ("outputnode.bold", "bold"), + ]), ] ) # fmt:on From 5afadd3019cf051c9dab517017d93e64bf949193 Mon Sep 17 00:00:00 2001 From: Oscar Esteban Date: Fri, 22 Oct 2021 16:01:59 +0200 Subject: [PATCH 20/21] fix: address issue with metadata [skip ci] --- .circleci/config.yml | 2 +- fmriprep/workflows/bold/base.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b8607e141..1c892b83d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -893,7 +893,7 @@ jobs: # Inject pretend metadata for SDCFlows not to crash # TODO / open question - do all echos need the metadata? chmod +w /tmp/data/${DATASET} - echo '{"PhaseEncodingDirection": "j"}' >> /tmp/data/${DATASET}/task-cuedSGT_bold.json + echo '{"PhaseEncodingDirection": "j", "TotalReadoutTime": 0.058}' >> /tmp/data/${DATASET}/task-cuedSGT_bold.json chmod -R -w /tmp/data/${DATASET} fmriprep-docker -i nipreps/fmriprep:latest \ diff --git a/fmriprep/workflows/bold/base.py b/fmriprep/workflows/bold/base.py index 0e0709e07..982485139 100644 --- a/fmriprep/workflows/bold/base.py +++ b/fmriprep/workflows/bold/base.py @@ -1035,7 +1035,7 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False): debug="fieldmaps" in config.execution.debug, omp_nthreads=config.nipype.omp_nthreads, ) - unwarp_wf.inputs.inputnode.metadata = layout.get_metadata(str(bold_file)) + unwarp_wf.inputs.inputnode.metadata = metadata output_select = pe.Node( KeySelect(fields=["fmap", "fmap_ref", "fmap_coeff", "fmap_mask", "sdc_method"]), From bf68f50ca619ba7df3f2b0e7f690c627d979560b Mon Sep 17 00:00:00 2001 From: Oscar Esteban Date: Sat, 23 Oct 2021 23:10:44 +0200 Subject: [PATCH 21/21] fix: incorrect joinfield on new node --- fmriprep/workflows/bold/base.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/fmriprep/workflows/bold/base.py b/fmriprep/workflows/bold/base.py index 846aa7ab5..e88eb57e4 100644 --- a/fmriprep/workflows/bold/base.py +++ b/fmriprep/workflows/bold/base.py @@ -1145,7 +1145,13 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False): ] ), joinsource=("meepi_echos" if run_stc is True else "boldbuffer"), - joinfield=["bold_files"], + joinfield=[ + "fieldmap", + "fieldwarp", + "corrected", + "corrected_ref", + "corrected_mask", + ], name="join_sdc_echos", ) @@ -1169,7 +1175,7 @@ def _dpop(list_of_lists): ("corrected", "inputnode.bold_file"), ]), (join_sdc_echos, bold_t2s_wf, [ - ("corrected_mask", "inputnode.bold_mask"), + (("corrected_mask", pop_file), "inputnode.bold_mask"), ]), (join_sdc_echos, bold_t1_trans_wf, [ # TEMPORARY: For the moment we can't use frame-wise fieldmaps