Skip to content

Commit 0ee693f

Browse files
committed
enh: advancing with the integration
1 parent 69e7efc commit 0ee693f

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

dmriprep/workflows/base.py

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -424,28 +424,33 @@ def init_single_subject_wf(subject_id):
424424
)
425425

426426
if estimator.method == fm.EstimatorType.ANAT:
427+
from niworkflows.utils.connections import pop_file as _pop
427428
from sdcflows.interfaces.brainmask import BrainExtraction
428429
from sdcflows.workflows.fit.syn import init_syn_preprocessing_wf
429-
from ...interfaces.vectors import CheckGradientTable
430+
from ..interfaces.vectors import CheckGradientTable
430431

431-
sources = [str(s.path) for s in estimator.sources]
432+
sources = [
433+
str(s.path) for s in estimator.sources
434+
if s.suffix in ("dwi",)
435+
]
432436
layout = config.execution.layout
433437
syn_preprocessing_wf = init_syn_preprocessing_wf(
434438
omp_nthreads=config.nipype.omp_nthreads,
435439
auto_bold_nss=False,
440+
t1w_inversion=True,
441+
name=f"syn_preprocessing_{estimator.bids_id}",
436442
)
437-
syn_preprocessing_wf.inputs.in_epis = sources
438-
syn_preprocessing_wf.inputs.in_meta = [
443+
syn_preprocessing_wf.inputs.inputnode.in_epis = sources
444+
syn_preprocessing_wf.inputs.inputnode.in_meta = [
439445
layout.get_metadata(s) for s in sources
440446
]
441-
442-
b0_masks = pe.MapNode(CheckGradientTable(), name="b0_masks",
447+
b0_masks = pe.MapNode(CheckGradientTable(), name=f"b0_masks_{estimator.bids_id}",
443448
iterfield=("dwi_file", "in_bvec", "in_bval"))
444449
b0_masks.inputs.dwi_file = sources
445450
b0_masks.inputs.in_bvec = [str(layout.get_bvec(s)) for s in sources]
446451
b0_masks.inputs.in_bval = [str(layout.get_bval(s)) for s in sources]
447452

448-
epi_brain = pe.Node(BrainExtraction(), name="epi_brain")
453+
epi_brain = pe.Node(BrainExtraction(), name=f"epi_brain_{estimator.bids_id}")
449454

450455
# fmt:off
451456
workflow.connect([
@@ -455,21 +460,17 @@ def init_single_subject_wf(subject_id):
455460
]),
456461
(b0_masks, syn_preprocessing_wf, [("b0_mask", "inputnode.t_masks")]),
457462
(syn_preprocessing_wf, fmap_wf, [
458-
("outputnode.epi_ref", "inputnode.epi_ref"),
459-
("outputnode.anat_ref", "inputnode.anat_ref"),
460-
("outputnode.anat_mask", "inputnode.anat_mask"),
461-
("outputnode.anat2epi_xfm", "inputnode.anat2epi_xfm"),
463+
("outputnode.epi_ref", f"in_{estimator.bids_id}.epi_ref"),
464+
("outputnode.anat_ref", f"in_{estimator.bids_id}.anat_ref"),
465+
("outputnode.anat2epi_xfm", f"in_{estimator.bids_id}.anat2epi_xfm"),
462466
]),
463-
(syn_preprocessing_wf, epi_brain, [("outputnode.epi_ref", "in_file")]),
467+
(syn_preprocessing_wf, epi_brain, [
468+
(("outputnode.epi_ref", _pop), "in_file")]),
464469
(anat_preproc_wf, fmap_wf, [
465-
("outputnode.std2anat_xfm", "inputnode.std2anat_xfm"),
470+
("outputnode.std2anat_xfm", f"in_{estimator.bids_id}.std2anat_xfm"),
466471
]),
467-
(epi_brain, fmap_wf, [("out_mask", "inputnode.epi_mask")]),
472+
(epi_brain, fmap_wf, [("out_mask", f"in_{estimator.bids_id}.epi_mask")]),
468473
])
469474
# fmt:on
470475

471-
raise RuntimeError(
472-
f"Unknown fieldmap estimation strategy <{estimator}>."
473-
)
474-
475476
return workflow

0 commit comments

Comments
 (0)