Skip to content

Commit d6d22e3

Browse files
mgxdeffigies
andcommitted
Apply suggestions from code review
Co-authored-by: Chris Markiewicz <[email protected]>
1 parent d3b6d81 commit d6d22e3

File tree

2 files changed

+17
-39
lines changed

2 files changed

+17
-39
lines changed

fmriprep/workflows/bold/base.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,8 @@ def init_bold_wf(
184184
return
185185

186186
config.loggers.workflow.debug(
187-
f'Creating bold processing workflow for <{bold_file}> ({mem_gb["filesize"]:.2f} GB / '
188-
f'{nvols} TRs). Memory resampled/largemem={mem_gb["resampled"]:.2f}/'
189-
f'{mem_gb["largemem"]:.2f} GB.'
187+
f'Creating bold processing workflow for <{bold_file}> ({mem_gb["filesize"]:.2f} GB / {nvols} TRs). '
188+
f'Memory resampled/largemem={mem_gb["resampled"]:.2f}/{mem_gb["largemem"]:.2f} GB.'
190189
)
191190

192191
workflow = Workflow(name=_get_wf_name(bold_file, 'bold'))

fmriprep/workflows/bold/resampling.py

Lines changed: 15 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -599,26 +599,14 @@ def init_wb_vol_surf_wf(
599599
iterables=[('hemi', ['L', 'R'])],
600600
)
601601

602-
joinnode = pe.JoinNode(
603-
niu.IdentityInterface(fields=['bold_fsnative']),
604-
name='joinnode_vol_surf',
605-
joinsource='hemisource_vol_surf',
606-
)
607-
608-
outputnode = pe.Node(
602+
outputnode = pe.JoinNode(
609603
niu.IdentityInterface(fields=['bold_fsnative']),
610604
name='outputnode',
605+
joinsource='hemisource_vol_surf',
611606
)
612607

613608
select_surfaces = pe.Node(
614-
KeySelect(
615-
fields=[
616-
'white',
617-
'pial',
618-
'midthickness',
619-
],
620-
keys=['L', 'R'],
621-
),
609+
KeySelect(fields=['white', 'pial', 'midthickness'], keys=['L', 'R']),
622610
name='select_surfaces',
623611
run_without_submitting=True,
624612
)
@@ -630,13 +618,6 @@ def init_wb_vol_surf_wf(
630618
n_procs=omp_nthreads,
631619
)
632620

633-
metric_dilate = pe.Node(
634-
MetricDilate(distance=10, nearest=True),
635-
name='metric_dilate',
636-
mem_gb=1,
637-
n_procs=omp_nthreads,
638-
)
639-
640621
workflow.connect([
641622
(inputnode, select_surfaces, [
642623
('white', 'white'),
@@ -653,17 +634,23 @@ def init_wb_vol_surf_wf(
653634
('white', 'inner_surface'),
654635
('pial', 'outer_surface'),
655636
]),
656-
(joinnode, outputnode, [('bold_fsnative', 'bold_fsnative')]),
657637
]) # fmt:skip
658638

659639
if dilate:
640+
metric_dilate = pe.Node(
641+
MetricDilate(distance=10, nearest=True),
642+
name='metric_dilate',
643+
mem_gb=1,
644+
n_procs=omp_nthreads,
645+
)
646+
660647
workflow.connect([
661648
(select_surfaces, metric_dilate, [('midthickness', 'surf_file')]),
662649
(volume_to_surface, metric_dilate, [('out_file', 'in_file')]),
663-
(metric_dilate, joinnode, [('out_file', 'bold_fsnative')]),
650+
(metric_dilate, outputnode, [('out_file', 'bold_fsnative')]),
664651
]) # fmt:skip
665652
else:
666-
workflow.connect(volume_to_surface, 'out_file', joinnode, 'bold_fsnative')
653+
workflow.connect(volume_to_surface, 'out_file', outputnode, 'bold_fsnative')
667654

668655
return workflow
669656

@@ -761,15 +748,10 @@ def init_wb_surf_surf_wf(
761748
iterables=[('hemi', ['L', 'R'])],
762749
)
763750

764-
joinnode = pe.JoinNode(
765-
niu.IdentityInterface(fields=['bold_resampled']),
766-
name=f'joinnode_surf_surf_{template}_{density}',
767-
joinsource=f'hemisource_surf_surf_{template}_{density}',
768-
)
769-
770-
outputnode = pe.Node(
751+
outputnode = pe.JoinNode(
771752
niu.IdentityInterface(fields=['bold_resampled']),
772753
name='outputnode',
754+
joinsource=f'hemisource_surf_surf_{template}_{density}',
773755
)
774756

775757
select_surfaces = pe.Node(
@@ -819,12 +801,9 @@ def init_wb_surf_surf_wf(
819801
('midthickness', 'current_area'),
820802
('midthickness_resampled', 'new_area'),
821803
]),
822-
(resample_to_template, joinnode, [
804+
(resample_to_template, outputnode, [
823805
('out_file', 'bold_resampled'),
824806
]),
825-
(joinnode, outputnode, [
826-
('bold_resampled', 'bold_resampled'),
827-
]),
828807
]) # fmt:skip
829808

830809
return workflow

0 commit comments

Comments
 (0)