Skip to content

Commit 40b0b05

Browse files
authored
Merge pull request #1 from poldracklab/master
hjjh
2 parents 243b227 + b84f21d commit 40b0b05

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1061
-1386
lines changed

.circleci/config.yml

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ jobs:
226226
no_output_timeout: 2h
227227
command: |
228228
docker run -ti --rm=false \
229+
-e TEST_READONLY_FILESYSTEM=1 -v $HOME:/home/readonly:ro \
229230
--entrypoint="pytest" poldracklab/fmriprep:latest \
230231
/src/fmriprep/fmriprep -svx --doctest-modules
231232
@@ -260,7 +261,7 @@ jobs:
260261

261262
build_docs:
262263
docker:
263-
- image: python:latest
264+
- image: python:3.7.4
264265
working_directory: /tmp/src/fmriprep
265266
environment:
266267
- FSLOUTPUTTYPE: 'NIFTI'
@@ -771,16 +772,15 @@ jobs:
771772
fi
772773
773774
test_deploy_pypi:
774-
machine:
775-
image: circleci/classic:201711-01
775+
docker:
776+
- image: circleci/python:3.7.4
776777
working_directory: /tmp/src/fmriprep
777778
steps:
778779
- checkout
779780
- run:
780781
name: Build fMRIPrep
781782
command: |
782-
pyenv local 3.5.2
783-
pip install twine # For use in checking distributions
783+
pip install --user twine # For use in checking distributions
784784
THISVERSION=$( python get_version.py )
785785
THISVERSION=${THISVERSION%.dirty*}
786786
THISVERSION=${CIRCLE_TAG:-$THISVERSION}
@@ -795,7 +795,6 @@ jobs:
795795
- run:
796796
name: Check sdist distribution
797797
command: |
798-
pyenv local 3.5.2
799798
THISVERSION=$( python get_version.py )
800799
THISVERSION=${THISVERSION%.dirty*}
801800
THISVERSION=${CIRCLE_TAG:-$THISVERSION}
@@ -814,7 +813,6 @@ jobs:
814813
- run:
815814
name: Check wheel distribution
816815
command: |
817-
pyenv local 3.5.2
818816
THISVERSION=$( python get_version.py )
819817
THISVERSION=${THISVERSION%.dirty*}
820818
THISVERSION=${CIRCLE_TAG:-$THISVERSION}
@@ -832,7 +830,6 @@ jobs:
832830
- run:
833831
name: Build fmriprep-docker
834832
command: |
835-
pyenv local 3.5.2
836833
THISVERSION=$( python get_version.py )
837834
THISVERSION=${THISVERSION%.dirty*}
838835
cd wrapper
@@ -846,27 +843,24 @@ jobs:
846843
path: /tmp/src/fmriprep/wrapper/dist
847844

848845
deploy_pypi:
849-
machine:
850-
image: circleci/classic:201711-01
846+
docker:
847+
- image: circleci/python:3.7.4
851848
working_directory: /tmp/src/fmriprep
852849
steps:
853850
- checkout
854851
- run:
855852
name: Build fMRIPrep
856853
command: |
857-
pyenv local 3.5.2
858854
THISVERSION=$( python get_version.py )
859855
virtualenv --python=python build
860856
source build/bin/activate
861-
pip install --upgrade "pip>=19.1" numpy
857+
pip install --upgrade "pip>=19.1"
862858
echo "${CIRCLE_TAG:-$THISVERSION}" > fmriprep/VERSION
863859
python setup.py sdist
864-
docker run --rm=false -e PLAT='manylinux1_x86_64' -e PKGNAME='fmriprep' -v `pwd`:/io \
865-
quay.io/pypa/manylinux1_x86_64 /io/.circleci/pypi_wheel/build-wheels.sh
860+
pip wheel --no-deps -w dist/ .
866861
- run:
867862
name: Build fmriprep-docker
868863
command: |
869-
pyenv local 3.5.2
870864
THISVERSION=$( python get_version.py )
871865
cd wrapper
872866
virtualenv --python=python build
@@ -878,8 +872,7 @@ jobs:
878872
- run:
879873
name: Upload packages to PyPI
880874
command: |
881-
pyenv local 3.5.2
882-
pip install twine
875+
pip install --user twine
883876
twine upload dist/fmriprep* wrapper/dist/fmriprep*
884877
885878
deployable:

.circleci/ds005_outputs.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_space-MNI152NLin2009cAs
6767
fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz
6868
fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_space-MNI152NLin2009cAsym_desc-preproc_bold.json
6969
fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz
70-
fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_space-MNI152NLin2009cAsym_desc-smoothAROMAnonaggr_bold.nii.gz
7170
fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_space-MNI152NLin6Asym_boldref.nii.gz
7271
fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_space-MNI152NLin6Asym_desc-aparcaseg_dseg.nii.gz
7372
fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_space-MNI152NLin6Asym_desc-aseg_dseg.nii.gz
@@ -100,7 +99,6 @@ fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_space-MNI152NLin2009cAs
10099
fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz
101100
fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_space-MNI152NLin2009cAsym_desc-preproc_bold.json
102101
fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz
103-
fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_space-MNI152NLin2009cAsym_desc-smoothAROMAnonaggr_bold.nii.gz
104102
fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_space-MNI152NLin6Asym_boldref.nii.gz
105103
fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_space-MNI152NLin6Asym_desc-aparcaseg_dseg.nii.gz
106104
fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_space-MNI152NLin6Asym_desc-aseg_dseg.nii.gz

.circleci/ds005_partial_outputs.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_space-MNI152NLin2009cAs
6767
fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz
6868
fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_space-MNI152NLin2009cAsym_desc-preproc_bold.json
6969
fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz
70-
fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_space-MNI152NLin2009cAsym_desc-smoothAROMAnonaggr_bold.nii.gz
7170
fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_space-MNI152NLin6Asym_boldref.nii.gz
7271
fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_space-MNI152NLin6Asym_desc-aparcaseg_dseg.nii.gz
7372
fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_space-MNI152NLin6Asym_desc-aseg_dseg.nii.gz

.circleci/pypi_wheel/build-wheels.sh

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

.github/auto-comment.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
pullRequestOpened: |
2+
Thank your for raising your pull request.
3+
4+
Some of the *fMRIPRep* maintainers will review your changes as soon as time permits.
5+
I'm attaching below a *Review Checklist* for the reviewers, to copy and paste
6+
it in their review comment.
7+
8+
```markdown
9+
10+
## PR Review
11+
12+
*Please check off boxes as applicable, and elaborate in comments below. Your review is not limited to these topics, as described in the reviewer guide*
13+
14+
- [ ] As the reviewer I confirm that there are no conflicts of interest for me to review this work.
15+
16+
Please check what applies in the following aspects of the PR:
17+
18+
#### Code documentation
19+
20+
- [ ] New functions and modules are documented following the guidelines.
21+
- [ ] Existing code required amendments in documentation and has been updated.
22+
- [ ] Sufficient inline comments ensure readability by other contributors in the long term.
23+
24+
#### Documentation site
25+
26+
- [ ] The modifications to *fMRIPrep* in this PR **do not require extra documentation**. This is a common situation when a bug fix that does not change the code base substantially is submitted.
27+
- [ ] This PR requires documentation. The corresponding documentation will be submitted as an additional PR in the future.
28+
- [ ] This PR requires extra documentation, and will be included within this PR. Please check the boxes that apply best:
29+
- [ ] An existing feature is substantially modified, changing the interface and/or logic of a module.
30+
- [ ] A new feature is being added, therefore full documentation of it will be included
31+
- [ ] This PR addresses an error in existing documentation.
32+
- [ ] Yes, all expected sections of documentation were generated by the CI build, and look as expected
33+
34+
#### Tests
35+
36+
- [ ] The new functionalities in this PR are covered by the existing tests
37+
- [ ] New test batteries have been included with this PR
38+
39+
#### Data
40+
41+
- [ ] This PR does not require any additional data to be uploaded to OSF.
42+
- [ ] This PR requires additional data for tests.
43+
44+
#### Dependencies: smriprep
45+
46+
- [ ] This PR does not require any update on `smriprep`; or
47+
- [ ] `smriprep` has correctly been pinned.
48+
49+
#### Dependencies: niworkflows
50+
51+
- [ ] This PR does not require any update on `niworkflows`; or
52+
- [ ] `niworkflows` has correctly been pinned.
53+
54+
#### Dependencies: sdcflows
55+
56+
- [ ] This PR does not require any update on `sdcflows`; or
57+
- [ ] `sdcflows` has correctly been pinned.
58+
59+
#### Dependencies: Nipype
60+
61+
- [ ] This PR does not require any update on `nipype`; or
62+
- [ ] `nipype` has correctly been pinned.
63+
64+
#### Dependencies: other
65+
66+
- [ ] This PR does not require any update on other dependencies; or
67+
- [ ] other dependencies have correctly been pinned.
68+
69+
#### Reports generated within CI tests
70+
71+
- [ ] Yes, I have checked the reports of ds005 and they are not modified or the changes are as expected
72+
- [ ] Yes, I have checked the reports of ds054 and they are not modified or the changes are as expected
73+
- [ ] Yes, I have checked the reports of ds010 and they are not modified or the changes are as expected
74+
75+
### Review Comments (other than those left inline with the code)
76+
77+
```

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ var/
2727
*.egg-info/
2828
.installed.cfg
2929
*.egg
30+
pip-wheel-metadata/
3031

3132
# PyInstaller
3233
# Usually these files are written by a python script from a template

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ RUN apt-get update && \
1111
bzip2 \
1212
ca-certificates \
1313
xvfb \
14-
cython3 \
1514
build-essential \
1615
autoconf \
1716
libtool \
@@ -109,10 +108,11 @@ RUN npm install -g [email protected]
109108

110109
# Installing and setting up ICA_AROMA
111110
RUN mkdir -p /opt/ICA-AROMA && \
112-
curl -sSL "https://github.com/maartenmennes/ICA-AROMA/archive/v0.4.4-beta.tar.gz" \
111+
curl -sSL "https://github.com/oesteban/ICA-AROMA/archive/v0.4.5.tar.gz" \
113112
| tar -xzC /opt/ICA-AROMA --strip-components 1 && \
114113
chmod +x /opt/ICA-AROMA/ICA_AROMA.py
115-
ENV PATH=/opt/ICA-AROMA:$PATH
114+
ENV PATH="/opt/ICA-AROMA:$PATH" \
115+
AROMA_VERSION="0.4.5"
116116

117117
# Installing and setting up miniconda
118118
RUN curl -sSLO https://repo.continuum.io/miniconda/Miniconda3-4.5.11-Linux-x86_64.sh && \

README.rst

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
fmriprep: A Robust Preprocessing Pipeline for fMRI Data
2-
=======================================================
1+
*fMRIPrep*: A Robust Preprocessing Pipeline for fMRI Data
2+
=========================================================
33

44
This pipeline is developed by the `Poldrack lab at Stanford University
55
<https://poldracklab.stanford.edu/>`_ for use at the `Center for Reproducible
@@ -43,7 +43,7 @@ About
4343
.. image:: https://github.com/oesteban/fmriprep/raw/38a63e9504ab67812b63813c5fe9af882109408e/docs/_static/fmriprep-workflow-all.png
4444

4545

46-
``fmriprep`` is a functional magnetic resonance imaging (fMRI) data
46+
*fMRIPrep* is a functional magnetic resonance imaging (fMRI) data
4747
preprocessing pipeline that is designed to provide an easily accessible,
4848
state-of-the-art interface that is robust to variations in scan acquisition
4949
protocols and that requires minimal user input, while providing easily
@@ -56,12 +56,12 @@ volume-based statistics, etc.
5656

5757
.. note::
5858

59-
fmriprep performs minimal preprocessing.
59+
*fMRIPrep* performs minimal preprocessing.
6060
Here we define 'minimal preprocessing' as motion correction, field
6161
unwarping, normalization, bias field correction, and brain extraction.
6262
See the workflows_ for more details.
6363

64-
The ``fmriprep`` pipeline uses a combination of tools from well-known software
64+
The *fMRIPrep* pipeline uses a combination of tools from well-known software
6565
packages, including FSL_, ANTs_, FreeSurfer_ and AFNI_.
6666
This pipeline was designed to provide the best software implementation for each
6767
state of preprocessing, and will be updated as newer and better neuroimaging
@@ -86,7 +86,7 @@ https://fmriprep.readthedocs.io/
8686
Principles
8787
----------
8888

89-
``fmriprep`` is built around three principles:
89+
*fMRIPrep* is built around three principles:
9090

9191
1. **Robustness** - The pipeline adapts the preprocessing steps depending on
9292
the input dataset and should provide results as good as possible
@@ -97,22 +97,22 @@ Principles
9797
automatic fashion.
9898
3. **"Glass box"** philosophy - Automation should not mean that one should not
9999
visually inspect the results or understand the methods.
100-
Thus, ``fmriprep`` provides visual reports for each subject, detailing the
100+
Thus, *fMRIPrep* provides visual reports for each subject, detailing the
101101
accuracy of the most important processing steps.
102102
This, combined with the documentation, can help researchers to understand
103103
the process and decide which subjects should be kept for the group level
104104
analysis.
105105

106106

107-
Limitations and reasons not to use ``fmriprep``
108-
-----------------------------------------------
107+
Limitations and reasons not to use *fMRIPrep*
108+
---------------------------------------------
109109

110110
1. Very narrow :abbr:`FoV (field-of-view)` images oftentimes do not contain
111111
enough information for standard image registration methods to work correctly.
112112
Also, problems may arise when extracting the brain from these data.
113113
Supporting these particular images is already a future line of the development
114114
road-map.
115-
2. ``fmriprep`` may also underperform for particular populations (e.g., infants) and
115+
2. *fMRIPrep* may also underperform for particular populations (e.g., infants) and
116116
non-human brains, although appropriate templates can be provided to overcome the
117117
issue.
118118
3. The "EPInorm" approach is currently not supported, although we plan to implement
@@ -131,6 +131,6 @@ Acknowledgements
131131
----------------
132132

133133
Please acknowledge this work by mentioning explicitly the name of this software
134-
(fmriprep) and the version, along with a link to the `GitHub repository
134+
(*fMRIPrep*) and the version, along with a link to the `GitHub repository
135135
<https://github.com/poldracklab/fmriprep>`_ or the Zenodo reference.
136136
For more details, please see :ref:`citation`.

docs/_static/sbatch.slurm

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/bin/bash
2+
#
3+
#SBATCH -J fmriprep
4+
#SBATCH --time=48:00:00
5+
#SBATCH -n 1
6+
#SBATCH --cpus-per-task=16
7+
#SBATCH --mem-per-cpu=4G
8+
#SBATCH -p normal,mygroup # Queue names you can submit to
9+
# Outputs ----------------------------------
10+
#SBATCH -o log/%x-%A-%a.out
11+
#SBATCH -e log/%x-%A-%a.err
12+
#SBATCH --mail-user=%[email protected]
13+
#SBATCH --mail-type=ALL
14+
# ------------------------------------------
15+
16+
BIDS_DIR="$STUDY/data"
17+
DERIVS_DIR="derivatives/fmriprep-1.5.0"
18+
19+
# Prepare some writeable bind-mount points.
20+
TEMPLATEFLOW_HOST_HOME=$HOME/.cache/templateflow
21+
FMRIPREP_HOST_CACHE=$HOME/.cache/fmriprep
22+
mkdir -p ${TEMPLATEFLOW_HOST_HOME}
23+
mkdir -p ${FMRIPREP_HOST_CACHE}
24+
25+
# Prepare derivatives folder
26+
mkdir -p ${BIDS_DIR}/${DERIVS_DIR}
27+
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+
34+
# Make sure FS_LICENSE is defined in the container.
35+
export SINGULARITYENV_FS_LICENSE=$HOME/.freesurfer.txt
36+
37+
# Designate a templateflow bind-mount point
38+
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"
40+
41+
# Parse the participants.tsv file and extract one subject ID from the line corresponding to this SLURM task.
42+
subject=$( sed -n -E "$((${SLURM_ARRAY_TASK_ID} + 1))s/sub-(\S*)\>.*/\1/gp" ${BIDS_DIR}/participants.tsv )
43+
44+
# Remove IsRunning files from FreeSurfer
45+
find ${BIDS_DIR}/derivatives/freesurfer-6.0.1/sub-$subject/ -name "*IsRunning*" -type f -delete
46+
47+
# 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"
49+
50+
# Setup done, run the command
51+
echo Running task ${SLURM_ARRAY_TASK_ID}
52+
echo Commandline: $cmd
53+
eval $cmd
54+
exitcode=$?
55+
56+
# Output results to a table
57+
echo "sub-$subject ${SLURM_ARRAY_TASK_ID} $exitcode" \
58+
>> ${SLURM_JOB_NAME}.${SLURM_ARRAY_JOB_ID}.tsv
59+
echo Finished tasks ${SLURM_ARRAY_TASK_ID} with exit code $exitcode
60+
exit $exitcode

0 commit comments

Comments
 (0)