Skip to content

Commit e57711c

Browse files
committed
Merge remote-tracking branch 'upstream/master' into docs/contributing-update
2 parents 65b59b1 + 325b3e3 commit e57711c

30 files changed

+211
-108
lines changed

CHANGES.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
1.1.2 (July 6, 2018)
2+
====================
3+
4+
This release incorporates Nipype improvements that should reduce the
5+
chance of hanging if tasks are killed for excessive resource consumption.
6+
7+
Thanks to Elizabeth DuPre for documentation updates.
8+
9+
* [DOC] Clarify how to reuse FreeSurfer derivatives (#1189)
10+
* [DOC] Improve command line option documentation (#1186, #1080)
11+
* [MAINT] Update core dependencies (#1179, #1180)
12+
113
1.1.1 (June 7, 2018)
214
====================
315

README.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,30 @@ Principles
9090
the process and decide which subjects should be kept for the group level
9191
analysis.
9292

93+
94+
Limitations and reasons not to use ``fmriprep``
95+
-----------------------------------------------
96+
97+
1. Very narrow :abbr:`FoV (field-of-view)` images oftentimes do not contain
98+
enough information for standard image registration methods to work correctly.
99+
Also, problems may arise when extracting the brain from these data.
100+
Supporting these particular images is already a future line of the development
101+
road-map.
102+
2. ``fmriprep`` may also underperform for particular populations (e.g. infants) and
103+
non-human brains, although appropriate templates can be provided to overcome the
104+
issue.
105+
3. The "EPInorm" approach is currently not supported, although we plan to implement
106+
this feature (see `#857 <https://github.com/poldracklab/fmriprep/issues/857>`_).
107+
4. If you really want unlimited flexibility (which is obviously a double-edged sword).
108+
5. If you want students to suffer through implementing each step for didactic purposes,
109+
or to learn shell-scripting or Python along the way.
110+
6. If you are trying to reproduce some *in-house* lab pipeline.
111+
112+
(Reasons 4-6 were kindly provided by S. Nastase in his
113+
`open review <http://academickarma.org/review/j7d5501n779n>`__
114+
of our `pre-print <https://www.biorxiv.org/content/early/2018/05/06/306951>`__).
115+
116+
93117
Acknowledgements
94118
----------------
95119

docs/_static/OHBM2018-poster.png

2.93 MB
Loading
213 KB
Loading

docs/citing.rst

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,11 +225,26 @@ we recommend to include in your paper.
225225
Posters
226226
-------
227227

228-
* Organization for Human Brain Mapping 2017 (`pdf <https://f1000research.com/posters/6-1129>`_)
228+
* Organization for Human Brain Mapping 2018
229+
(`Abstract <https://ww5.aievolution.com/hbm1801/index.cfm?do=abs.viewAbs&abs=1321>`__;
230+
`PDF <https://files.aievolution.com/hbm1801/abstracts/31779/2035_Markiewicz.pdf>`__)
231+
232+
.. image:: _static/OHBM2018-poster_thumb.png
233+
:target: _static/OHBM2018-poster.png
234+
235+
* Organization for Human Brain Mapping 2017
236+
(`Abstract <https://ww5.aievolution.com/hbm1701/index.cfm?do=abs.viewAbs&abs=4111>`__;
237+
`PDF <https://f1000research.com/posters/6-1129>`__)
229238

230239
.. image:: _static/OHBM2017-poster_thumb.png
231240
:target: _static/OHBM2017-poster.png
232241

242+
Presentations
243+
-------------
244+
245+
* Organization for Human Brain Mapping 2018
246+
`Software Demonstration <https://effigies.github.io/fmriprep-demo/>`__.
247+
233248
.. include:: license.rst
234249

235250
Other relevant references

docs/environment.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,12 @@ dependencies:
2121
- python-dateutil
2222
- pydot>=1.2.3
2323
- cython
24+
- nipype>=1.1.0
2425

2526
- pip:
2627
- sphinx-argparse
2728
- doctest-ignore-unicode
2829
- svgutils
2930
- nitime
3031
- nilearn
31-
- niworkflows>=0.4.1
32+
- niworkflows>=0.4.2

docs/installation.rst

Lines changed: 63 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,35 @@ what is included in the latest Docker images.
6666
Singularity Container
6767
=====================
6868

69-
For security reasons, many HPCs (e.g., TACC) do not allow Docker containers, but do allow `Singularity <https://github.com/singularityware/singularity>`_ containers.
69+
For security reasons, many HPCs (e.g., TACC) do not allow Docker containers, but do
70+
allow `Singularity <https://github.com/singularityware/singularity>`_ containers.
71+
72+
Preparing a Singularity image (Singularity version >= 2.5)
73+
----------------------------------------------------------
74+
If the version of Singularity on your HPC is modern enough you can create Singularity
75+
image directly on the HCP.
76+
This is as simple as: ::
77+
78+
$ singularity build /my_images/fmriprep-<version>.simg docker://poldracklab/mriqc:<version>
79+
80+
Where ``<version>`` should be replaced with the desired version of fMRIPrep that you want to download.
81+
82+
83+
Preparing a Singularity image (Singularity version < 2.5)
84+
---------------------------------------------------------
7085
In this case, start with a machine (e.g., your personal computer) with Docker installed.
71-
Use `docker2singularity <https://github.com/singularityware/docker2singularity>`_ to create a singularity image. You will need an active internet connection and some time. ::
86+
Use `docker2singularity <https://github.com/singularityware/docker2singularity>`_ to
87+
create a singularity image.
88+
You will need an active internet connection and some time. ::
7289

7390
$ docker run --privileged -t --rm \
7491
-v /var/run/docker.sock:/var/run/docker.sock \
7592
-v D:\host\path\where\to\output\singularity\image:/output \
7693
singularityware/docker2singularity \
77-
poldracklab/fmriprep:latest
94+
poldracklab/fmriprep:<version>
7895

96+
Where ``<version>`` should be replaced with the desired version of fMRIPrep that you want
97+
to download.
7998

8099
Beware of the back slashes, expected for Windows systems.
81100
For \*nix users the command translates as follows: ::
@@ -84,46 +103,69 @@ For \*nix users the command translates as follows: ::
84103
-v /var/run/docker.sock:/var/run/docker.sock \
85104
-v /absolute/path/to/output/folder:/output \
86105
singularityware/docker2singularity \
87-
poldracklab/fmriprep:latest
106+
poldracklab/fmriprep:<version>
88107

89108

90109
Transfer the resulting Singularity image to the HPC, for example, using ``scp``. ::
91110

92-
$ scp poldracklab_fmriprep_latest-*.img [email protected]:/path/to/downloads
111+
$ scp poldracklab_fmriprep*.img [email protected]:/my_images
112+
113+
Running a Singularity Image
114+
---------------------------
93115

94116
If the data to be preprocessed is also on the HPC, you are ready to run fmriprep. ::
95117

96-
$ singularity run path/to/singularity/image.img \
118+
$ singularity run --clearenv /my_images/fmriprep-1.1.2.simg \
97119
path/to/data/dir path/to/output/dir \
98120
participant \
99121
--participant-label label
100122

101-
For example: ::
123+
.. note::
102124

103-
$ singularity run ~/poldracklab_fmriprep_latest-2016-12-04-5b74ad9a4c4d.img \
125+
Singularity by default `exposes all environment variables from the host inside
126+
the container <https://github.com/singularityware/singularity/issues/445>`_.
127+
Because of this your host libraries (such as nipype) could be accidentally used
128+
instead of the ones inside the container - if they are included in ``PYTHONPATH``.
129+
To avoid such situation we recommend using the ``--clearenv`` singularity flag
130+
in production use. For example: ::
131+
132+
$ singularity run --clearenv ~/poldracklab_fmriprep_latest-2016-12-04-5b74ad9a4c4d.img \
104133
/work/04168/asdf/lonestar/ $WORK/lonestar/output \
105134
participant \
106135
--participant-label 387 --nthreads 16 -w $WORK/lonestar/work \
107136
--omp-nthreads 16
108137

109-
.. note::
110138

111-
Singularity by default `exposes all environment variables from the host inside the container <https://github.com/singularityware/singularity/issues/445>`_.
112-
Because of this your host libraries (such as nipype) could be accidentally used instead of the ones inside the container - if they are included in PYTHONPATH.
113-
To avoid such situation we recommend unsetting PYTHONPATH in production use. For example: ::
139+
or, unset the ``PYTHONPATH`` variable before running: ::
114140

115-
$ PYTHONPATH="" singularity run ~/poldracklab_fmriprep_latest-2016-12-04-5b74ad9a4c4d.img \
141+
$ unset PYTHONPATH; singularity run ~/poldracklab_fmriprep_latest-2016-12-04-5b74ad9a4c4d.img \
116142
/work/04168/asdf/lonestar/ $WORK/lonestar/output \
117143
participant \
118144
--participant-label 387 --nthreads 16 -w $WORK/lonestar/work \
119145
--omp-nthreads 16
120146

147+
148+
.. note::
149+
150+
Depending on how Singularity is configured on your cluster it might or might not
151+
automatically bind (mount or expose) host folders to the container.
152+
If this is not done automatically you will need to bind the necessary folders using
153+
the ``-B <host_folder>:<container_folder>`` Singularity argument.
154+
For example: ::
155+
156+
$ singularity run --clearenv -B /work:/work ~/poldracklab_fmriprep_latest-2016-12-04-5b74ad9a4c4d.simg \
157+
/work/my_dataset/ /work/my_dataset/derivatives/fmriprep \
158+
participant \
159+
--participant-label 387 --nthreads 16 \
160+
--omp-nthreads 16
161+
121162
Manually Prepared Environment
122163
=============================
123164

124-
.. note::
165+
.. warning::
125166

126-
This method is not recommended! Make sure you would rather do this than use a `Docker Container`_ or a `Singularity Container`_.
167+
This method is not recommended! Make sure you would rather do this than
168+
use a `Docker Container`_ or a `Singularity Container`_.
127169

128170
Make sure all of fmriprep's `External Dependencies`_ are installed.
129171
These tools must be installed and their binaries available in the
@@ -149,9 +191,11 @@ FMRIPREP uses FreeSurfer tools, which require a license to run.
149191
To obtain a FreeSurfer license, simply register for free at
150192
https://surfer.nmr.mgh.harvard.edu/registration.html.
151193

152-
When using manually-prepared environments, FreeSurfer will search for a license key
153-
file first using the ``$FS_LICENSE`` environment variable and then in the default
154-
path to the license key file (``$FREESURFER_HOME/license.txt``).
194+
When using manually-prepared environments or singularity, FreeSurfer will search
195+
for a license key file first using the ``$FS_LICENSE`` environment variable and then
196+
in the default path to the license key file (``$FREESURFER_HOME/license.txt``).
197+
If using the ``--clearenv`` flag and ``$FS_LICENSE`` is set, use ``--fs-license-file $FS_LICENSE``
198+
to pass the license file location to fMRIPrep.
155199

156200
It is possible to run the docker container pointing the image to a local path
157201
where a valid license file is stored.
@@ -193,7 +237,7 @@ would be equivalent to the latest example: ::
193237
External Dependencies
194238
=====================
195239

196-
``fmriprep`` is implemented using nipype_, but it requires some other neuroimaging
240+
FMRIPrep is implemented using nipype_, but it requires some other neuroimaging
197241
software tools:
198242

199243
- FSL_ (version 5.0.9)

docs/usage.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,20 @@ http://neurostars.org/tags/fmriprep/
7575
To participate in the ``fmriprep`` development-related discussions please use the
7676
following mailing list: http://mail.python.org/mailman/listinfo/neuroimaging
7777
Please add *[fmriprep]* to the subject line when posting on the mailing list.
78+
79+
80+
Not running on a local machine? - Data transfer
81+
===============================================
82+
83+
If you intend to run ``fmriprep`` on a remote system, you will need to
84+
make your data available within that system first.
85+
86+
For instance, here at the Poldrack Lab we use Stanford's
87+
:abbr:`HPC (high-performance computing)` system, called Sherlock.
88+
Sherlock enables `the following data transfer options
89+
<https://www.sherlock.stanford.edu/docs/user-guide/storage/data-transfer/>`_.
90+
91+
Alternatively, more comprehensive solutions such as `Datalad
92+
<http://www.datalad.org/>`_ will handle data transfers with the appropriate
93+
settings and commands.
94+
Datalad also performs version control over your data.

docs/workflows.rst

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -106,16 +106,16 @@ in a multiscale, mutual-information based, nonlinear registration scheme.
106106
In particular, spatial normalization is done using the `ICBM 2009c Nonlinear
107107
Asymmetric template (1×1×1mm) <http://nist.mni.mcgill.ca/?p=904>`_ [Fonov2011]_.
108108

109-
When processing images from patients with focal brain lesions (e.g. stroke, tumor
110-
resection), it is possible to provide a lesion mask to be used during spatial
109+
When processing images from patients with focal brain lesions (e.g. stroke, tumor
110+
resection), it is possible to provide a lesion mask to be used during spatial
111111
normalization to MNI-space [Brett2001]_.
112112
ANTs will use this mask to minimize warping of healthy tissue into damaged
113-
areas (or vice-versa).
114-
Lesion masks should be binary NIfTI images (damaged areas = 1, everywhere else = 0)
113+
areas (or vice-versa).
114+
Lesion masks should be binary NIfTI images (damaged areas = 1, everywhere else = 0)
115115
in the same space and resolution as the T1 image, and follow the naming convention specified in
116116
`BIDS Extension Proposal 3: Common Derivatives <https://docs.google.com/document/d/1Wwc4A6Mow4ZPPszDIWfCUCRNstn7d_zzaWPcfcHmgI4/edit#heading=h.9146wuepclkt>`_
117-
(e.g. ``sub-001_T1w_label-lesion_roi.nii.gz``).
118-
This file should be placed in the ``sub-*/anat`` directory of the BIDS dataset
117+
(e.g. ``sub-001_T1w_label-lesion_roi.nii.gz``).
118+
This file should be placed in the ``sub-*/anat`` directory of the BIDS dataset
119119
to be run through ``fmriprep``.
120120

121121
.. figure:: _static/T1MNINormalization.svg
@@ -165,6 +165,15 @@ structural images.
165165
If enabled, several steps in the ``fmriprep`` pipeline are added or replaced.
166166
All surface preprocessing may be disabled with the ``--fs-no-reconall`` flag.
167167

168+
.. note::
169+
Surface processing will be skipped if the outputs already exist.
170+
171+
In order to bypass reconstruction in ``fmriprep``, place existing reconstructed
172+
subjects in ``<output dir>/freesurfer`` prior to the run.
173+
``fmriprep`` will perform any missing ``recon-all`` steps, but will not perform
174+
any steps whose outputs already exist.
175+
176+
168177
If FreeSurfer reconstruction is performed, the reconstructed subject is placed in
169178
``<output dir>/freesurfer/sub-<subject_label>/`` (see :ref:`fsderivs`).
170179

@@ -201,11 +210,6 @@ If T1w voxel sizes are less than 1mm in all dimensions (rounding to nearest
201210
.1mm), `submillimeter reconstruction`_ is used, unless disabled with
202211
``--no-submm-recon``.
203212

204-
In order to bypass reconstruction in ``fmriprep``, place existing reconstructed
205-
subjects in ``<output dir>/freesurfer`` prior to the run.
206-
``fmriprep`` will perform any missing ``recon-all`` steps, but will not perform
207-
any steps whose outputs already exist.
208-
209213
``lh.midthickness`` and ``rh.midthickness`` surfaces are created in the subject
210214
``surf/`` directory, corresponding to the surface half-way between the gray/white
211215
boundary and the pial surface.
@@ -537,12 +541,23 @@ Calculated confounds include the mean global signal, mean tissue class signal,
537541
tCompCor, aCompCor, Frame-wise Displacement, 6 motion parameters, DVARS, and, if
538542
the ``--use-aroma`` flag is enabled, the noise components identified by ICA-AROMA
539543
(those to be removed by the "aggressive" denoising strategy).
544+
Particular details about ICA-AROMA are given below.
545+
546+
547+
ICA-AROMA
548+
~~~~~~~~~
549+
:mod:`fmriprep.workflows.bold.confounds.init_ica_aroma_wf`
550+
551+
When one of the `--output-spaces` selected is in MNI space, ICA-AROMA denoising
552+
can be automatically appended to the workflow.
540553
The number of ICA-AROMA components depends on a dimensionality estimate
541554
made by MELODIC.
542555
For datasets with a very short TR and a large number of timepoints, this may
543556
result in an unusually high number of components.
544557
In such cases, it may be useful to specify the number of components to be
545558
extracted with ``--aroma-melodic-dimensionality``.
559+
Further details on the implementation are given within the workflow generation
560+
function (:mod:`fmriprep.workflows.bold.confounds.init_ica_aroma_wf`).
546561

547562
*Note*: *non*-aggressive AROMA denoising is a fundamentally different procedure
548563
from its "aggressive" counterpart and cannot be performed only by using a set of noise

fmriprep/cli/run.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ def get_parser():
5757

5858
g_bids = parser.add_argument_group('Options for filtering BIDS queries')
5959
g_bids.add_argument('--participant_label', '--participant-label', action='store', nargs='+',
60-
help='one or more participant identifiers (the sub- prefix can be '
61-
'removed)')
60+
help='a space delimited list of participant identifiers or a single '
61+
'identifier (the sub- prefix can be removed)')
6262
# Re-enable when option is actually implemented
6363
# g_bids.add_argument('-s', '--session-id', action='store', default='single_session',
6464
# help='select a specific session to be processed')
@@ -97,7 +97,7 @@ def get_parser():
9797
'--ignore', required=False, action='store', nargs="+", default=[],
9898
choices=['fieldmaps', 'slicetiming'],
9999
help='ignore selected aspects of the input dataset to disable corresponding '
100-
'parts of the workflow')
100+
'parts of the workflow (a space delimited list)')
101101
g_conf.add_argument(
102102
'--longitudinal', action='store_true',
103103
help='treat dataset as longitudinal - may increase runtime')
@@ -119,7 +119,9 @@ def get_parser():
119119
' - T1w: subject anatomical volume\n'
120120
' - template: normalization target specified by --template\n'
121121
' - fsnative: individual subject surface\n'
122-
' - fsaverage*: FreeSurfer average meshes'
122+
' - fsaverage*: FreeSurfer average meshes\n'
123+
'this argument can be single value or a space delimited list,\n'
124+
'for example: --output-space T1w fsnative'
123125
)
124126
g_conf.add_argument(
125127
'--force-bbr', action='store_true', dest='use_bbr', default=None,
@@ -255,9 +257,9 @@ def main():
255257
log_level = int(max(25 - 5 * opts.verbose_count, logging.DEBUG))
256258
# Set logging
257259
logger.setLevel(log_level)
258-
nlogging.getLogger('workflow').setLevel(log_level)
259-
nlogging.getLogger('interface').setLevel(log_level)
260-
nlogging.getLogger('utils').setLevel(log_level)
260+
nlogging.getLogger('nipype.workflow').setLevel(log_level)
261+
nlogging.getLogger('nipype.interface').setLevel(log_level)
262+
nlogging.getLogger('nipype.utils').setLevel(log_level)
261263

262264
errno = 0
263265

@@ -341,7 +343,7 @@ def build_workflow(opts, retval):
341343
from ..utils.bids import collect_participants
342344
from ..viz.reports import generate_reports
343345

344-
logger = logging.getLogger('workflow')
346+
logger = logging.getLogger('nipype.workflow')
345347

346348
INIT_MSG = """
347349
Running fMRIPREP version {version}:

0 commit comments

Comments
 (0)