Skip to content

Commit

Permalink
enh: final integration stretch - pin deps, cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
oesteban committed Mar 9, 2021
1 parent 6832fdf commit c50afb9
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 23 deletions.
3 changes: 1 addition & 2 deletions dmriprep/cli/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,7 @@ def build_boilerplate(config_file, workflow):
"-s",
"--bibliography",
pkgrf("dmriprep", "data/boilerplate.bib"),
"--filter",
"pandoc-citeproc",
"--citeproc",
"--metadata",
'pagetitle="dMRIPrep citation boilerplate"',
str(citation_files["md"]),
Expand Down
18 changes: 14 additions & 4 deletions dmriprep/config/reports-spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ sections:
caption: Surfaces (white and pial) reconstructed with FreeSurfer (<code>recon-all</code>)
overlaid on the participant's T1w template.
subtitle: Surface reconstruction
- name: Fieldmaps
- name: <em>B<sub>0</sub></em> field mapping
ordering: session,run,fmapid
reportlets:
- bids: {datatype: figures, desc: mapped, suffix: fieldmap}
Expand All @@ -38,7 +38,7 @@ sections:
description: Hover over the panels with the mouse pointer to also visualize the intensity of the
field inhomogeneity in Hertz.
static: false
subtitle: "Susceptibility-derived Distortion Correction (SDC): field inhomogeneity estimation"
subtitle: "Preprocessed <em>B<sub>0</sub></em> mapping acquisition"
- bids: {datatype: figures, desc: phasediff, suffix: fieldmap}
caption: Inhomogeneities of the <em>B<sub>0</sub></em> field introduce (oftentimes severe) spatial distortions
along the phase-encoding direction of the image. A Gradient-Recalled Echo (GRE) scheme for the
Expand All @@ -48,7 +48,7 @@ sections:
description: Hover over the panels with the mouse pointer to also visualize the intensity of the
field inhomogeneity in Hertz.
static: false
subtitle: "Susceptibility-derived Distortion Correction (SDC): field inhomogeneity estimation"
subtitle: "Preprocessed mapping of phase-difference acquisition"
- bids: {datatype: figures, desc: pepolar, suffix: fieldmap}
caption: Inhomogeneities of the <em>B<sub>0</sub></em> field introduce (oftentimes severe) spatial distortions
along the phase-encoding direction of the image. Utilizing two or more images with different
Expand All @@ -58,7 +58,17 @@ sections:
description: Hover on the panels with the mouse pointer to also visualize the intensity of the
inhomogeneity of the field in Hertz.
static: false
subtitle: "Susceptibility-derived Distortion Correction (SDC): field inhomogeneity estimation"
subtitle: "Preprocessed estimation with varying Phase-Endocing (PE) blips"
- bids: {datatype: figures, desc: anat, suffix: fieldmap}
caption: Inhomogeneities of the <em>B<sub>0</sub></em> field introduce (oftentimes severe) spatial distortions
along the phase-encoding direction of the image. Utilizing an <em>anatomically-correct</em> acquisition
(for instance, T1w or T2w), it is possible to estimate the inhomogeneity of the field by means of nonlinear
registration. The plot below shows a reference EPI (echo-planar imaging) volume generated
using two or more EPI images with the same PE encoding, after alignment to the anatomical scan.
description: Hover on the panels with the mouse pointer to also visualize the intensity of the
inhomogeneity of the field in Hertz.
static: false
subtitle: "Preprocessed estimation by nonlinear registration to an anatomical scan (&ldquo;<em>fieldmap-less</em>&rdquo;)"
- name: Diffusion
ordering: session,acquisition,run
reportlets:
Expand Down
18 changes: 6 additions & 12 deletions dmriprep/workflows/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ def init_single_subject_wf(subject_id):

# SDC Step 2: Manually add further estimators (e.g., fieldmap-less)
fmap_wf = init_fmap_preproc_wf(
debug=config.execution.debug,
debug=config.execution.debug is True,
estimators=fmap_estimators,
omp_nthreads=config.nipype.omp_nthreads,
output_dir=str(output_dir),
Expand Down Expand Up @@ -424,8 +424,6 @@ def init_single_subject_wf(subject_id):
)

if estimator.method == fm.EstimatorType.ANAT:
from niworkflows.utils.connections import pop_file as _pop
from sdcflows.interfaces.brainmask import BrainExtraction
from sdcflows.workflows.fit.syn import init_syn_preprocessing_wf
from ..interfaces.vectors import CheckGradientTable

Expand All @@ -436,6 +434,7 @@ def init_single_subject_wf(subject_id):
layout = config.execution.layout
syn_preprocessing_wf = init_syn_preprocessing_wf(
omp_nthreads=config.nipype.omp_nthreads,
debug=config.execution.debug is True,
auto_bold_nss=False,
t1w_inversion=True,
name=f"syn_preprocessing_{estimator.bids_id}",
Expand All @@ -450,26 +449,21 @@ def init_single_subject_wf(subject_id):
b0_masks.inputs.in_bvec = [str(layout.get_bvec(s)) for s in sources]
b0_masks.inputs.in_bval = [str(layout.get_bval(s)) for s in sources]

epi_brain = pe.Node(BrainExtraction(), name=f"epi_brain_{estimator.bids_id}")

# fmt:off
workflow.connect([
(anat_preproc_wf, syn_preprocessing_wf, [
("outputnode.t1w_preproc", "inputnode.in_anat"),
("outputnode.t1w_mask", "inputnode.mask_anat"),
("outputnode.std2anat_xfm", f"inputnode.std2anat_xfm"),
]),
(b0_masks, syn_preprocessing_wf, [("b0_mask", "inputnode.t_masks")]),
(syn_preprocessing_wf, fmap_wf, [
("outputnode.epi_ref", f"in_{estimator.bids_id}.epi_ref"),
("outputnode.epi_mask", f"in_{estimator.bids_id}.epi_mask"),
("outputnode.anat_ref", f"in_{estimator.bids_id}.anat_ref"),
("outputnode.anat2epi_xfm", f"in_{estimator.bids_id}.anat2epi_xfm"),
]),
(syn_preprocessing_wf, epi_brain, [
(("outputnode.epi_ref", _pop), "in_file")]),
(anat_preproc_wf, fmap_wf, [
("outputnode.std2anat_xfm", f"in_{estimator.bids_id}.std2anat_xfm"),
("outputnode.anat_mask", f"in_{estimator.bids_id}.anat_mask"),
("outputnode.sd_prior", f"in_{estimator.bids_id}.sd_prior"),
]),
(epi_brain, fmap_wf, [("out_mask", f"in_{estimator.bids_id}.epi_mask")]),
])
# fmt:on

Expand Down
6 changes: 3 additions & 3 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ git+https://github.com/AleksandarPetrov/napoleon.git@0dc3f28a309ad602be5f44a9049
git+https://github.com/rwblair/sphinxcontrib-versioning.git@39b40b0b84bf872fc398feff05344051bbce0f63#egg=sphinxcontrib-versioning
nbsphinx
nipype ~= 1.5.1
niworkflows >=1.4.0rc0,<1.5
niworkflows >=1.4.0rc5,<1.5
packaging
pydot>=1.2.3
pydotplus
sdcflows ~= 2.0.0
sdcflows ~= 2.0
smriprep >= 0.8.0rc0
sphinx >=2.1.2,<3.0
sphinx-argparse
sphinx_rtd_theme
sphinxcontrib-apidoc ~= 0.3.0
templateflow
toml
toml
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ install_requires =
indexed_gzip >=0.8.8
nibabel ~= 3.0
nipype >= 1.5.1, < 2.0
niworkflows @ git+https://github.com/nipreps/niworkflows.git@master
niworkflows >=1.4.0rc5, <1.5
numpy
pybids >= 0.11.1
pyyaml
sdcflows @ git+https://github.com/nipreps/sdcflows.git@ca69ff15a5cf12522fa75a2a2ed4247af0713560
sdcflows ~= 2.0.1
smriprep >= 0.8.0rc0
svgutils != 0.3.2
templateflow ~= 0.6
Expand Down

0 comments on commit c50afb9

Please sign in to comment.