Skip to content

Commit 1641529

Browse files
authored
Merge pull request #1989 from oesteban/docs/intersphinx
DOC: Integrate intersphinx, drop external module wrapping
2 parents 93aba10 + 68ab320 commit 1641529

30 files changed

+347
-634
lines changed

docs/api.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.. include:: links.rst
2+
3+
================
4+
Developers - API
5+
================
6+
7+
Workflows
8+
---------
9+
10+
.. automodule:: fmriprep.workflows.base
11+
.. automodule:: fmriprep.workflows.bold

docs/api/index.rst

Lines changed: 0 additions & 13 deletions
This file was deleted.

docs/conf.py

Lines changed: 62 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -21,83 +21,83 @@
2121
# If extensions (or modules to document with autodoc) are in another directory,
2222
# add these directories to sys.path here. If the directory is relative to the
2323
# documentation root, use os.path.abspath to make it absolute, like shown here.
24-
sys.path.append(os.path.abspath('sphinxext'))
25-
sys.path.insert(0, os.path.abspath('../wrapper'))
24+
sys.path.append(os.path.abspath("sphinxext"))
25+
sys.path.insert(0, os.path.abspath("../wrapper"))
2626

2727
from github_link import make_linkcode_resolve
2828

2929
# -- General configuration ------------------------------------------------
3030

3131
# If your documentation needs a minimal Sphinx version, state it here.
32-
needs_sphinx = '1.5.3'
32+
needs_sphinx = "1.5.3"
3333

3434
# Add any Sphinx extension module names here, as strings. They can be
35-
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
35+
# extensions coming with Sphinx (named "sphinx.ext.*") or your custom
3636
# ones.
3737
extensions = [
38-
'sphinx.ext.autodoc',
39-
'sphinx.ext.doctest',
40-
'sphinx.ext.intersphinx',
41-
'sphinx.ext.coverage',
42-
'sphinx.ext.mathjax',
43-
'sphinx.ext.linkcode',
44-
'sphinxarg.ext', # argparse extension
45-
'nipype.sphinxext.plot_workflow',
46-
'nbsphinx',
47-
'sphinxcontrib.napoleon',
38+
"sphinx.ext.autodoc",
39+
"sphinx.ext.doctest",
40+
"sphinx.ext.intersphinx",
41+
"sphinx.ext.coverage",
42+
"sphinx.ext.mathjax",
43+
"sphinx.ext.linkcode",
44+
"sphinxarg.ext", # argparse extension
45+
"nipype.sphinxext.plot_workflow",
46+
"nbsphinx",
47+
"sphinxcontrib.napoleon",
4848
]
4949

5050
# Mock modules in autodoc:
5151
autodoc_mock_imports = [
52-
'numpy',
53-
'nitime',
54-
'matplotlib',
52+
"numpy",
53+
"nitime",
54+
"matplotlib",
5555
]
5656

57-
if pver.parse(sphinxversion) >= pver.parse('1.7.0'):
57+
if pver.parse(sphinxversion) >= pver.parse("1.7.0"):
5858
autodoc_mock_imports += [
59-
'pandas',
60-
'nilearn',
61-
'seaborn',
59+
"pandas",
60+
"nilearn",
61+
"seaborn",
6262
]
6363

6464
# Add any paths that contain templates here, relative to this directory.
65-
templates_path = ['_templates']
65+
templates_path = ["_templates"]
6666

6767
# Accept custom section names to be parsed for numpy-style docstrings
6868
# of parameters.
6969
# Requires pinning sphinxcontrib-napoleon to a specific commit while
7070
# https://github.com/sphinx-contrib/napoleon/pull/10 is merged.
7171
napoleon_use_param = False
7272
napoleon_custom_sections = [
73-
('Inputs', 'Parameters'),
74-
('Outputs', 'Parameters'),
73+
("Inputs", "Parameters"),
74+
("Outputs", "Parameters"),
7575
]
7676

7777
# The suffix(es) of source filenames.
7878
# You can specify multiple suffix as a list of string:
79-
# source_suffix = ['.rst', '.md']
80-
source_suffix = '.rst'
79+
# source_suffix = [".rst", ".md"]
80+
source_suffix = ".rst"
8181

8282
# The encoding of source files.
83-
# source_encoding = 'utf-8-sig'
83+
# source_encoding = "utf-8-sig"
8484

8585
# The master toctree document.
86-
master_doc = 'index'
86+
master_doc = "index"
8787

8888
# General information about the project.
89-
project = 'fmriprep'
90-
author = 'The fMRIPrep developers'
91-
copyright = '2016-%s, %s' % (datetime.now().year, author)
89+
project = "fmriprep"
90+
author = "The fMRIPrep developers"
91+
copyright = "2016-%s, %s" % (datetime.now().year, author)
9292

9393
# The version info for the project you're documenting, acts as replacement for
9494
# |version| and |release|, also used in various other places throughout the
9595
# built documents.
9696
#
9797
# The short X.Y version.
98-
version = u'version'
98+
version = "version"
9999
# The full version, including alpha/beta/rc tags.
100-
release = u'version'
100+
release = "version"
101101

102102
# The language for content autogenerated by Sphinx. Refer to documentation
103103
# for a list of supported languages.
@@ -115,7 +115,7 @@
115115
# List of patterns, relative to source directory, that match files and
116116
# directories to ignore when looking for source files.
117117
# This patterns also effect to html_static_path and html_extra_path
118-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
118+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
119119

120120
# The reST default role (used for this markup: `text`) to use for all
121121
# documents.
@@ -133,7 +133,7 @@
133133
# show_authors = False
134134

135135
# The name of the Pygments (syntax highlighting) style to use.
136-
pygments_style = 'sphinx'
136+
pygments_style = "sphinx"
137137

138138
# A list of ignored prefixes for module index sorting.
139139
# modindex_common_prefix = []
@@ -149,7 +149,7 @@
149149

150150
# The theme to use for HTML and HTML Help pages. See the documentation for
151151
# a list of builtin themes.
152-
html_theme = 'sphinx_rtd_theme'
152+
html_theme = "sphinx_rtd_theme"
153153

154154
# Theme options are theme-specific and customize the look and feel of a theme
155155
# further. For a list of options available for each theme, see the
@@ -178,7 +178,7 @@
178178
# Add any paths that contain custom static files (such as style sheets) here,
179179
# relative to this directory. They are copied after the builtin static files,
180180
# so a file named "default.css" will overwrite the builtin "default.css".
181-
html_static_path = ['_static']
181+
html_static_path = ["_static"]
182182

183183
# Add any extra paths that contain custom files (such as robots.txt or
184184
# .htaccess) here, relative to this directory. These files are copied
@@ -243,7 +243,7 @@
243243
# html_search_scorer = 'scorer.js'
244244

245245
# Output file base name for HTML help builder.
246-
htmlhelp_basename = 'fmriprepdoc'
246+
htmlhelp_basename = "fmriprepdoc"
247247

248248
# -- Options for LaTeX output ---------------------------------------------
249249

@@ -265,9 +265,9 @@
265265
# (source start file, target name, title,
266266
# author, documentclass [howto, manual, or own class]).
267267
latex_documents = [
268-
(master_doc, 'fmriprep.tex', u'fMRIprep Documentation',
268+
(master_doc, "fmriprep.tex", "fMRIprep Documentation",
269269
author,
270-
'manual'),
270+
"manual"),
271271
]
272272

273273
# The name of an image file (relative to this directory) to place at the top of
@@ -296,7 +296,7 @@
296296
# One entry per manual page. List of tuples
297297
# (source start file, name, description, authors, manual section).
298298
man_pages = [
299-
(master_doc, 'fmriprep', u'fmriprep Documentation',
299+
(master_doc, "fmriprep", "fmriprep Documentation",
300300
[author], 1)
301301
]
302302

@@ -310,9 +310,9 @@
310310
# (source start file, target name, title, author,
311311
# dir menu entry, description, category)
312312
texinfo_documents = [
313-
(master_doc, 'fmriprep', u'fMRIprep Documentation',
314-
author, 'fmriprep', 'One line description of project.',
315-
'Miscellaneous'),
313+
(master_doc, "fmriprep", "fMRIprep Documentation",
314+
author, "fmriprep", "One line description of project.",
315+
"Miscellaneous"),
316316
]
317317

318318
# Documents to append as an appendix to all manuals.
@@ -328,18 +328,30 @@
328328
# texinfo_no_detailmenu = False
329329

330330
# The following is used by sphinx.ext.linkcode to provide links to github
331-
linkcode_resolve = make_linkcode_resolve('fmriprep',
332-
u'https://github.com/poldracklab/'
333-
'fmriprep/blob/{revision}/'
334-
'{package}/{path}#L{lineno}')
331+
linkcode_resolve = make_linkcode_resolve("fmriprep",
332+
"https://github.com/poldracklab/"
333+
"fmriprep/blob/{revision}/"
334+
"{package}/{path}#L{lineno}")
335335

336336
# Example configuration for intersphinx: refer to the Python standard library.
337-
intersphinx_mapping = {'https://docs.python.org/': None}
337+
intersphinx_mapping = {
338+
"python": ("https://docs.python.org/", None),
339+
"numpy": ("http://docs.scipy.org/doc/numpy", None),
340+
"scipy": ("http://docs.scipy.org/doc/scipy/reference", None),
341+
"matplotlib": ("http://matplotlib.sourceforge.net", None),
342+
"bids": ("https://bids-standard.github.io/pybids/", None),
343+
"nibabel": ("https://nipy.org/nibabel/", None),
344+
"nipype": ("https://nipype.readthedocs.io/en/latest/", None),
345+
"niworkflows": ("https://poldracklab.github.io/niworkflows/", None),
346+
"sdcflows": ("https://www.nipreps.org/sdcflows/", None),
347+
"smriprep": ("https://poldracklab.github.io/smriprep/", None),
348+
"templateflow": ("https://www.templateflow.org/python-client", None),
349+
}
338350

339351
suppress_warnings = ["image.nonlocal_uri"]
340352

341353

342354
def setup(app):
343-
app.add_stylesheet('theme_overrides.css')
355+
app.add_stylesheet("theme_overrides.css")
344356
# We need this for the boilerplate script
345357
app.add_javascript("https://cdn.rawgit.com/chrisfilo/zenodo.js/v0.1/zenodo.js")

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@ Contents
2525
faq
2626
contributors
2727
citing
28-
api/index.rst
28+
api
2929
changes

docs/links.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,6 @@
1919
.. _`Docker Hub`: https://hub.docker.com/r/poldracklab/fmriprep/tags
2020
.. _Singularity: https://github.com/singularityware/singularity
2121
.. _SPM: https://www.fil.ion.ucl.ac.uk/spm/software/spm12/
22-
.. _TACC: https://www.tacc.utexas.edu/
22+
.. _TACC: https://www.tacc.utexas.edu/
23+
.. _tedana: https://github.com/me-ica/tedana
24+
.. _`T2* workflow`: https://tedana.readthedocs.io/en/latest/generated/tedana.workflows.t2smap_workflow.html#tedana.workflows.t2smap_workflow # noqa

docs/sdc.rst

Lines changed: 31 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,15 @@
22

33
Susceptibility Distortion Correction (SDC)
44
------------------------------------------
5+
Please note that all routines for susceptibility-derived distortion correction
6+
have been excised off of *fMRIPrep* for utilization on other projects
7+
(e.g., `dMRIPrep <https://www.nipreps.org/dmriprep>`__).
8+
For more detailed documentation on
9+
:abbr:`SDC (susceptibility-derived distortion correction)`
10+
routines, check on `www.nipreps.org/sdcflows <https://www.nipreps.org/sdcflows>`__.
511

612
Introduction
713
~~~~~~~~~~~~
8-
914
:abbr:`SDC (susceptibility-derived distortion correction)` methods usually try to
1015
make a good estimate of the field inhomogeneity map.
1116
The inhomogeneity map is directly related to the displacement of
@@ -21,72 +26,62 @@ as follows ([Jezzard1995]_, [Hutton2002]_):
2126
2227
d_\text{PE}(x, y, z) = \gamma \Delta B_0(x, y, z) T_\text{ro} \qquad (1)
2328
24-
25-
where :math:`\gamma` is the gyromagnetic ratio. Therefore, the
26-
displacements map :math:`d_\text{PE}(x, y, z)` can be estimated
27-
either via estimating the inhomogeneity map :math:`\Delta B_0(x, y, z)`
28-
(:ref:`sdc_phasediff` and :ref:`sdc_direct_b0`) or
29-
via image registration (:ref:`sdc_pepolar`, :ref:`sdc_fieldmapless`).
30-
29+
where :math:`\gamma` is the gyromagnetic ratio.
30+
Therefore, the displacements map :math:`d_\text{PE}(x, y, z)` can be estimated
31+
either via estimating the inhomogeneity map :math:`\Delta B_0(x, y, z)` or
32+
via image registration (see below).
3133

3234
Correction methods
3335
~~~~~~~~~~~~~~~~~~
34-
3536
The are five broad families of methodologies for mapping the field:
3637

37-
1. :ref:`sdc_pepolar` (also called **blip-up/blip-down**):
38+
1. **Phase Encoding POLARity** (*PEPOLAR*; also called *blip-up/blip-down*;
39+
:py:func:`~sdcflows.workflows.pepolar.init_pepolar_unwarp_wf`):
3840
acquire at least two images with varying :abbr:`PE (phase-encoding)` directions.
3941
Hence, the realization of distortion is different between the different
4042
acquisitions. The displacements map :math:`d_\text{PE}(x, y, z)` is
4143
estimated with an image registration process between the different
4244
:abbr:`PE (phase-encoding)` acquisitions, regularized by the
4345
readout time :math:`T_\text{ro}`.
4446
Corresponds to 8.9.4 of BIDS.
45-
46-
2. :ref:`sdc_direct_b0`: some sequences (such as :abbr:`SE (spiral echo)`)
47+
2. **Direct B0 mapping sequences** (:py:func:`~sdcflows.workflows.fmap.init_fmap_wf`):
48+
some sequences (such as :abbr:`SE (spiral echo)`)
4749
are able to measure the fieldmap :math:`\Delta B_0(x, y, z)` directly.
4850
Corresponds to section 8.9.3 of BIDS.
49-
50-
3. :ref:`sdc_phasediff`: to estimate the fieldmap :math:`\Delta B_0(x, y, z)`,
51+
3. **Phase-difference B0 mapping** (:py:func:`~sdcflows.workflows.phdiff.init_phdiff_wf`):
52+
to estimate the fieldmap :math:`\Delta B_0(x, y, z)`,
5153
these methods measure the phase evolution in time between two close
5254
:abbr:`GRE (Gradient Recall Echo)` acquisitions. Corresponds to the sections
5355
8.9.1 and 8.9.2 of the BIDS specification.
54-
55-
4. :ref:`sdc_fieldmapless`: FMRIPREP now experimentally supports displacement
56+
4. **"Fieldmap-less" estimation** (experimental; :py:func:`~sdcflows.workflows.syn.init_syn_sdc_wf`):
57+
*fMRIPrep* now experimentally supports displacement
5658
field estimation in the absence of fieldmaps via nonlinear registration.
57-
58-
5. **Point-spread function acquisition**: Not supported by FMRIPREP.
59-
59+
5. **Point-spread function acquisition**: Not supported by BIDS, and hence *fMRIPrep*.
6060

6161
In order to select the appropriate estimation workflow, the input BIDS dataset is
62-
first queried to find the available field-mapping techniques (see :ref:`sdc_base`).
62+
first queried to find the available field-mapping techniques
63+
(see :py:func:`~sdcflows.workflows.base.init_sdc_estimate_wf`).
6364
Once the field-map (or the corresponding displacement field) is estimated, the
64-
distortion can be accounted for (see :ref:`sdc_unwarp`).
65-
66-
65+
distortion can be accounted for
66+
(see :py:func:`~sdcflows.workflows.unwarp.init_sdc_unwarp_wf`).
6767

6868
Calculating the effective echo-spacing and total-readout time
6969
.............................................................
70-
7170
To solve :ref:`(1) <eq_fieldmap>`, all methods (with the exception of the
7271
fieldmap-less approach) will require information about the in-plane
7372
speed of the :abbr:`EPI (echo-planar imaging)` scheme used in
7473
acquisition by reading either the :math:`T_\text{ro}`
75-
(total-readout time) or :math:`t_\text{ees}` (effective echo-spacing):
76-
77-
.. autofunction:: fmriprep.interfaces.fmap.get_ees
78-
.. autofunction:: fmriprep.interfaces.fmap.get_trt
74+
(total-readout time) or :math:`t_\text{ees}` (effective echo-spacing).
75+
See corresponding implementations under *SDCFlows*:
7976

77+
* :py:func:`~sdcflows.interfaces.fmap.get_ees`
78+
* :py:func:`~sdcflows.interfaces.fmap.get_trt`
8079

8180
From the phase-difference map to a field map
8281
............................................
83-
8482
To solve :ref:`(1) <eq_fieldmap>` using a :ref:`phase-difference map <sdc_phasediff>`,
8583
the field map :math:`\Delta B_0(x, y, z)` can be derived from the phase-difference
86-
map:
87-
88-
.. autofunction:: fmriprep.interfaces.fmap.phdiff2fmap
89-
84+
map (:py:func:`~sdcflows.interfaces.fmap.phdiff2fmap`)
9085

9186
References
9287
..........
@@ -95,3 +90,6 @@ References
9590
Correction for geometric distortion in echo planar images from B0
9691
field variations Magn. Reson. Med., 34 (1) (1995), pp. 65-73,
9792
doi:`10.1002/mrm.1910340111 <https://doi.org/10.1002/mrm.1910340111>`_.
93+
.. [Hutton2002] Hutton et al., Image Distortion Correction in fMRI: A Quantitative
94+
Evaluation, NeuroImage 16(1):217-240, 2002. doi:`10.1006/nimg.2001.1054
95+
<https://doi.org/10.1006/nimg.2001.1054>`_.

0 commit comments

Comments
 (0)