Skip to content

Commit c294028

Browse files
authored
ENH: Restore resampling to surface GIFTIs (#3126)
## Changes proposed in this pull request This PR moves the datasinks for GIFTI files into the surface resampling workflow, and adds the resampling workflow to the main BOLD workflow. Previously we used these GIFTI files as intermediates for CIFTI, which required collation across multiple sub-workflows. With that now being done by other means, we have the opportunity to remove several metadata-collation nodes. We are also able to get rid of a `JoinNode` altogether, as iteration is all we need. This workflow might now belong in `workflows.bold.outputs`, but that would make the overall changes harder to assess. This builds on #3120. It also has a cleanup commit that removes portions of the derivatives workflow that have been reimplemented elsewhere.
2 parents 2e1a8c8 + c79464e commit c294028

File tree

3 files changed

+55
-445
lines changed

3 files changed

+55
-445
lines changed

fmriprep/workflows/bold/base.py

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,26 @@ def init_bold_wf(
442442
(bold_std_wf, ds_bold_std_wf, [('outputnode.bold_file', 'inputnode.bold')]),
443443
]) # fmt:skip
444444

445+
if config.workflow.run_reconall and freesurfer_spaces:
446+
config.loggers.workflow.debug("Creating BOLD surface-sampling workflow.")
447+
bold_surf_wf = init_bold_surf_wf(
448+
mem_gb=mem_gb["resampled"],
449+
surface_spaces=freesurfer_spaces,
450+
medial_surface_nan=config.workflow.medial_surface_nan,
451+
metadata=all_metadata[0],
452+
output_dir=fmriprep_dir,
453+
name="bold_surf_wf",
454+
)
455+
bold_surf_wf.inputs.inputnode.source_file = bold_file
456+
workflow.connect([
457+
(inputnode, bold_surf_wf, [
458+
("subjects_dir", "inputnode.subjects_dir"),
459+
("subject_id", "inputnode.subject_id"),
460+
("fsnative2t1w_xfm", "inputnode.fsnative2t1w_xfm"),
461+
]),
462+
(bold_anat_wf, bold_surf_wf, [("outputnode.bold_file", "inputnode.bold_t1w")]),
463+
]) # fmt:skip
464+
445465
bold_confounds_wf = init_bold_confs_wf(
446466
mem_gb=mem_gb["largemem"],
447467
metadata=all_metadata[0],
@@ -723,27 +743,6 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False):
723743
)
724744

725745
# SURFACES ##################################################################################
726-
# Freesurfer
727-
if freesurfer and freesurfer_spaces:
728-
config.loggers.workflow.debug("Creating BOLD surface-sampling workflow.")
729-
bold_surf_wf = init_bold_surf_wf(
730-
mem_gb=mem_gb["resampled"],
731-
surface_spaces=freesurfer_spaces,
732-
medial_surface_nan=config.workflow.medial_surface_nan,
733-
name="bold_surf_wf",
734-
)
735-
# fmt:off
736-
workflow.connect([
737-
(inputnode, bold_surf_wf, [
738-
("subjects_dir", "inputnode.subjects_dir"),
739-
("subject_id", "inputnode.subject_id"),
740-
("fsnative2t1w_xfm", "inputnode.fsnative2t1w_xfm"),
741-
]),
742-
(bold_t1_trans_wf, bold_surf_wf, [("outputnode.bold_t1", "inputnode.source_file")]),
743-
(bold_surf_wf, outputnode, [("outputnode.surfaces", "surfaces")]),
744-
(bold_surf_wf, func_derivatives_wf, [("outputnode.target", "inputnode.surf_refs")]),
745-
])
746-
# fmt:on
747746

748747
# CIFTI output
749748
if config.workflow.cifti_output:

0 commit comments

Comments
 (0)