Skip to content

Commit 4e7b8b9

Browse files
committed
RF to address review comments, remove unused inputs
1 parent d13d1a1 commit 4e7b8b9

File tree

5 files changed

+171
-156
lines changed

5 files changed

+171
-156
lines changed

docs/workflows.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -431,14 +431,14 @@ Interpolation uses a Lanczos kernel.
431431

432432
EPI to T1w registration
433433
~~~~~~~~~~~~~~~~~~~~~~~
434-
:mod:`fmriprep.workflows.bold.registration.init_bold_calc_reg_wf`
434+
:mod:`fmriprep.workflows.bold.registration.init_bold_reg_wf`
435435

436436
.. workflow::
437437
:graph2use: orig
438438
:simple_form: yes
439439

440-
from fmriprep.workflows.bold import init_bold_calc_reg_wf
441-
wf = init_bold_calc_reg_wf(
440+
from fmriprep.workflows.bold import init_bold_reg_wf
441+
wf = init_bold_reg_wf(
442442
freesurfer=True,
443443
mem_gb=1,
444444
omp_nthreads=1,
@@ -456,7 +456,9 @@ of each run and the reconstructed subject using the gray/white matter boundary
456456

457457
If FreeSurfer processing is disabled, FSL ``flirt`` is run with the
458458
:abbr:`BBR (boundary-based registration)` cost function, using the
459-
``fast`` segmentation to establish the gray/white matter boundary. After :abbr:`BBR (boundary-based registration)` is run, the resulting affine transform will be compared to the initial transform found by FLIRT. Excessive deviation will result in rejecting the BBR refinement and accepting the original, affine registration.
459+
``fast`` segmentation to establish the gray/white matter boundary.
460+
After :abbr:`BBR (boundary-based registration)` is run, the resulting affine transform will be compared to the initial transform found by FLIRT.
461+
Excessive deviation will result in rejecting the BBR refinement and accepting the original, affine registration.
460462

461463
EPI to MNI transformation
462464
~~~~~~~~~~~~~~~~~~~~~~~~~

fmriprep/workflows/bold/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
from .stc import init_bold_stc_wf
2626
from .t2s import init_bold_t2s_wf
2727
from .registration import (
28-
init_bold_apply_reg_wf,
29-
init_bold_calc_reg_wf,
28+
init_bold_t1_trans_wf,
29+
init_bold_reg_wf,
3030
)
3131
from .resampling import (
3232
init_bold_mni_trans_wf,

fmriprep/workflows/bold/base.py

Lines changed: 44 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
from .hmc import init_bold_hmc_wf
3535
from .stc import init_bold_stc_wf
3636
from .t2s import init_bold_t2s_wf
37-
from .registration import init_bold_apply_reg_wf, init_bold_calc_reg_wf
37+
from .registration import init_bold_t1_trans_wf, init_bold_reg_wf
3838
from .resampling import (
3939
init_bold_surf_wf,
4040
init_bold_mni_trans_wf,
@@ -211,8 +211,8 @@ def init_func_preproc_wf(bold_file, ignore, freesurfer,
211211
* :py:func:`~fmriprep.workflows.bold.stc.init_bold_stc_wf`
212212
* :py:func:`~fmriprep.workflows.bold.hmc.init_bold_hmc_wf`
213213
* :py:func:`~fmriprep.workflows.bold.t2s.init_bold_t2s_wf`
214-
* :py:func:`~fmriprep.workflows.bold.registration.init_bold_apply_reg_wf`
215-
* :py:func:`~fmriprep.workflows.bold.registration.init_bold_calc_reg_wf`
214+
* :py:func:`~fmriprep.workflows.bold.registration.init_bold_t1_trans_wf`
215+
* :py:func:`~fmriprep.workflows.bold.registration.init_bold_reg_wf`
216216
* :py:func:`~fmriprep.workflows.bold.confounds.init_bold_confounds_wf`
217217
* :py:func:`~fmriprep.workflows.bold.confounds.init_ica_aroma_wf`
218218
* :py:func:`~fmriprep.workflows.bold.resampling.init_bold_mni_trans_wf`
@@ -380,22 +380,23 @@ def init_func_preproc_wf(bold_file, ignore, freesurfer,
380380
mem_gb=mem_gb['filesize'],
381381
omp_nthreads=omp_nthreads)
382382

383-
# mean BOLD registration to T1w
384-
bold_calc_reg_wf = init_bold_calc_reg_wf(name='bold_calc_reg_wf',
383+
# calculate BOLD registration to T1w
384+
bold_reg_wf = init_bold_reg_wf(name='bold_reg_wf',
385+
freesurfer=freesurfer,
386+
use_bbr=use_bbr,
387+
bold2t1w_dof=bold2t1w_dof,
388+
mem_gb=mem_gb['resampled'],
389+
omp_nthreads=omp_nthreads,
390+
use_compression=False)
391+
392+
# apply BOLD registration to T1w
393+
bold_t1_trans_wf = init_bold_t1_trans_wf(name='bold_t1_trans_wf',
385394
freesurfer=freesurfer,
386-
use_bbr=use_bbr,
387-
bold2t1w_dof=bold2t1w_dof,
395+
use_fieldwarp=(fmaps is not None or use_syn),
388396
mem_gb=mem_gb['resampled'],
389397
omp_nthreads=omp_nthreads,
390398
use_compression=False)
391399

392-
# mean BOLD registration to T1w
393-
bold_apply_reg_wf = init_bold_apply_reg_wf(name='bold_apply_reg_wf',
394-
mem_gb=mem_gb['resampled'],
395-
omp_nthreads=omp_nthreads,
396-
use_compression=False,
397-
use_fieldwarp=(fmaps is not None or use_syn))
398-
399400
# get confounds
400401
bold_confounds_wf = init_bold_confs_wf(
401402
mem_gb=mem_gb['largemem'],
@@ -456,27 +457,27 @@ def init_func_preproc_wf(bold_file, ignore, freesurfer,
456457
('outputnode.raw_ref_image', 'inputnode.raw_ref_image'),
457458
('outputnode.bold_file', 'inputnode.bold_file')]),
458459
# EPI-T1 registration workflow
459-
(inputnode, bold_calc_reg_wf, [
460-
('t1_preproc', 'inputnode.t1_preproc'),
460+
(inputnode, bold_reg_wf, [
461461
('t1_brain', 'inputnode.t1_brain'),
462-
('t1_mask', 'inputnode.t1_mask'),
463462
('t1_seg', 'inputnode.t1_seg'),
464-
('t1_aseg', 'inputnode.t1_aseg'),
465-
('t1_aparc', 'inputnode.t1_aparc'),
466463
# Undefined if --no-freesurfer, but this is safe
467464
('subjects_dir', 'inputnode.subjects_dir'),
468465
('subject_id', 'inputnode.subject_id'),
469466
('t1_2_fsnative_reverse_transform', 'inputnode.t1_2_fsnative_reverse_transform')]),
470-
(inputnode, bold_apply_reg_wf, [('bold_file', 'inputnode.name_source')]),
471-
(bold_split, bold_apply_reg_wf, [('out_files', 'inputnode.bold_split')]),
472-
(bold_hmc_wf, bold_apply_reg_wf, [('outputnode.xforms', 'inputnode.hmc_xforms')]),
473-
(bold_calc_reg_wf, outputnode, [('outputnode.bold_aseg_t1', 'bold_aseg_t1'),
467+
(inputnode, bold_t1_trans_wf, [
468+
('t1_brain', 'inputnode.t1_brain'),
469+
('t1_mask', 'inputnode.t1_mask'),
470+
('t1_aseg', 'inputnode.t1_aseg'),
471+
('t1_aparc', 'inputnode.t1_aparc')]),
472+
(inputnode, bold_t1_trans_wf, [('bold_file', 'inputnode.name_source')]),
473+
(bold_split, bold_t1_trans_wf, [('out_files', 'inputnode.bold_split')]),
474+
(bold_hmc_wf, bold_t1_trans_wf, [('outputnode.xforms', 'inputnode.hmc_xforms')]),
475+
(bold_t1_trans_wf, outputnode, [('outputnode.bold_aseg_t1', 'bold_aseg_t1'),
474476
('outputnode.bold_aparc_t1', 'bold_aparc_t1')]),
475-
(bold_calc_reg_wf, bold_apply_reg_wf, [
476-
('outputnode.reference_image', 'inputnode.reference_grid'),
477+
(bold_reg_wf, bold_t1_trans_wf, [
477478
('outputnode.itk_bold_to_t1', 'inputnode.itk_bold_to_t1')]),
478-
(bold_apply_reg_wf, outputnode, [('outputnode.bold_t1', 'bold_t1')]),
479-
(bold_calc_reg_wf, summary, [('outputnode.fallback', 'fallback')]),
479+
(bold_t1_trans_wf, outputnode, [('outputnode.bold_t1', 'bold_t1')]),
480+
(bold_reg_wf, summary, [('outputnode.fallback', 'fallback')]),
480481
# SDC (or pass-through workflow)
481482
(inputnode, bold_sdc_wf, [
482483
('t1_brain', 'inputnode.t1_brain'),
@@ -485,10 +486,11 @@ def init_func_preproc_wf(bold_file, ignore, freesurfer,
485486
('outputnode.ref_image', 'inputnode.bold_ref'),
486487
('outputnode.ref_image_brain', 'inputnode.bold_ref_brain'),
487488
('outputnode.bold_mask', 'inputnode.bold_mask')]),
488-
(bold_sdc_wf, bold_calc_reg_wf, [
489+
(bold_sdc_wf, bold_reg_wf, [
490+
('outputnode.bold_ref_brain', 'inputnode.ref_bold_brain')]),
491+
(bold_sdc_wf, bold_t1_trans_wf, [
489492
('outputnode.bold_ref_brain', 'inputnode.ref_bold_brain'),
490-
('outputnode.bold_mask', 'inputnode.ref_bold_mask')]),
491-
(bold_sdc_wf, bold_apply_reg_wf, [
493+
('outputnode.bold_mask', 'inputnode.ref_bold_mask'),
492494
('outputnode.out_warp', 'inputnode.fieldwarp')]),
493495
(bold_sdc_wf, bold_bold_trans_wf, [
494496
('outputnode.out_warp', 'inputnode.fieldwarp'),
@@ -499,7 +501,7 @@ def init_func_preproc_wf(bold_file, ignore, freesurfer,
499501
('t1_mask', 'inputnode.t1_mask')]),
500502
(bold_hmc_wf, bold_confounds_wf, [
501503
('outputnode.movpar_file', 'inputnode.movpar_file')]),
502-
(bold_calc_reg_wf, bold_confounds_wf, [
504+
(bold_reg_wf, bold_confounds_wf, [
503505
('outputnode.itk_t1_to_bold', 'inputnode.t1_bold_xform')]),
504506
(bold_confounds_wf, outputnode, [
505507
('outputnode.confounds_file', 'confounds'),
@@ -530,7 +532,7 @@ def init_func_preproc_wf(bold_file, ignore, freesurfer,
530532
('t1_seg', 'inputnode.in_seg')]),
531533
(bold_reference_wf, fmap_unwarp_report_wf, [
532534
('outputnode.ref_image', 'inputnode.in_pre')]),
533-
(bold_calc_reg_wf, fmap_unwarp_report_wf, [
535+
(bold_reg_wf, fmap_unwarp_report_wf, [
534536
('outputnode.itk_t1_to_bold', 'inputnode.in_xfm')]),
535537
(bold_sdc_wf, fmap_unwarp_report_wf, [
536538
('outputnode.bold_ref', 'inputnode.in_post')]),
@@ -544,7 +546,7 @@ def init_func_preproc_wf(bold_file, ignore, freesurfer,
544546
('t1_seg', 'inputnode.in_seg')]),
545547
(bold_reference_wf, syn_unwarp_report_wf, [
546548
('outputnode.ref_image', 'inputnode.in_pre')]),
547-
(bold_calc_reg_wf, syn_unwarp_report_wf, [
549+
(bold_reg_wf, syn_unwarp_report_wf, [
548550
('outputnode.itk_t1_to_bold', 'inputnode.in_xfm')]),
549551
(bold_sdc_wf, syn_unwarp_report_wf, [
550552
('outputnode.syn_bold_ref', 'inputnode.in_post')]),
@@ -582,14 +584,14 @@ def init_func_preproc_wf(bold_file, ignore, freesurfer,
582584

583585
# Replace EPI-to-T1w registration inputs
584586
workflow.disconnect([
585-
(bold_sdc_wf, bold_calc_reg_wf, [
587+
(bold_sdc_wf, bold_t1_trans_wf, [
586588
('outputnode.bold_ref_brain', 'inputnode.ref_bold_brain'),
587589
('outputnode.bold_mask', 'inputnode.ref_bold_mask')]),
588590
])
589591
workflow.connect([
590592
(bold_hmc_wf, bold_t2s_wf, [
591593
('outputnode.xforms', 'inputnode.hmc_xforms')]),
592-
(bold_t2s_wf, bold_calc_reg_wf, [
594+
(bold_t2s_wf, bold_t1_trans_wf, [
593595
('outputnode.t2s_map', 'inputnode.ref_bold_brain'),
594596
('outputnode.oc_mask', 'inputnode.ref_bold_mask')]),
595597
])
@@ -607,9 +609,10 @@ def init_func_preproc_wf(bold_file, ignore, freesurfer,
607609
workflow.connect([
608610
(bold_bold_trans_wf, boldmask_to_t1w, [
609611
('outputnode.bold_mask', 'input_image')]),
610-
(bold_calc_reg_wf, boldmask_to_t1w, [
611-
('outputnode.bold_mask_t1', 'reference_image'),
612+
(bold_reg_wf, boldmask_to_t1w, [
612613
('outputnode.itk_bold_to_t1', 'transforms')]),
614+
(bold_t1_trans_wf, boldmask_to_t1w, [
615+
('outputnode.bold_mask_t1', 'reference_image')]),
613616
(boldmask_to_t1w, outputnode, [
614617
('output_image', 'bold_mask_t1')]),
615618
])
@@ -639,7 +642,7 @@ def init_func_preproc_wf(bold_file, ignore, freesurfer,
639642
('out_files', 'inputnode.bold_split')]),
640643
(bold_hmc_wf, bold_mni_trans_wf, [
641644
('outputnode.xforms', 'inputnode.hmc_xforms')]),
642-
(bold_calc_reg_wf, bold_mni_trans_wf, [
645+
(bold_reg_wf, bold_mni_trans_wf, [
643646
('outputnode.itk_bold_to_t1', 'inputnode.itk_bold_to_t1')]),
644647
(bold_bold_trans_wf, bold_mni_trans_wf, [
645648
('outputnode.bold_mask', 'inputnode.bold_mask')]),
@@ -652,7 +655,7 @@ def init_func_preproc_wf(bold_file, ignore, freesurfer,
652655
('outputnode.bold_mask', 'inputnode.bold_mask')]),
653656
(inputnode, carpetplot_wf, [
654657
('t1_2_mni_reverse_transform', 'inputnode.t1_2_mni_reverse_transform')]),
655-
(bold_calc_reg_wf, carpetplot_wf, [
658+
(bold_reg_wf, carpetplot_wf, [
656659
('outputnode.itk_t1_to_bold', 'inputnode.t1_bold_xform')]),
657660
(bold_confounds_wf, carpetplot_wf, [
658661
('outputnode.confounds_file', 'inputnode.confounds_file')]),
@@ -690,7 +693,7 @@ def init_func_preproc_wf(bold_file, ignore, freesurfer,
690693
(bold_hmc_wf, ica_aroma_wf, [
691694
('outputnode.movpar_file', 'inputnode.movpar_file'),
692695
('outputnode.xforms', 'inputnode.hmc_xforms')]),
693-
(bold_calc_reg_wf, ica_aroma_wf, [
696+
(bold_reg_wf, ica_aroma_wf, [
694697
('outputnode.itk_bold_to_t1', 'inputnode.itk_bold_to_t1')]),
695698
(bold_bold_trans_wf, ica_aroma_wf, [
696699
('outputnode.bold_mask', 'inputnode.bold_mask')]),
@@ -720,7 +723,7 @@ def init_func_preproc_wf(bold_file, ignore, freesurfer,
720723
('subjects_dir', 'inputnode.subjects_dir'),
721724
('subject_id', 'inputnode.subject_id'),
722725
('t1_2_fsnative_forward_transform', 'inputnode.t1_2_fsnative_forward_transform')]),
723-
(bold_apply_reg_wf, bold_surf_wf, [('outputnode.bold_t1', 'inputnode.source_file')]),
726+
(bold_t1_trans_wf, bold_surf_wf, [('outputnode.bold_t1', 'inputnode.source_file')]),
724727
(bold_surf_wf, outputnode, [('outputnode.surfaces', 'surfaces')]),
725728
])
726729

fmriprep/workflows/bold/confounds.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ def init_ica_aroma_wf(template, metadata, mem_gb, omp_nthreads,
431431
template : str
432432
Spatial normalization template used as target when that
433433
registration step was previously calculated with
434-
:py:func:`~fmriprep.workflows.bold.registration.init_bold_calc_reg_wf`.
434+
:py:func:`~fmriprep.workflows.bold.registration.init_bold_reg_wf`.
435435
The template must be one of the MNI templates (fMRIPrep uses
436436
``MNI152NLin2009cAsym`` by default).
437437
metadata : dict

0 commit comments

Comments
 (0)