Skip to content

Commit

Permalink
enh: remove 'bold' appearances, use wf from fmriprep
Browse files Browse the repository at this point in the history
  • Loading branch information
oesteban committed Dec 4, 2020
1 parent aeaf24b commit b890160
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 292 deletions.
6 changes: 3 additions & 3 deletions dmriprep/cli/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def _bids_filter(value):
action="store",
nargs="+",
default=[],
choices=["fieldmaps", "slicetiming", "sbref"],
choices=["fieldmaps", "sbref"],
help="ignore selected aspects of the input dataset to disable corresponding "
"parts of the workflow (a space delimited list)",
)
Expand Down Expand Up @@ -220,12 +220,12 @@ def _bids_filter(value):
% (currentv.base_version if is_release else "latest"),
)
g_conf.add_argument(
"--bold2t1w-init",
"--dwi2t1w-init",
action="store",
default="register",
choices=["register", "header"],
help='Either "register" (the default) to initialize volumes at center or "header"'
" to use the header information when coregistering BOLD to T1w images.",
" to use the header information when coregistering DWI to T1w images.",
)

# ANTs options
Expand Down
6 changes: 3 additions & 3 deletions dmriprep/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,9 @@ class workflow(_Config):

anat_only = False
"""Execute the anatomical preprocessing only."""
dwi2t1w_init = "register"
"""Whether to use standard coregistration ('register') or to initialize coregistration from the
DWI header ('header')."""
fmap_bspline = None
"""Regularize fieldmaps with a field of B-Spline basis."""
fmap_demean = None
Expand All @@ -436,9 +439,6 @@ class workflow(_Config):
ignore = None
"""Ignore particular steps for *dMRIPrep*."""
longitudinal = False
bold2t1w_init = "register"
"""Whether to use standard coregistration ('register') or to initialize coregistration from the
BOLD image-header ('header')."""
"""Run FreeSurfer ``recon-all`` with the ``-logitudinal`` flag."""
run_reconall = True
"""Run FreeSurfer's surface reconstruction."""
Expand Down
51 changes: 33 additions & 18 deletions dmriprep/workflows/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
from niworkflows.utils.misc import fix_multi_T1w_source_name
from niworkflows.utils.spaces import Reference
from smriprep.workflows.anatomical import init_anat_preproc_wf
from fmriprep.workflows.bold.registration import init_bbreg_wf

from ..interfaces import DerivativesDataSink, BIDSDataGrabber
from ..interfaces.reports import SubjectSummary, AboutSummary
from ..utils.bids import collect_data
from .dwi.base import init_early_b0ref_wf
from .fmap.base import init_fmap_estimation_wf
from .dwi.registration import init_bbreg_wf


def init_dmriprep_wf():
"""
Expand Down Expand Up @@ -287,7 +288,7 @@ def init_single_subject_wf(subject_id):
return workflow

# Append the dMRI section to the existing anatomical excerpt
# That way we do not need to stream down the number of bold datasets
# That way we do not need to stream down the number of DWI datasets
anat_preproc_wf.__postdesc__ = (
(anat_preproc_wf.__postdesc__ or "")
+ f"""
Expand Down Expand Up @@ -358,28 +359,42 @@ def init_single_subject_wf(subject_id):
from niworkflows.interfaces.nibabel import ApplyMask

# Mask the T1w
t1w_brain = pe.Node(ApplyMask(), name='t1w_brain')
t1w_brain = pe.Node(ApplyMask(), name="t1w_brain")

bbr_wf = init_bbreg_wf(
bold2t1w_init=config.workflow.bold2t1w_init,
bold2t1w_init=config.workflow.dwi2t1w_init,
omp_nthreads=config.nipype.omp_nthreads,
use_bbr=True,
)

workflow.connect([
# T1w Mask
(anat_preproc_wf, t1w_brain, [('outputnode.t1w_preproc', 'in_file'),
('outputnode.t1w_mask', 'in_mask')]),
# BBRegister
(split_info, bbr_wf, [('dwi_file', 'inputnode.in_file')]),
(t1w_brain, bbr_wf, [('out_file', 'inputnode.t1w_brain')]),
(anat_preproc_wf, bbr_wf, [('outputnode.t1w_dseg', 'inputnode.t1w_dseg')]),
(fsinputnode, bbr_wf, [("subjects_dir", "inputnode.subjects_dir")]),
(bids_info, bbr_wf, [('subject', 'inputnode.subject_id')]),
(anat_preproc_wf, bbr_wf, [
('outputnode.fsnative2t1w_xfm', 'inputnode.fsnative2t1w_xfm')
])
])
workflow.connect(
[
# T1w Mask
(
anat_preproc_wf,
t1w_brain,
[
("outputnode.t1w_preproc", "in_file"),
("outputnode.t1w_mask", "in_mask"),
],
),
# BBRegister
(split_info, bbr_wf, [("dwi_file", "inputnode.in_file")]),
(t1w_brain, bbr_wf, [("out_file", "inputnode.t1w_brain")]),
(
anat_preproc_wf,
bbr_wf,
[("outputnode.t1w_dseg", "inputnode.t1w_dseg")],
),
(fsinputnode, bbr_wf, [("subjects_dir", "inputnode.subjects_dir")]),
(bids_info, bbr_wf, [("subject", "inputnode.subject_id")]),
(
anat_preproc_wf,
bbr_wf,
[("outputnode.fsnative2t1w_xfm", "inputnode.fsnative2t1w_xfm")],
),
]
)

fmap_estimation_wf = init_fmap_estimation_wf(
subject_data["dwi"], debug=config.execution.debug
Expand Down
268 changes: 0 additions & 268 deletions dmriprep/workflows/dwi/registration.py

This file was deleted.

Loading

0 comments on commit b890160

Please sign in to comment.