Skip to content

Commit e4acc15

Browse files
authored
Merge pull request #1482 from oesteban/enh/smriprep
[RF] Use anatomical workflows from sMRIPrep
2 parents 6298bea + b528ee3 commit e4acc15

File tree

11 files changed

+172
-1486
lines changed

11 files changed

+172
-1486
lines changed

.circleci/config.yml

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,8 @@ jobs:
257257
-e FMRIPREP_REGRESSION_TARGETS=/tmp/data/fmriprep_bold_mask \
258258
-e FMRIPREP_REGRESSION_REPORTS=/tmp/data/reports \
259259
--entrypoint="py.test" poldracklab/fmriprep:latest \
260-
/root/src/fmriprep/ \
261-
-svx --doctest-modules --ignore=/root/src/fmriprep/docs --ignore=setup.py
260+
/src/fmriprep/ \
261+
-svx --doctest-modules --ignore=/src/fmriprep/docs --ignore=setup.py
262262
- run:
263263
name: Package new masks
264264
no_output_timeout: 10m
@@ -329,7 +329,7 @@ jobs:
329329
docker run -ti --rm=false -v $PWD:/_build_html \
330330
--entrypoint=sphinx-build poldracklab/fmriprep:latest \
331331
-T -E -b html -d _build/doctrees-readthedocs -W -D \
332-
language=en /root/src/fmriprep/docs/ /_build_html 2>&1 \
332+
language=en /src/fmriprep/docs/ /_build_html 2>&1 \
333333
| tee $PWD/builddocs.log
334334
cat $PWD/builddocs.log
335335
grep -qv "ERROR" $PWD/builddocs.log
@@ -358,10 +358,10 @@ jobs:
358358
at: /tmp
359359
- restore_cache:
360360
keys:
361-
- ds005-anat-v13-{{ .Branch }}-{{ epoch }}
362-
- ds005-anat-v13-{{ .Branch }}
363-
- ds005-anat-v13-master
364-
- ds005-anat-v13-
361+
- ds005-anat-v14-{{ .Branch }}-{{ epoch }}
362+
- ds005-anat-v14-{{ .Branch }}
363+
- ds005-anat-v14-master
364+
- ds005-anat-v14-
365365
- run:
366366
name: Setting up test
367367
command: |
@@ -389,13 +389,13 @@ jobs:
389389
sudo setfacl -d -m group:$(id -gn):rwx /tmp/ds005/work && \
390390
sudo setfacl -m group:$(id -gn):rwx /tmp/ds005/work
391391
fmriprep-docker -i poldracklab/fmriprep:latest \
392-
-e FMRIPREP_DEV 1 -u $(id -u) \
392+
-e FMRIPREP_DEV 1 \
393393
--config $PWD/nipype.cfg -w /tmp/ds005/work \
394394
/tmp/data/ds005 /tmp/ds005/derivatives participant \
395395
--sloppy --write-graph --mem_mb 4096 \
396396
--nthreads 2 --anat-only -vv
397397
- save_cache:
398-
key: ds005-anat-v13-{{ .Branch }}-{{ epoch }}
398+
key: ds005-anat-v14-{{ .Branch }}-{{ epoch }}
399399
paths:
400400
- /tmp/ds005/work
401401

@@ -408,7 +408,7 @@ jobs:
408408
sudo setfacl -d -m group:$(id -gn):rwx /tmp/ds005/work && \
409409
sudo setfacl -m group:$(id -gn):rwx /tmp/ds005/work
410410
fmriprep-docker -i poldracklab/fmriprep:latest \
411-
-e FMRIPREP_DEV 1 -u $(id -u) \
411+
-e FMRIPREP_DEV 1 \
412412
--config $PWD/nipype.cfg -w /tmp/ds005/work \
413413
/tmp/data/ds005 /tmp/ds005/derivatives participant \
414414
--sloppy --write-graph --use-syn-sdc --mem_mb 4096 \
@@ -436,7 +436,7 @@ jobs:
436436
command: |
437437
rm /tmp/data/ds005/sub-01/func/*_run-02_*
438438
fmriprep-docker -i poldracklab/fmriprep:latest \
439-
-e FMRIPREP_DEV 1 -u $(id -u) \
439+
-e FMRIPREP_DEV 1 \
440440
--config $PWD/nipype.cfg -w /tmp/ds005/work \
441441
/tmp/data/ds005 /tmp/ds005/derivatives_partial participant \
442442
--sloppy --write-graph --use-syn-sdc --mem_mb 4096 \
@@ -488,10 +488,10 @@ jobs:
488488
at: /tmp
489489
- restore_cache:
490490
keys:
491-
- ds054-anat-v11-{{ .Branch }}-{{ epoch }}
492-
- ds054-anat-v11-{{ .Branch }}
493-
- ds054-anat-v11-master
494-
- ds054-anat-v11-
491+
- ds054-anat-v12-{{ .Branch }}-{{ epoch }}
492+
- ds054-anat-v12-{{ .Branch }}
493+
- ds054-anat-v12-master
494+
- ds054-anat-v12-
495495
- run:
496496
name: Setting up test
497497
command: |
@@ -525,7 +525,7 @@ jobs:
525525
--fs-no-reconall --sloppy --write-graph \
526526
--mem_mb 4096 --nthreads 2 --anat-only -vv
527527
- save_cache:
528-
key: ds054-anat-v11-{{ .Branch }}-{{ epoch }}
528+
key: ds054-anat-v12-{{ .Branch }}-{{ epoch }}
529529
paths:
530530
- /tmp/ds054/work
531531

@@ -606,10 +606,10 @@ jobs:
606606
at: /tmp
607607
- restore_cache:
608608
keys:
609-
- ds210-anat-v9-{{ .Branch }}-{{ epoch }}
610-
- ds210-anat-v9-{{ .Branch }}
611-
- ds210-anat-v9-master
612-
- ds210-anat-v9-
609+
- ds210-anat-v10-{{ .Branch }}-{{ epoch }}
610+
- ds210-anat-v10-{{ .Branch }}
611+
- ds210-anat-v10-master
612+
- ds210-anat-v10-
613613
- run:
614614
name: Setting up test
615615
command: |
@@ -643,7 +643,7 @@ jobs:
643643
--fs-no-reconall --sloppy --write-graph \
644644
--mem_mb 4096 --nthreads 2 --anat-only -vv
645645
- save_cache:
646-
key: ds210-anat-v9-{{ .Branch }}-{{ epoch }}
646+
key: ds210-anat-v10-{{ .Branch }}-{{ epoch }}
647647
paths:
648648
- /tmp/ds210/work
649649

Dockerfile

Lines changed: 83 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -15,65 +15,81 @@ RUN apt-get update && \
1515
build-essential \
1616
autoconf \
1717
libtool \
18-
pkg-config && \
19-
curl -sSL http://neuro.debian.net/lists/xenial.us-ca.full >> /etc/apt/sources.list.d/neurodebian.sources.list && \
20-
apt-key add /root/.neurodebian.gpg && \
21-
(apt-key adv --refresh-keys --keyserver hkp://ha.pool.sks-keyservers.net 0xA5D32F012649A5A9 || true) && \
22-
apt-get update
18+
pkg-config \
19+
git && \
20+
curl -sL https://deb.nodesource.com/setup_10.x | bash - && \
21+
apt-get install -y --no-install-recommends \
22+
nodejs && \
23+
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
24+
25+
# Install latest pandoc
26+
RUN curl -o pandoc-2.2.2.1-1-amd64.deb -sSL "https://github.com/jgm/pandoc/releases/download/2.2.2.1/pandoc-2.2.2.1-1-amd64.deb" && \
27+
dpkg -i pandoc-2.2.2.1-1-amd64.deb && \
28+
rm pandoc-2.2.2.1-1-amd64.deb
2329

2430
# Installing freesurfer
2531
RUN curl -sSL https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/6.0.1/freesurfer-Linux-centos6_x86_64-stable-pub-v6.0.1.tar.gz | tar zxv --no-same-owner -C /opt \
26-
--exclude='freesurfer/trctrain' \
32+
--exclude='freesurfer/diffusion' \
33+
--exclude='freesurfer/docs' \
34+
--exclude='freesurfer/fsfast' \
35+
--exclude='freesurfer/lib/cuda' \
36+
--exclude='freesurfer/lib/qt' \
37+
--exclude='freesurfer/matlab' \
38+
--exclude='freesurfer/mni/share/man' \
2739
--exclude='freesurfer/subjects/fsaverage_sym' \
2840
--exclude='freesurfer/subjects/fsaverage3' \
2941
--exclude='freesurfer/subjects/fsaverage4' \
3042
--exclude='freesurfer/subjects/cvs_avg35' \
3143
--exclude='freesurfer/subjects/cvs_avg35_inMNI152' \
3244
--exclude='freesurfer/subjects/bert' \
45+
--exclude='freesurfer/subjects/lh.EC_average' \
46+
--exclude='freesurfer/subjects/rh.EC_average' \
47+
--exclude='freesurfer/subjects/sample-*.mgz' \
3348
--exclude='freesurfer/subjects/V1_average' \
34-
--exclude='freesurfer/average/mult-comp-cor' \
35-
--exclude='freesurfer/lib/cuda' \
36-
--exclude='freesurfer/lib/qt'
49+
--exclude='freesurfer/trctrain'
3750

38-
ENV FSL_DIR=/usr/share/fsl/5.0 \
39-
OS=Linux \
51+
ENV FSL_DIR="/usr/share/fsl/5.0" \
52+
OS="Linux" \
4053
FS_OVERRIDE=0 \
41-
FIX_VERTEX_AREA= \
42-
FSF_OUTPUT_FORMAT=nii.gz \
43-
FREESURFER_HOME=/opt/freesurfer
44-
ENV SUBJECTS_DIR=$FREESURFER_HOME/subjects \
45-
FUNCTIONALS_DIR=$FREESURFER_HOME/sessions \
46-
MNI_DIR=$FREESURFER_HOME/mni \
47-
LOCAL_DIR=$FREESURFER_HOME/local \
48-
FSFAST_HOME=$FREESURFER_HOME/fsfast \
49-
MINC_BIN_DIR=$FREESURFER_HOME/mni/bin \
50-
MINC_LIB_DIR=$FREESURFER_HOME/mni/lib \
51-
MNI_DATAPATH=$FREESURFER_HOME/mni/data \
52-
FMRI_ANALYSIS_DIR=$FREESURFER_HOME/fsfast
53-
ENV PERL5LIB=$MINC_LIB_DIR/perl5/5.8.5 \
54-
MNI_PERL5LIB=$MINC_LIB_DIR/perl5/5.8.5 \
55-
PATH=$FREESURFER_HOME/bin:$FSFAST_HOME/bin:$FREESURFER_HOME/tktools:$MINC_BIN_DIR:$PATH
54+
FIX_VERTEX_AREA="" \
55+
FSF_OUTPUT_FORMAT="nii.gz" \
56+
FREESURFER_HOME="/opt/freesurfer"
57+
ENV SUBJECTS_DIR="$FREESURFER_HOME/subjects" \
58+
FUNCTIONALS_DIR="$FREESURFER_HOME/sessions" \
59+
MNI_DIR="$FREESURFER_HOME/mni" \
60+
LOCAL_DIR="$FREESURFER_HOME/local" \
61+
MINC_BIN_DIR="$FREESURFER_HOME/mni/bin" \
62+
MINC_LIB_DIR="$FREESURFER_HOME/mni/lib" \
63+
MNI_DATAPATH="$FREESURFER_HOME/mni/data"
64+
ENV PERL5LIB="$MINC_LIB_DIR/perl5/5.8.5" \
65+
MNI_PERL5LIB="$MINC_LIB_DIR/perl5/5.8.5" \
66+
PATH="$FREESURFER_HOME/bin:$FSFAST_HOME/bin:$FREESURFER_HOME/tktools:$MINC_BIN_DIR:$PATH"
5667

5768
# Installing Neurodebian packages (FSL, AFNI, git)
69+
RUN curl -sSL "http://neuro.debian.net/lists/$( lsb_release -c | cut -f2 ).us-ca.full" >> /etc/apt/sources.list.d/neurodebian.sources.list && \
70+
apt-key add /root/.neurodebian.gpg && \
71+
(apt-key adv --refresh-keys --keyserver hkp://ha.pool.sks-keyservers.net 0xA5D32F012649A5A9 || true)
72+
5873
RUN apt-get update && \
5974
apt-get install -y --no-install-recommends \
6075
fsl-core=5.0.9-5~nd16.04+1 \
61-
fsl-mni152-templates=5.0.7-2 \
6276
afni=16.2.07~dfsg.1-5~nd16.04+1 \
63-
convert3d
64-
65-
ENV FSLDIR=/usr/share/fsl/5.0 \
66-
FSLOUTPUTTYPE=NIFTI_GZ \
67-
FSLMULTIFILEQUIT=TRUE \
68-
POSSUMDIR=/usr/share/fsl/5.0 \
69-
LD_LIBRARY_PATH=/usr/lib/fsl/5.0:$LD_LIBRARY_PATH \
70-
FSLTCLSH=/usr/bin/tclsh \
71-
FSLWISH=/usr/bin/wish \
72-
AFNI_MODELPATH=/usr/lib/afni/models \
73-
AFNI_IMSAVE_WARNINGS=NO \
74-
AFNI_TTATLAS_DATASET=/usr/share/afni/atlases \
75-
AFNI_PLUGINPATH=/usr/lib/afni/plugins
76-
ENV PATH=/usr/lib/fsl/5.0:/usr/lib/afni/bin:$PATH
77+
convert3d \
78+
git-annex-standalone && \
79+
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
80+
81+
ENV FSLDIR="/usr/share/fsl/5.0" \
82+
FSLOUTPUTTYPE="NIFTI_GZ" \
83+
FSLMULTIFILEQUIT="TRUE" \
84+
POSSUMDIR="/usr/share/fsl/5.0" \
85+
LD_LIBRARY_PATH="/usr/lib/fsl/5.0:$LD_LIBRARY_PATH" \
86+
FSLTCLSH="/usr/bin/tclsh" \
87+
FSLWISH="/usr/bin/wish" \
88+
AFNI_MODELPATH="/usr/lib/afni/models" \
89+
AFNI_IMSAVE_WARNINGS="NO" \
90+
AFNI_TTATLAS_DATASET="/usr/share/afni/atlases" \
91+
AFNI_PLUGINPATH="/usr/lib/afni/plugins"
92+
ENV PATH="/usr/lib/fsl/5.0:/usr/lib/afni/bin:$PATH"
7793

7894
# Installing ANTs 2.2.0 (NeuroDocker build)
7995
ENV ANTSPATH=/usr/lib/ants
@@ -123,8 +139,7 @@ RUN conda install -y python=3.7.1 \
123139
libxslt=1.1.32 \
124140
graphviz=2.40.1 \
125141
traits=4.6.0 \
126-
# Make sure zlib is installed
127-
zlib; sync && \
142+
zlib; sync && \
128143
chmod -R a+rX /usr/local/miniconda; sync && \
129144
chmod +x /usr/local/miniconda/bin/*; sync && \
130145
conda clean --all -y; sync && \
@@ -134,49 +149,47 @@ RUN conda install -y python=3.7.1 \
134149
RUN python -c "from matplotlib import font_manager" && \
135150
sed -i 's/\(backend *: \).*$/\1Agg/g' $( python -c "import matplotlib; print(matplotlib.matplotlib_fname())" )
136151

137-
# Installing Ubuntu packages and cleaning up
138-
RUN apt-get update && \
139-
apt-get install -y --no-install-recommends \
140-
git=1:2.7.4-0ubuntu1 && \
141-
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
142-
143-
# Install latest pandoc
144-
RUN curl -o pandoc-2.2.2.1-1-amd64.deb -sSL "https://github.com/jgm/pandoc/releases/download/2.2.2.1/pandoc-2.2.2.1-1-amd64.deb" && \
145-
dpkg -i pandoc-2.2.2.1-1-amd64.deb && \
146-
rm pandoc-2.2.2.1-1-amd64.deb
147-
148152
# Unless otherwise specified each process should only use one thread - nipype
149153
# will handle parallelization
150154
ENV MKL_NUM_THREADS=1 \
151155
OMP_NUM_THREADS=1
152156

153-
WORKDIR /root/
154-
155157
# Precaching atlases
156-
ENV CRN_SHARED_DATA /templateflow
157-
ADD docker/scripts/get_templates.sh get_templates.sh
158-
RUN mkdir $CRN_SHARED_DATA && \
159-
/root/get_templates.sh && \
160-
find $CRN_SHARED_DATA -type d -exec chmod 555 {} \; && \
161-
find $CRN_SHARED_DATA -type f -exec chmod 444 {} \; && \
162-
chmod +w $CRN_SHARED_DATA
158+
WORKDIR /opt
159+
ENV TEMPLATEFLOW_HOME="/opt/templateflow"
160+
RUN pip install "datalad==0.10.0" && \
161+
rm -rf ~/.cache/pip
162+
163+
RUN git config --global user.name "First Last" && \
164+
git config --global user.email "[email protected]" && \
165+
datalad install -r https://github.com/templateflow/templateflow.git
166+
RUN datalad get $TEMPLATEFLOW_HOME/tpl-MNI152NLin2009cAsym/*_T1w.nii.gz \
167+
$TEMPLATEFLOW_HOME/tpl-MNI152NLin2009cAsym/*_desc-brain_mask.nii.gz \
168+
$TEMPLATEFLOW_HOME/tpl-MNI152Lin/*_T1w.nii.gz \
169+
$TEMPLATEFLOW_HOME/tpl-MNI152Lin/*_desc-brain_mask.nii.gz \
170+
$TEMPLATEFLOW_HOME/tpl-OASIS30ANTs/*_T1w.nii.gz \
171+
$TEMPLATEFLOW_HOME/tpl-OASIS30ANTs/tpl-OASIS30ANTs_res-01_desc-brain_mask.nii.gz \
172+
$TEMPLATEFLOW_HOME/tpl-OASIS30ANTs/tpl-OASIS30ANTs_res-01_label-brain_probseg.nii.gz \
173+
$TEMPLATEFLOW_HOME/tpl-OASIS30ANTs/tpl-OASIS30ANTs_res-01_desc-BrainCerebellumExtraction_mask.nii.gz
163174

164175
# Installing dev requirements (packages that are not in pypi)
165-
ADD requirements.txt requirements.txt
176+
WORKDIR /src/
177+
COPY requirements.txt requirements.txt
166178
RUN pip install -r requirements.txt && \
167179
rm -rf ~/.cache/pip
168180

169181
# Installing FMRIPREP
170-
COPY . /root/src/fmriprep
182+
COPY . /src/fmriprep
171183
ARG VERSION
172184
# Force static versioning within container
173-
RUN echo "${VERSION}" > /root/src/fmriprep/fmriprep/VERSION && \
174-
cd /root/src/fmriprep && \
185+
RUN echo "${VERSION}" > /src/fmriprep/fmriprep/VERSION && \
186+
echo "include fmriprep/VERSION" >> /src/fmriprep/MANIFEST.in && \
187+
cd /src/fmriprep && \
175188
pip install .[all] && \
176189
rm -rf ~/.cache/pip
177190

178191
RUN install -m 0755 \
179-
/root/src/fmriprep/scripts/generate_reference_mask.py \
192+
/src/fmriprep/scripts/generate_reference_mask.py \
180193
/usr/local/bin/generate_reference_mask
181194

182195
ENV IS_DOCKER_8395080871=1
@@ -189,8 +202,8 @@ ARG BUILD_DATE
189202
ARG VCS_REF
190203
ARG VERSION
191204
LABEL org.label-schema.build-date=$BUILD_DATE \
192-
org.label-schema.name="FMRIPREP" \
193-
org.label-schema.description="FMRIPREP - robust fMRI preprocessing tool" \
205+
org.label-schema.name="fMRIPrep" \
206+
org.label-schema.description="fMRIPrep - robust fMRI preprocessing tool" \
194207
org.label-schema.url="http://fmriprep.org" \
195208
org.label-schema.vcs-ref=$VCS_REF \
196209
org.label-schema.vcs-url="https://github.com/poldracklab/fmriprep" \

docker/scripts/get_templates.sh

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

docs/environment.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,5 @@ dependencies:
2929
- nitime
3030
- nilearn
3131
- niworkflows>=0.5.4,<0.6
32+
- smriprep>=0.0.4,<0.1.0a0
3233
- tedana>=0.0.5

0 commit comments

Comments
 (0)