Skip to content

Commit a47b5a0

Browse files
committed
rf: Drop unnecessary IdentityInterface node
1 parent eb1bb73 commit a47b5a0

File tree

1 file changed

+14
-24
lines changed

1 file changed

+14
-24
lines changed

fmriprep/workflows/base.py

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -556,22 +556,11 @@ def init_single_subject_wf(subject_id: str):
556556
filters=config.execution.get().get('bids_filters', {}).get('fmap'),
557557
)
558558

559-
fmap_merge_nodes = {
559+
fmap_buffers = {
560560
field: pe.Node(niu.Merge(2), name=f'{field}_merge', run_without_submitting=True)
561561
for field in ['fmap', 'fmap_ref', 'fmap_coeff', 'fmap_mask', 'fmap_id', 'sdc_method']
562562
}
563563

564-
fmap_buffer = pe.Node(
565-
niu.IdentityInterface(
566-
fields=['fmap', 'fmap_ref', 'fmap_coeff', 'fmap_mask', 'fmap_id', 'sdc_method']
567-
),
568-
name='fmap_buffer',
569-
)
570-
571-
workflow.connect(
572-
[(fmap_merge_nodes[field], fmap_buffer, [('out', field)]) for field in fmap_merge_nodes]
573-
)
574-
575564
missing_estimators = []
576565
if fmap_estimators:
577566
# Map fmapid entity to internal bids_id
@@ -588,23 +577,23 @@ def init_single_subject_wf(subject_id: str):
588577
f'{len(pared_cache)} estimator(s): {list(pared_cache)}.'
589578
)
590579

591-
fmap_merge_nodes['fmap'].inputs.in1 = [
580+
fmap_buffers['fmap'].inputs.in1 = [
592581
pared_cache[fmapid]['fieldmap'] for fmapid in pared_cache
593582
]
594-
fmap_merge_nodes['fmap_ref'].inputs.in1 = [
583+
fmap_buffers['fmap_ref'].inputs.in1 = [
595584
pared_cache[fmapid]['magnitude'] for fmapid in pared_cache
596585
]
597-
fmap_merge_nodes['fmap_coeff'].inputs.in1 = [
586+
fmap_buffers['fmap_coeff'].inputs.in1 = [
598587
pared_cache[fmapid]['coeffs'] for fmapid in pared_cache
599588
]
600589
# Note that masks are not emitted. The BOLD-fmap transforms cannot be
601590
# computed with precomputed fieldmaps until we either start emitting masks
602591
# or start skull-stripping references on the fly.
603-
fmap_merge_nodes['fmap_mask'].inputs.in1 = [
592+
fmap_buffers['fmap_mask'].inputs.in1 = [
604593
pared_cache[fmapid].get('mask', 'MISSING') for fmapid in pared_cache
605594
]
606-
fmap_merge_nodes['fmap_id'].inputs.in1 = list(pared_cache)
607-
fmap_merge_nodes['sdc_method'].inputs.in1 = ['precomputed'] * len(pared_cache)
595+
fmap_buffers['fmap_id'].inputs.in1 = list(pared_cache)
596+
fmap_buffers['sdc_method'].inputs.in1 = ['precomputed'] * len(pared_cache)
608597

609598
if missing_estimators:
610599
config.loggers.workflow.info(
@@ -637,12 +626,12 @@ def init_single_subject_wf(subject_id: str):
637626
fmap_wf.get_node(node).interface.out_path_base = ''
638627

639628
workflow.connect([
640-
(fmap_wf, fmap_merge_nodes[field], [
629+
(fmap_wf, fmap_buffers[field], [
641630
# We get "sdc_method" as "method" from estimator workflows
642631
# All else stays the same, and no other sdc_ prefixes are used
643632
(f'outputnode.{field.removeprefix("sdc_")}', 'in2'),
644633
])
645-
for field in fmap_merge_nodes
634+
for field in fmap_buffers
646635
]) # fmt:skip
647636

648637
fmap_select_std = pe.Node(
@@ -785,10 +774,11 @@ def init_single_subject_wf(subject_id: str):
785774
'inputnode.sphere_reg_fsLR',
786775
),
787776
]),
788-
(fmap_buffer, bold_wf, [
789-
(field, f'inputnode.{field}')
790-
for field in fmap_merge_nodes
791-
]),
777+
]) # fmt:skip
778+
779+
workflow.connect([
780+
(buffer, bold_wf, [('out', f'inputnode.{field}')])
781+
for field, buffer in fmap_buffers.items()
792782
]) # fmt:skip
793783

794784
if config.workflow.level == 'full':

0 commit comments

Comments
 (0)