Skip to content

Commit 58ebda6

Browse files
committed
fix(workflow): update suffices and replace with desc if required
1 parent 13d1cec commit 58ebda6

File tree

7 files changed

+38
-36
lines changed

7 files changed

+38
-36
lines changed

fmriprep/workflows/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,12 +436,12 @@ def init_single_subject_wf(layout, subject_id, task_id, echo_idx, name, reportle
436436

437437
ds_report_summary = pe.Node(
438438
DerivativesDataSink(base_directory=reportlets_dir,
439-
suffix='summary'),
439+
desc='summary', keep_dtype=True),
440440
name='ds_report_summary', run_without_submitting=True)
441441

442442
ds_report_about = pe.Node(
443443
DerivativesDataSink(base_directory=reportlets_dir,
444-
suffix='about'),
444+
desc='about', keep_dtype=True),
445445
name='ds_report_about', run_without_submitting=True)
446446

447447
# Preprocessing of T1w (includes registration to MNI)

fmriprep/workflows/bold/base.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -636,11 +636,8 @@ def init_func_preproc_wf(bold_file, ignore, freesurfer,
636636

637637
if fmaps:
638638
from ..fieldmap.unwarp import init_fmap_unwarp_report_wf
639-
sdc_type = fmaps[0]['suffix']
640-
641639
# Report on BOLD correction
642-
fmap_unwarp_report_wf = init_fmap_unwarp_report_wf(
643-
suffix='sdc_%s' % sdc_type)
640+
fmap_unwarp_report_wf = init_fmap_unwarp_report_wf()
644641
workflow.connect([
645642
(inputnode, fmap_unwarp_report_wf, [
646643
('t1_seg', 'inputnode.in_seg')]),
@@ -652,9 +649,9 @@ def init_func_preproc_wf(bold_file, ignore, freesurfer,
652649
('outputnode.bold_ref', 'inputnode.in_post')]),
653650
])
654651

655-
if force_syn and sdc_type != 'syn':
652+
if force_syn and fmaps[0]['suffix'] != 'syn':
656653
syn_unwarp_report_wf = init_fmap_unwarp_report_wf(
657-
suffix='forcedsyn', name='syn_unwarp_report_wf')
654+
name='syn_unwarp_report_wf', forcedsyn=True)
658655
workflow.connect([
659656
(inputnode, syn_unwarp_report_wf, [
660657
('t1_seg', 'inputnode.in_seg')]),
@@ -842,13 +839,13 @@ def init_func_preproc_wf(bold_file, ignore, freesurfer,
842839

843840
# REPORTING ############################################################
844841
ds_report_summary = pe.Node(
845-
DerivativesDataSink(suffix='summary'),
842+
DerivativesDataSink(desc='summary', keep_dtype=True),
846843
name='ds_report_summary', run_without_submitting=True,
847844
mem_gb=DEFAULT_MEMORY_MIN_GB)
848845

849846
ds_report_validation = pe.Node(
850847
DerivativesDataSink(base_directory=reportlets_dir,
851-
suffix='validation'),
848+
desc='validation', keep_dtype=True),
852849
name='ds_report_validation', run_without_submitting=True,
853850
mem_gb=DEFAULT_MEMORY_MIN_GB)
854851

fmriprep/workflows/bold/confounds.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ def init_bold_confs_wf(mem_gb, metadata, name="bold_confs_wf"):
219219
name='rois_plot', mem_gb=mem_gb)
220220

221221
ds_report_bold_rois = pe.Node(
222-
DerivativesDataSink(suffix='rois'),
222+
DerivativesDataSink(desc='rois', keep_dtype=True),
223223
name='ds_report_bold_rois', run_without_submitting=True,
224224
mem_gb=DEFAULT_MEMORY_MIN_GB)
225225

@@ -377,7 +377,7 @@ def init_carpetplot_wf(mem_gb, metadata, name="bold_carpet_wf"):
377377
('framewise_displacement', 'mm', 'FD')]),
378378
name='conf_plot', mem_gb=mem_gb)
379379
ds_report_bold_conf = pe.Node(
380-
DerivativesDataSink(suffix='carpetplot'),
380+
DerivativesDataSink(desc='carpetplot', keep_dtype=True),
381381
name='ds_report_bold_conf', run_without_submitting=True,
382382
mem_gb=DEFAULT_MEMORY_MIN_GB)
383383

@@ -579,7 +579,7 @@ def _getusans_func(image, thresh):
579579
name='ica_aroma_confound_extraction')
580580

581581
ds_report_ica_aroma = pe.Node(
582-
DerivativesDataSink(suffix='ica_aroma'),
582+
DerivativesDataSink(desc='aroma', keep_dtype=True),
583583
name='ds_report_ica_aroma', run_without_submitting=True,
584584
mem_gb=DEFAULT_MEMORY_MIN_GB)
585585

fmriprep/workflows/bold/resampling.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -589,20 +589,20 @@ def init_bold_preproc_report_wf(mem_gb, reportlets_dir, name='bold_preproc_repor
589589

590590
bold_rpt = pe.Node(SimpleBeforeAfter(), name='bold_rpt',
591591
mem_gb=0.1)
592-
bold_rpt_ds = pe.Node(
593-
DerivativesDataSink(base_directory=reportlets_dir,
594-
suffix='variant-preproc'), name='bold_rpt_ds',
592+
ds_report_bold = pe.Node(
593+
DerivativesDataSink(base_directory=reportlets_dir, desc='preproc',
594+
keep_dtype=True), name='ds_report_bold',
595595
mem_gb=DEFAULT_MEMORY_MIN_GB,
596596
run_without_submitting=True
597597
)
598598

599599
workflow.connect([
600-
(inputnode, bold_rpt_ds, [('name_source', 'source_file')]),
600+
(inputnode, ds_report_bold, [('name_source', 'source_file')]),
601601
(inputnode, pre_tsnr, [('in_pre', 'in_file')]),
602602
(inputnode, pos_tsnr, [('in_post', 'in_file')]),
603603
(pre_tsnr, bold_rpt, [('stddev_file', 'before')]),
604604
(pos_tsnr, bold_rpt, [('stddev_file', 'after')]),
605-
(bold_rpt, bold_rpt_ds, [('out_report', 'in_file')]),
605+
(bold_rpt, ds_report_bold, [('out_report', 'in_file')]),
606606
])
607607

608608
return workflow

fmriprep/workflows/fieldmap/fmap.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,9 @@ def init_fmap_wf(omp_nthreads, fmap_bspline, name='fmap_wf'):
6464
name='n4_correct', n_procs=omp_nthreads)
6565
bet = pe.Node(BETRPT(generate_report=True, frac=0.6, mask=True),
6666
name='bet')
67-
ds_fmap_mask = pe.Node(DerivativesDataSink(suffix='fmap_mask'),
68-
name='ds_report_fmap_mask', run_without_submitting=True)
67+
ds_report_fmap_mask = pe.Node(DerivativesDataSink(
68+
desc='brain', suffix='mask'), name='ds_report_fmap_mask',
69+
run_without_submitting=True)
6970

7071
workflow.connect([
7172
(inputnode, magmrg, [('magnitude', 'in_files')]),
@@ -74,8 +75,8 @@ def init_fmap_wf(omp_nthreads, fmap_bspline, name='fmap_wf'):
7475
(n4_correct, bet, [('output_image', 'in_file')]),
7576
(bet, outputnode, [('mask_file', 'fmap_mask'),
7677
('out_file', 'fmap_ref')]),
77-
(inputnode, ds_fmap_mask, [('fieldmap', 'source_file')]),
78-
(bet, ds_fmap_mask, [('out_report', 'in_file')]),
78+
(inputnode, ds_report_fmap_mask, [('fieldmap', 'source_file')]),
79+
(bet, ds_report_fmap_mask, [('out_report', 'in_file')]),
7980
])
8081

8182
if fmap_bspline:

fmriprep/workflows/fieldmap/phdiff.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,9 @@ def _pick1st(inlist):
8383
name='n4', n_procs=omp_nthreads)
8484
bet = pe.Node(BETRPT(generate_report=True, frac=0.6, mask=True),
8585
name='bet')
86-
ds_fmap_mask = pe.Node(DerivativesDataSink(suffix='fmap_mask'), name='ds_report_fmap_mask',
87-
mem_gb=0.01, run_without_submitting=True)
86+
ds_report_fmap_mask = pe.Node(DerivativesDataSink(
87+
desc='brain', suffix='mask'), name='ds_report_fmap_mask',
88+
mem_gb=0.01, run_without_submitting=True)
8889
# uses mask from bet; outputs a mask
8990
# dilate = pe.Node(fsl.maths.MathsCommand(
9091
# nan2zeros=True, args='-kernel sphere 5 -dilM'), name='MskDilate')
@@ -127,8 +128,8 @@ def _pick1st(inlist):
127128
(compfmap, outputnode, [('out_file', 'fmap')]),
128129
(bet, outputnode, [('mask_file', 'fmap_mask'),
129130
('out_file', 'fmap_ref')]),
130-
(inputnode, ds_fmap_mask, [('phasediff', 'source_file')]),
131-
(bet, ds_fmap_mask, [('out_report', 'in_file')]),
131+
(inputnode, ds_report_fmap_mask, [('phasediff', 'source_file')]),
132+
(bet, ds_report_fmap_mask, [('out_report', 'in_file')]),
132133
])
133134

134135
return workflow

fmriprep/workflows/fieldmap/unwarp.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,9 @@ def init_sdc_unwarp_wf(omp_nthreads, fmap_demean, debug, name='sdc_unwarp_wf'):
105105
output_inverse_warped_image=True, output_warped_image=True),
106106
name='fmap2ref_reg', n_procs=omp_nthreads)
107107

108-
ds_reg = pe.Node(DerivativesDataSink(suffix='fmap_reg'), name='ds_report_reg',
109-
mem_gb=0.01, run_without_submitting=True)
108+
ds_report_reg = pe.Node(DerivativesDataSink(
109+
desc='magnitude', suffix='bold'), name='ds_report_reg',
110+
mem_gb=0.01, run_without_submitting=True)
110111

111112
# Map the VSM into the EPI space
112113
fmap2ref_apply = pe.Node(ANTSApplyTransformsRPT(
@@ -118,8 +119,9 @@ def init_sdc_unwarp_wf(omp_nthreads, fmap_demean, debug, name='sdc_unwarp_wf'):
118119
float=True),
119120
name='fmap_mask2ref_apply')
120121

121-
ds_reg_vsm = pe.Node(DerivativesDataSink(suffix='fmap_reg_vsm'), name='ds_report_vsm',
122-
mem_gb=0.01, run_without_submitting=True)
122+
ds_report_vsm = pe.Node(DerivativesDataSink(
123+
desc='fieldmap', suffix='bold'), name='ds_report_vsm',
124+
mem_gb=0.01, run_without_submitting=True)
123125

124126
# Fieldmap to rads and then to voxels (VSM - voxel shift map)
125127
torads = pe.Node(FieldToRadS(fmap_range=0.5), name='torads')
@@ -159,9 +161,9 @@ def init_sdc_unwarp_wf(omp_nthreads, fmap_demean, debug, name='sdc_unwarp_wf'):
159161
(inputnode, fmap_mask2ref_apply, [('in_reference', 'reference_image')]),
160162
(fmap2ref_reg, fmap_mask2ref_apply, [
161163
('composite_transform', 'transforms')]),
162-
(fmap2ref_apply, ds_reg_vsm, [('out_report', 'in_file')]),
164+
(fmap2ref_apply, ds_report_vsm, [('out_report', 'in_file')]),
163165
(inputnode, fmap2ref_reg, [('in_reference_brain', 'fixed_image')]),
164-
(fmap2ref_reg, ds_reg, [('out_report', 'in_file')]),
166+
(fmap2ref_reg, ds_report_reg, [('out_report', 'in_file')]),
165167
(inputnode, fmap2ref_apply, [('fmap', 'input_image')]),
166168
(inputnode, fmap_mask2ref_apply, [('fmap_mask', 'input_image')]),
167169
(fmap2ref_apply, torads, [('output_image', 'in_file')]),
@@ -211,7 +213,7 @@ def init_sdc_unwarp_wf(omp_nthreads, fmap_demean, debug, name='sdc_unwarp_wf'):
211213
return workflow
212214

213215

214-
def init_fmap_unwarp_report_wf(name='fmap_unwarp_report_wf', suffix='variant-hmcsdc_preproc'):
216+
def init_fmap_unwarp_report_wf(name='fmap_unwarp_report_wf', forcedsyn=False):
215217
"""
216218
This workflow generates and saves a reportlet showing the effect of fieldmap
217219
unwarping a BOLD image.
@@ -227,8 +229,8 @@ def init_fmap_unwarp_report_wf(name='fmap_unwarp_report_wf', suffix='variant-hmc
227229
228230
name : str, optional
229231
Workflow name (default: fmap_unwarp_report_wf)
230-
suffix : str, optional
231-
Suffix to be appended to this reportlet
232+
forcedsyn : bool, optional
233+
Whether SyN-SDC was forced.
232234
233235
**Inputs**
234236
@@ -264,7 +266,8 @@ def init_fmap_unwarp_report_wf(name='fmap_unwarp_report_wf', suffix='variant-hmc
264266
bold_rpt = pe.Node(SimpleBeforeAfter(), name='bold_rpt',
265267
mem_gb=0.1)
266268
ds_report_sdc = pe.Node(
267-
DerivativesDataSink(suffix=suffix), name='ds_report_sdc',
269+
DerivativesDataSink(desc='sdc' if not forcedsyn else 'forcedsyn',
270+
suffix='bold'), name='ds_report_sdc',
268271
mem_gb=DEFAULT_MEMORY_MIN_GB, run_without_submitting=True
269272
)
270273

0 commit comments

Comments
 (0)