Skip to content

Commit 6a64770

Browse files
committed
Merge tag '20.0.1'
20.0.1 (February 27, 2020) Bug-fix release in 20.0.x series. This release includes fixes for rare images with invalid qform matrices and some minor improvements in report readability and inclusion of common templates in the Docker image. * FIX: Handle qforms with invalid quaternions (nipreps/niworkflows#466) * FIX: update niworkflows location (#2005) * ENH: Display errors as summary/details elements in reports (nipreps/niworkflows#464) * DOC: Add ``--fs-subjects-dir`` usage to slurm example (#2003) * CI: Test that Docker image can run a common set of output spaces without network access (#1997)
2 parents f9b2f53 + fc842fd commit 6a64770

File tree

10 files changed

+54
-22
lines changed

10 files changed

+54
-22
lines changed

.circleci/config.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,7 @@ jobs:
365365
sudo setfacl -m group:$(id -gn):rwx /tmp/ds005/work
366366
fmriprep-docker -i poldracklab/fmriprep:latest \
367367
-e FMRIPREP_DEV 1 -u $(id -u) \
368+
--network none \
368369
--config $PWD/nipype.cfg -w /tmp/ds005/work \
369370
/tmp/data/ds005 /tmp/ds005/derivatives participant \
370371
--fs-subjects-dir /tmp/ds005/freesurfer \
@@ -393,6 +394,7 @@ jobs:
393394
sudo setfacl -m group:$(id -gn):rwx /tmp/ds005/work
394395
fmriprep-docker -i poldracklab/fmriprep:latest \
395396
-e FMRIPREP_DEV 1 -u $(id -u) \
397+
--network none \
396398
--config $PWD/nipype.cfg -w /tmp/ds005/work \
397399
/tmp/data/ds005 /tmp/ds005/derivatives participant \
398400
--fs-subjects-dir /tmp/ds005/freesurfer \
@@ -422,6 +424,7 @@ jobs:
422424
rm /tmp/data/ds005/sub-01/func/*_run-01_*
423425
fmriprep-docker -i poldracklab/fmriprep:latest \
424426
-e FMRIPREP_DEV 1 -u $(id -u) \
427+
--network none \
425428
--config $PWD/nipype.cfg -w /tmp/ds005/work_partial \
426429
/tmp/data/ds005 /tmp/ds005/derivatives_partial participant \
427430
--fs-subjects-dir /tmp/ds005/freesurfer \

CHANGES.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
20.0.1 (February 27, 2020)
2+
==========================
3+
Bug-fix release in 20.0.x series.
4+
5+
This release includes fixes for rare images with invalid qform matrices and some minor
6+
improvements in report readability and inclusion of common templates in the Docker image.
7+
8+
* FIX: Handle qforms with invalid quaternions (`nipreps/niworkflows#466`_)
9+
* FIX: update niworkflows location (#2005)
10+
* ENH: Display errors as summary/details elements in reports (`nipreps/niworkflows#464`_)
11+
* DOC: Add ``--fs-subjects-dir`` usage to slurm example (#2003)
12+
* CI: Test that Docker image can run a common set of output spaces without network access (#1997)
13+
14+
.. _`nipreps/niworkflows#464`: https://github.com/nipreps/niworkflows/pull/464
15+
.. _`nipreps/niworkflows#466`: https://github.com/nipreps/niworkflows/pull/466
16+
117
20.0.0 (February 24, 2020)
218
==========================
319
The major release of 2020 is here!

Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,10 @@ RUN pip install --no-cache-dir "$( grep templateflow fmriprep-setup.cfg | xargs
170170
tfapi.get('MNI152NLin6Asym', atlas=None, resolution=[1, 2], \
171171
desc='brain', extension=['.nii', '.nii.gz']); \
172172
tfapi.get('MNI152NLin2009cAsym', atlas=None, extension=['.nii', '.nii.gz']); \
173-
tfapi.get('OASIS30ANTs', extension=['.nii', '.nii.gz']);" && \
173+
tfapi.get('OASIS30ANTs', extension=['.nii', '.nii.gz']); \
174+
tfapi.get('fsLR', space='fsaverage', density='164k'); \
175+
tfapi.get('fsLR', space=None, density='32k'); \
176+
tfapi.get('MNI152NLin6Asym', resolution=2, atlas='HCP', suffix='dseg')" && \
174177
rm fmriprep-setup.cfg && \
175178
find $HOME/.cache/templateflow -type d -exec chmod go=u {} + && \
176179
find $HOME/.cache/templateflow -type f -exec chmod go=u {} +

docs/_static/sbatch.slurm

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
BIDS_DIR="$STUDY/data"
1717
DERIVS_DIR="derivatives/fmriprep-1.5.0"
18+
LOCAL_FREESURFER_DIR="$STUDY/data/derivatives/freesurfer-6.0.1"
1819

1920
# Prepare some writeable bind-mount points.
2021
TEMPLATEFLOW_HOST_HOME=$HOME/.cache/templateflow
@@ -25,27 +26,21 @@ mkdir -p ${FMRIPREP_HOST_CACHE}
2526
# Prepare derivatives folder
2627
mkdir -p ${BIDS_DIR}/${DERIVS_DIR}
2728

28-
# This trick will help you reuse freesurfer results across pipelines and fMRIPrep versions
29-
mkdir -p ${BIDS_DIR}/derivatives/freesurfer-6.0.1
30-
if [ ! -d ${BIDS_DIR}/${DERIVS_DIR}/freesurfer ]; then
31-
ln -s ${BIDS_DIR}/derivatives/freesurfer-6.0.1 ${BIDS_DIR}/${DERIVS_DIR}/freesurfer
32-
fi
33-
3429
# Make sure FS_LICENSE is defined in the container.
3530
export SINGULARITYENV_FS_LICENSE=$HOME/.freesurfer.txt
3631

3732
# Designate a templateflow bind-mount point
3833
export SINGULARITYENV_TEMPLATEFLOW_HOME="/templateflow"
39-
SINGULARITY_CMD="singularity run --cleanenv -B $BIDS_DIR:/data -B ${TEMPLATEFLOW_HOST_HOME}:${SINGULARITYENV_TEMPLATEFLOW_HOME} -B $L_SCRATCH:/work $STUDY/images/poldracklab_fmriprep_1.5.0.simg"
34+
SINGULARITY_CMD="singularity run --cleanenv -B $BIDS_DIR:/data -B ${TEMPLATEFLOW_HOST_HOME}:${SINGULARITYENV_TEMPLATEFLOW_HOME} -B $L_SCRATCH:/work -B ${LOCAL_FREESURFER_DIR}:/fsdir $STUDY/images/poldracklab_fmriprep_1.5.0.simg"
4035

4136
# Parse the participants.tsv file and extract one subject ID from the line corresponding to this SLURM task.
4237
subject=$( sed -n -E "$((${SLURM_ARRAY_TASK_ID} + 1))s/sub-(\S*)\>.*/\1/gp" ${BIDS_DIR}/participants.tsv )
4338

4439
# Remove IsRunning files from FreeSurfer
45-
find ${BIDS_DIR}/derivatives/freesurfer-6.0.1/sub-$subject/ -name "*IsRunning*" -type f -delete
40+
find ${LOCAL_FREESURFER_DIR}/sub-$subject/ -name "*IsRunning*" -type f -delete
4641

4742
# Compose the command line
48-
cmd="${SINGULARITY_CMD} /data /data/${DERIVS_DIR} participant --participant-label $subject -w /work/ -vv --omp-nthreads 8 --nthreads 12 --mem_mb 30000 --output-spaces MNI152NLin2009cAsym:res-2 anat fsnative fsaverage5 --use-aroma"
43+
cmd="${SINGULARITY_CMD} /data /data/${DERIVS_DIR} participant --participant-label $subject -w /work/ -vv --omp-nthreads 8 --nthreads 12 --mem_mb 30000 --output-spaces MNI152NLin2009cAsym:res-2 anat fsnative fsaverage5 --use-aroma --fs-subjects-dir /fsdir"
4944

5045
# Setup done, run the command
5146
echo Running task ${SLURM_ARRAY_TASK_ID}
@@ -57,4 +52,4 @@ exitcode=$?
5752
echo "sub-$subject ${SLURM_ARRAY_TASK_ID} $exitcode" \
5853
>> ${SLURM_JOB_NAME}.${SLURM_ARRAY_JOB_ID}.tsv
5954
echo Finished tasks ${SLURM_ARRAY_TASK_ID} with exit code $exitcode
60-
exit $exitcode
55+
exit $exitcode

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@
342342
"bids": ("https://bids-standard.github.io/pybids/", None),
343343
"nibabel": ("https://nipy.org/nibabel/", None),
344344
"nipype": ("https://nipype.readthedocs.io/en/latest/", None),
345-
"niworkflows": ("https://poldracklab.github.io/niworkflows/", None),
345+
"niworkflows": ("https://www.nipreps.org/niworkflows/", None),
346346
"sdcflows": ("https://www.nipreps.org/sdcflows/", None),
347347
"smriprep": ("https://poldracklab.github.io/smriprep/", None),
348348
"templateflow": ("https://www.templateflow.org/python-client", None),

docs/contributors.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ installation_ guide for the basic procedure for running).
1616

1717
It will be assumed the developer has a working repository in
1818
``$HOME/projects/fmriprep``, and examples are also given for
19-
`niworkflows <https://github.com/poldracklab/niworkflows>`_ and
19+
`niworkflows <https://github.com/nipreps/niworkflows>`_ and
2020
`nipype`_.
2121

2222
Patching working repositories
@@ -149,7 +149,7 @@ development environment, we have an experimental setup with `code-server
149149

150150
1. Build the Docker image
151151
~~~~~~~~~~~~~~~~~~~~~~~~~
152-
We will use the ``Dockerfile_devel`` file to build
152+
We will use the ``Dockerfile_devel`` file to build
153153
our development docker image::
154154

155155
$ cd $HOME/projects/fmriprep

docs/faq.rst

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,18 @@ Please find more information regarding this error from discussions on
5757

5858
Additionally, consider using the ``--low-mem`` flag, which will make some memory optimizations at the cost of disk space in the working directory.
5959

60+
61+
I have already run ``recon-all`` on my subjects, can I reuse my outputs?
62+
------------------------------------------------------------------------
63+
Yes, as long as the FreeSurfer_ version previously used was ``6.0.0`` or newer.
64+
If running with FreeSurfer, *fMRIPrep* checks if the output directory contains a ``freesurfer``
65+
directory and reuses the outputs found.
66+
Alternatively, you can use the ``--fs-subjects-dir`` flag to specify a different location for the existing FreeSurfer outputs.
67+
68+
6069
ERROR: it appears that ``recon-all`` is already running
6170
-------------------------------------------------------
62-
When running FreeSurfer_'s ``recon-all``, an error may say *it appears it is already running*.
71+
When running FreeSurfer's ``recon-all``, an error may say *it appears it is already running*.
6372
FreeSurfer creates files (called ``IsRunning.{rh,lh,lh+rh}``, under the ``scripts/`` folder)
6473
to determine whether it is already executing ``recon-all`` on that particular subject
6574
in another process, compute node, etc.
@@ -125,7 +134,7 @@ If you would like to run *fMRIPrep* in parallel on multiple subjects please use
125134
How much CPU time and RAM should I allocate for a typical fMRIPrep run?
126135
-----------------------------------------------------------------------
127136
The recommended way to run fMRIPrep is to process one subject per container instance. A typical preprocessing run
128-
without surface processing with freesurfer can be completed in about 2 hours with 4 CPUs or in about 1 hour with 16 CPUs.
137+
without surface processing with FreeSurfer can be completed in about 2 hours with 4 CPUs or in about 1 hour with 16 CPUs.
129138
More than 16 CPUs do not translate into faster processing times for a single subject. About 8GB of memory should be
130139
available for a single subject preprocessing run.
131140

docs/usage.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Command-Line Arguments
3737
:nodefaultconst:
3838

3939

40-
The command-line interface of the docker wrapper
40+
The command-line interface of the docker wrapper
4141
------------------------------------------------
4242

4343
.. argparse::
@@ -57,10 +57,10 @@ The FreeSurfer license
5757
To obtain a FreeSurfer license, simply register for free at
5858
https://surfer.nmr.mgh.harvard.edu/registration.html.
5959

60-
When using manually-prepared environments or singularity, FreeSurfer will search
61-
for a license key file first using the ``$FS_LICENSE`` environment variable and then
62-
in the default path to the license key file (``$FREESURFER_HOME/license.txt``).
63-
If using the ``--cleanenv`` flag and ``$FS_LICENSE`` is set, use ``--fs-license-file $FS_LICENSE``
60+
When using manually-prepared environments or singularity, FreeSurfer will search
61+
for a license key file first using the ``$FS_LICENSE`` environment variable and then
62+
in the default path to the license key file (``$FREESURFER_HOME/license.txt``).
63+
If using the ``--cleanenv`` flag and ``$FS_LICENSE`` is set, use ``--fs-license-file $FS_LICENSE``
6464
to pass the license file location to *fMRIPRep*.
6565

6666
It is possible to run the docker container pointing the image to a local path

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ install_requires =
2424
nibabel >= 3.0.1
2525
nipype >= 1.3.1
2626
nitime
27-
niworkflows ~= 1.1.7
27+
niworkflows ~= 1.1.8
2828
numpy
2929
pandas
3030
psutil >= 5.4

wrapper/fmriprep_docker.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,9 @@ def get_parser():
296296
help='Set custom environment variable within container')
297297
g_dev.add_argument('-u', '--user', action='store',
298298
help='Run container as a given user/uid')
299+
g_dev.add_argument('--network', action='store',
300+
help='Run container with a different network driver '
301+
'("none" to simulate no internet connection)')
299302

300303
return parser
301304

@@ -434,6 +437,9 @@ def main():
434437
if opts.shell:
435438
command.append('--entrypoint=bash')
436439

440+
if opts.network:
441+
command.append('--network=' + opts.network)
442+
437443
command.append(opts.image)
438444

439445
# Override help and version to describe underlying program

0 commit comments

Comments
 (0)