Skip to content

Commit 3991846

Browse files
committed
DOC: Update workflow graph generators
1 parent 5cdcde7 commit 3991846

File tree

2 files changed

+72
-42
lines changed

2 files changed

+72
-42
lines changed

docs/workflows.rst

Lines changed: 70 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ is presented below:
3737
For example, ``anat_preproc_wf`` is a sub-workflow that is generated by the
3838
:func:`~smriprep.workflows.anatomical.init_anat_preproc_wf` (see below).
3939
Because each task and run of functional data is processed separately,
40-
:func:`~fmriprep.workflows.bold.base.init_func_preproc_wf` names the
40+
:func:`~fmriprep.workflows.bold.base.init_bold_wf` names the
4141
resulting workflows using input parameters, resulting in
4242
``func_preproc_task_{task}_run_{run}_wf``.
4343
* Datasinks begin with ``ds_``, and save files to the output directory.
@@ -287,19 +287,41 @@ from the ``aseg.mgz`` file as described in
287287

288288
BOLD preprocessing
289289
------------------
290-
:py:func:`~fmriprep.workflows.bold.base.init_func_preproc_wf`
290+
*fMRIPrep* performs a series of steps to preprocess :abbr:`BOLD (blood-oxygen level-dependent)`
291+
data. Broadly, these are split into fit and transform stages.
292+
293+
The following figures show the overall workflow graph and the ``bold_fit_wf``
294+
subgraph:
295+
296+
:py:func:`~fmriprep.workflows.bold.base.init_bold_wf`
291297

292298
.. workflow::
293299
:graph2use: orig
294300
:simple_form: yes
295301

296302
from fmriprep.workflows.tests import mock_config
297303
from fmriprep import config
298-
from fmriprep.workflows.bold.base import init_func_preproc_wf
304+
from fmriprep.workflows.bold.base import init_bold_wf
299305
with mock_config():
300306
bold_file = config.execution.bids_dir / 'sub-01' / 'func' \
301307
/ 'sub-01_task-mixedgamblestask_run-01_bold.nii.gz'
302-
wf = init_func_preproc_wf(str(bold_file))
308+
wf = init_bold_wf(bold_series=[str(bold_file)])
309+
310+
.. _bold_fit:
311+
312+
:py:func:`~fmriprep.workflows.bold.fit.init_bold_fit_wf`
313+
314+
.. workflow::
315+
:graph2use: orig
316+
:simple_form: yes
317+
318+
from fmriprep.workflows.tests import mock_config
319+
from fmriprep import config
320+
from fmriprep.workflows.bold.fit import init_bold_fit_wf
321+
with mock_config():
322+
bold_file = config.execution.bids_dir / 'sub-01' / 'func' \
323+
/ 'sub-01_task-mixedgamblestask_run-01_bold.nii.gz'
324+
wf = init_bold_fit_wf(bold_series=[str(bold_file)], fieldmap_id="fmap")
303325

304326
Preprocessing of :abbr:`BOLD (blood-oxygen level-dependent)` files is
305327
split into multiple sub-workflows described below.
@@ -308,31 +330,31 @@ split into multiple sub-workflows described below.
308330

309331
BOLD reference image estimation
310332
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
311-
:py:func:`~niworkflows.func.util.init_bold_reference_wf`
333+
:py:func:`~fmriprep.workflows.bold.reference.init_raw_boldref_wf`
312334

313335
.. workflow::
314336
:graph2use: orig
315337
:simple_form: yes
316338

317-
from niworkflows.func.util import init_bold_reference_wf
318-
wf = init_bold_reference_wf(omp_nthreads=1)
339+
from fmriprep.workflows.bold.reference import init_raw_boldref_wf
340+
wf = init_raw_boldref_wf()
319341

320342
This workflow estimates a reference image for a
321-
:abbr:`BOLD (blood-oxygen level-dependent)` series.
322-
If a single-band reference ("sbref") image associated with the BOLD series is
323-
available, then it is used directly.
324-
If not, a reference image is estimated from the BOLD series as follows:
343+
:abbr:`BOLD (blood-oxygen level-dependent)` series as follows:
325344
When T1-saturation effects ("dummy scans" or non-steady state volumes) are
326345
detected, they are averaged and used as reference due to their
327346
superior tissue contrast.
328347
Otherwise, a median of motion corrected subset of volumes is used.
329348

330-
The reference image is then used to calculate a brain mask for the
331-
:abbr:`BOLD (blood-oxygen level-dependent)` signal using *NiWorkflows*'
332-
:py:func:`~niworkflows.func.util.init_enhance_and_skullstrip_bold_wf`.
333-
Further, the reference is fed to the :ref:`head-motion estimation
334-
workflow <bold_hmc>` and the :ref:`registration workflow to map
335-
BOLD series into the T1w image of the same subject <bold_reg>`.
349+
This reference is used for :ref:`head-motion estimation <bold_hmc>`.
350+
351+
For the :ref:`registration workflow <bold_reg>`, the reference image is
352+
either the above described reference image or a single-band reference,
353+
if one is found in the input dataset.
354+
In either case, this image is contrast-enhanced and skull-stripped
355+
(see :py:func:`~niworkflows.func.util.init_enhance_and_skullstrip_bold_wf`).
356+
If fieldmaps are present, the skull-stripped reference is corrected
357+
prior to registration.
336358

337359
.. figure:: _static/sub-01_task-balloonanalogrisktask_run-1_desc-rois_bold.svg
338360

@@ -418,14 +440,19 @@ Theory, methods and references are found within the
418440

419441
Pre-processed BOLD in native space
420442
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
421-
:py:func:`~fmriprep.workflows.bold.resampling.init_bold_preproc_trans_wf`
443+
:py:func:`~fmriprep.workflows.bold.fit.init_bold_native_wf`
422444

423445
.. workflow::
424446
:graph2use: orig
425447
:simple_form: yes
426448

427-
from fmriprep.workflows.bold import init_bold_preproc_trans_wf
428-
wf = init_bold_preproc_trans_wf(mem_gb=3, omp_nthreads=1)
449+
from fmriprep.workflows.tests import mock_config
450+
from fmriprep import config
451+
from fmriprep.workflows.bold.fit import init_bold_native_wf
452+
with mock_config():
453+
bold_file = config.execution.bids_dir / 'sub-01' / 'func' \
454+
/ 'sub-01_task-mixedgamblestask_run-01_bold.nii.gz'
455+
wf = init_bold_native_wf(bold_series=[str(bold_file)], fieldmap_id='fmap')
429456

430457
A new *preproc* :abbr:`BOLD (blood-oxygen level-dependent)` series is generated
431458
from the slice-timing corrected or the original data (if
@@ -442,16 +469,14 @@ Interpolation uses a Lanczos kernel.
442469

443470
EPI to T1w registration
444471
~~~~~~~~~~~~~~~~~~~~~~~
445-
:py:func:`~fmriprep.workflows.bold.registration.init_bold_reg_wf`
472+
:py:func:`~fmriprep.workflows.bold.registration.init_bbreg_wf`
446473

447474
.. workflow::
448-
:graph2use: orig
475+
:graph2use: hierarchical
449476
:simple_form: yes
450477

451-
from fmriprep.workflows.bold import init_bold_reg_wf
452-
wf = init_bold_reg_wf(
453-
freesurfer=True,
454-
mem_gb=1,
478+
from fmriprep.workflows.bold.registration import init_bbreg_wf
479+
wf = init_bbreg_wf(
455480
omp_nthreads=1,
456481
use_bbr=True,
457482
bold2t1w_dof=9,
@@ -478,23 +503,14 @@ original, affine registration.
478503

479504
Resampling BOLD runs onto standard spaces
480505
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
481-
:py:func:`~fmriprep.workflows.bold.resampling.init_bold_std_trans_wf`
506+
:py:func:`~fmriprep.workflows.bold.apply.init_bold_volumetric_resample_wf`
482507

483508
.. workflow::
484509
:graph2use: colored
485510
:simple_form: yes
486511

487-
from niworkflows.utils.spaces import SpatialReferences
488-
from fmriprep.workflows.bold import init_bold_std_trans_wf
489-
wf = init_bold_std_trans_wf(
490-
freesurfer=True,
491-
mem_gb=3,
492-
omp_nthreads=1,
493-
spaces=SpatialReferences(
494-
spaces=[('MNI152Lin', {}), ('MNIPediatricAsym', {'cohort': '6'})],
495-
checkpoint=True),
496-
multiecho=False,
497-
)
512+
from fmriprep.workflows.bold.apply import init_bold_volumetric_resample_wf
513+
wf = init_bold_volumetric_resample_wf(metadata={}, fieldmap_id='fmap')
498514

499515
This sub-workflow concatenates the transforms calculated upstream (see
500516
`Head-motion estimation`_, `Susceptibility Distortion Correction (SDC)`_ --if
@@ -523,7 +539,10 @@ EPI sampled to FreeSurfer surfaces
523539
wf = init_bold_surf_wf(
524540
mem_gb=1,
525541
surface_spaces=['fsnative', 'fsaverage5'],
526-
medial_surface_nan=False)
542+
medial_surface_nan=False,
543+
metadata={},
544+
output_dir='.',
545+
)
527546

528547
If FreeSurfer processing is enabled, the motion-corrected functional series
529548
(after single shot resampling to T1w space) is sampled to the
@@ -540,7 +559,7 @@ HCP Grayordinates
540559
:py:func:`~fmriprep.workflows.bold.resampling.init_bold_fsLR_resampling_wf`
541560

542561
.. workflow::
543-
:graph2use: colored
562+
:graph2use: orig
544563
:simple_form: yes
545564

546565
from fmriprep.workflows.bold.resampling import init_bold_fsLR_resampling_wf
@@ -595,6 +614,17 @@ T2*-driven echo combination
595614
~~~~~~~~~~~~~~~~~~~~~~~~~~~
596615
:py:func:`~fmriprep.workflows.bold.t2s.init_bold_t2s_wf`
597616

617+
.. workflow::
618+
:graph2use: colored
619+
:simple_form: yes
620+
621+
from fmriprep.workflows.bold.t2s import init_bold_t2s_wf
622+
wf = init_bold_t2s_wf(
623+
echo_times=[0.015, 0.030, 0.045],
624+
mem_gb=1,
625+
omp_nthreads=1,
626+
)
627+
598628
If multi-echo :abbr:`BOLD (blood-oxygen level-dependent)` data is supplied,
599629
this workflow uses the `tedana`_ `T2* workflow`_ to generate an adaptive T2* map
600630
and optimally weighted combination of all supplied single echo time series.

fmriprep/workflows/bold/resampling.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525
++++++++++++++++++++
2626
2727
.. autofunction:: init_bold_surf_wf
28-
.. autofunction:: init_bold_std_trans_wf
29-
.. autofunction:: init_bold_preproc_trans_wf
3028
.. autofunction:: init_bold_fsLR_resampling_wf
3129
.. autofunction:: init_bold_grayords_wf
3230
.. autofunction:: init_goodvoxels_bold_mask_wf
@@ -75,6 +73,8 @@ def init_bold_surf_wf(
7573
wf = init_bold_surf_wf(mem_gb=0.1,
7674
surface_spaces=["fsnative", "fsaverage5"],
7775
medial_surface_nan=False,
76+
metadata={},
77+
output_dir='.',
7878
)
7979
8080
Parameters

0 commit comments

Comments
 (0)