Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Add initial FastSurfer interface (WIP) #280

Draft
wants to merge 234 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
234 commits
Select commit Hold shift + click to select a range
f8972da
Initial recipe change to include FastSurfer (GPU) support
pcamach2 Feb 15, 2022
1377f4c
Added function to test for FastSurfer files in --fs-subjects-dir
pcamach2 Apr 20, 2022
9b6251f
Add logger for FastSurfer check
pcamach2 Apr 23, 2022
f301f3a
Add quick fix check for FastSurfer
pcamach2 Apr 23, 2022
f90738a
Removes fastsurfer_bool
pcamach2 Apr 23, 2022
42e6456
Add FastSurfer argument to
pcamach2 Apr 24, 2022
7502350
Add FastSurfer citations
pcamach2 Apr 24, 2022
4cf37e5
Add FastSurfer
pcamach2 Apr 24, 2022
c8d0493
Add FastSurfer python wrapper
pcamach2 Apr 26, 2022
3169bc7
Update .zenodo.json
pcamach2 Apr 26, 2022
d596955
Fix typo
pcamach2 Apr 26, 2022
8feb172
Removes fastsurfer_bool for Flake8 check
pcamach2 Apr 26, 2022
94f962a
Update misc.py
pcamach2 Apr 26, 2022
94d952a
Update fastsurfer.py
pcamach2 Apr 26, 2022
7f9fe47
Update anatomical.py
pcamach2 Apr 26, 2022
55ea6b0
Update .zenodo.json
pcamach2 Apr 26, 2022
4c6828a
Update run.py
pcamach2 Apr 26, 2022
c77ed1d
Update misc.py
pcamach2 Apr 26, 2022
595b001
Address PEP8
pcamach2 Apr 26, 2022
86edc27
Update formatting for PEP8 compliance
pcamach2 Apr 26, 2022
a7c4aa6
Fix formatting for PEP8 compliance
pcamach2 Apr 26, 2022
b5cf10a
Fix formatting for PEP8 compliance
pcamach2 Apr 26, 2022
a93fd77
Fix formatting for PEP8 compliance
pcamach2 Apr 26, 2022
41cfba6
Fix typo
pcamach2 Apr 26, 2022
8f821d2
Revert Convert3D install method from development use case
pcamach2 Apr 26, 2022
e338001
Fix Convert3D
pcamach2 Apr 27, 2022
16d5f09
Pin Jinja2 version to prevent CircleCI build_docs failure
pcamach2 Apr 27, 2022
6973ddd
Fix docstring
pcamach2 Apr 27, 2022
d35eb07
Update example of commandline FastSurfer usage to docstring
pcamach2 Apr 27, 2022
1acc95f
Fix docstring formatting
pcamach2 Apr 27, 2022
a0e2c71
Update fastsurfer.py
pcamach2 Apr 27, 2022
609d00c
Update fastsurfer.py
pcamach2 Apr 27, 2022
6768242
Update fastsurfer.py
pcamach2 Apr 27, 2022
62ffc16
Fix docstrings formatting
pcamach2 Apr 27, 2022
1c55f0d
Update fastsurfer.py
pcamach2 Apr 27, 2022
d0f0f5d
Update fastsurfer.py
pcamach2 Apr 27, 2022
b65c03d
Add code block
pcamach2 Apr 27, 2022
8fc8139
Update fastsurfer.py
pcamach2 Apr 27, 2022
3322cd2
Adds FastSurfer recon workflow
pcamach2 Apr 27, 2022
9d58df9
Add logging of hires if FastSurfer for future use of VINN
pcamach2 Apr 27, 2022
f93e688
Initial draft of including FastSurfer recon wf
pcamach2 Apr 27, 2022
2e89573
Draft FastSurferSource
pcamach2 Apr 28, 2022
e5dab42
Separate surface workflows for FastSurfer and FreeSurfer
pcamach2 Apr 28, 2022
de510df
Include fastsurfer CLI argument
pcamach2 Apr 28, 2022
eddfeae
Format IO specs
pcamach2 Apr 28, 2022
b2e5376
DRAFT: Adds more of output traits
pcamach2 Apr 28, 2022
db2aeec
Debug Convert3D download and install failure in CI
pcamach2 Apr 28, 2022
48c7193
Include DKTatlas outputs, other files
pcamach2 Apr 29, 2022
93e9ee5
Fix conditional for surface workflows
pcamach2 Apr 29, 2022
9e8e22f
Increase mem for FastSurfer recon
pcamach2 Apr 29, 2022
ca039f0
Change URL to debug Convert3D install
pcamach2 Apr 29, 2022
f417766
Fix formatting on FastSCommand docstring
pcamach2 Apr 29, 2022
444d476
Added FastSurfer workflow
pcamach2 Apr 29, 2022
327cef0
Adds FastSurfer detailed outputs to FastSCommand output_spec
pcamach2 Apr 29, 2022
1b67033
Merge pull request #1 from pcamach2/pcamach2-fastsurfer-patch-v2
pcamach2 Apr 29, 2022
2a70ac9
Fix formatting for PEP8
pcamach2 Apr 29, 2022
7e2d53c
Fix formatting for PEP8
pcamach2 Apr 29, 2022
e52fd53
Fix formatting for PEP8
pcamach2 Apr 29, 2022
6545c6d
Fix formatting for PEP8
pcamach2 Apr 29, 2022
8d608b5
Fix formatting for PEP8
pcamach2 Apr 29, 2022
2f2560c
Debug convert3d install
pcamach2 Apr 29, 2022
126b0b5
Fix typo in _get_files
pcamach2 Apr 29, 2022
a5f1690
Add OutputMultiPath import
pcamach2 Apr 29, 2022
3613a05
Add import IOBase
pcamach2 Apr 29, 2022
9bab131
Fix docstring for FastSCommand
pcamach2 Apr 29, 2022
8321407
Remove code-block to debug docstring error
pcamach2 Apr 29, 2022
4753d32
Switch to FastSurfer dev image for Ubuntu 20.04
pcamach2 Apr 30, 2022
ac52464
Change FastSurfer directory to match Dockerfile
pcamach2 Apr 30, 2022
9a89867
Fix formatting for PEP8
pcamach2 Apr 30, 2022
2a56ff1
Include FastSurfer
pcamach2 Apr 30, 2022
c65d4c5
Add FastSurfer
pcamach2 Apr 30, 2022
265eb54
Change default license directory
pcamach2 Apr 30, 2022
6237a00
Switch check_fastsufer to only return boolean
pcamach2 Apr 30, 2022
592a543
Update description of check_fastsurfer
pcamach2 Apr 30, 2022
5737828
Adds FastSurfer reporting
pcamach2 Apr 30, 2022
81742b1
Fix formatting for PEP8
pcamach2 Apr 30, 2022
79e3c05
Fix formatting for PEP8
pcamach2 Apr 30, 2022
954d3a3
Fix formatting for PEP8
pcamach2 Apr 30, 2022
b9d24a8
Fix formatting for PEP8
pcamach2 Apr 30, 2022
58d5be8
Fix formatting for PEP8
pcamach2 Apr 30, 2022
067e505
Fix typo
pcamach2 Apr 30, 2022
9455019
Fix syntax
pcamach2 Apr 30, 2022
a192fd3
Fix variables for FastSurfer reports
pcamach2 Apr 30, 2022
b00bc95
Update fastsurfer.py
pcamach2 Apr 30, 2022
a545a02
Fix syntax
pcamach2 Apr 30, 2022
705ce9e
Fix syntax for PEP8
pcamach2 Apr 30, 2022
ee535a0
Add fastsurfer input to init_anat_derivatives
pcamach2 Apr 30, 2022
f03fd64
Add FastSurfer parameter to init_anat_reports_wf
pcamach2 May 1, 2022
7a76f96
Set FastSurfer parameter default to False
pcamach2 May 1, 2022
aa49b70
Switch fs_license to use FS_LICENSE os env var
pcamach2 May 1, 2022
8eae255
Add fastsurfer argument to init_anat_reports_wf
pcamach2 May 1, 2022
d2c50a4
Add default path for freesurfer license as /opt/freesurfer/license.txt
pcamach2 May 1, 2022
7262453
Fix typo
pcamach2 May 1, 2022
7fbd489
Add omp_nthreads and hires arguments to init_surface_recon_wf
pcamach2 May 1, 2022
cb65d08
Fix conditionals for FastSurfer in init_gifti_surface_wf & init_segs_…
pcamach2 May 1, 2022
bd9c11e
Fix formatting for PEP8
pcamach2 May 1, 2022
994d352
Switch fs_license default to $FREESURFER_HOME/license.txt
pcamach2 May 1, 2022
a4fa911
Fix formatting for PEP8
pcamach2 May 1, 2022
6d43967
Remove os.environ method of setting fs_license
pcamach2 May 2, 2022
b19510f
Update method for testing fs_license paths
pcamach2 May 2, 2022
7444df5
Update anatomical.py
pcamach2 May 2, 2022
c59e917
Fix formatting for PEP8
pcamach2 May 2, 2022
5cbf0ff
Call check_fastsurfer for conditionals
pcamach2 May 2, 2022
d5b11c3
Pass fastsurfer parameter instead of check_fastsurfer
pcamach2 May 2, 2022
32a62f3
Fix formatting for PEP8
pcamach2 May 2, 2022
c2b3fa6
Fix missing parameter for FastSurfer
pcamach2 May 2, 2022
62667d4
remove duplicate nodes
pcamach2 May 3, 2022
f275c4a
Fix opts fastsurfer typo
pcamach2 May 3, 2022
56dff95
Fix conditional to check opts.fastsurfer
pcamach2 May 4, 2022
86d7aa2
Revert from FastSurfer Docker style Freesurfer install
pcamach2 May 4, 2022
6f9701c
Update Dockerfile
pcamach2 May 4, 2022
8d8381f
Default fastsurfer_status set to "Not run"
pcamach2 May 4, 2022
ff60562
Fix docstring for FastSCommand
pcamach2 May 4, 2022
9fe2cda
Update fastsurfer.py
pcamach2 May 4, 2022
6fa46e2
fix docstring for FastSCommand
pcamach2 May 4, 2022
0b5d07e
Update fastsurfer.py
pcamach2 May 4, 2022
d0d753a
Fix imports to resolve Flake8 F821 errors
pcamach2 May 4, 2022
ab65e0d
Fix typo and switch logger to LOGGER
pcamach2 May 4, 2022
049937d
Fix indentation for continuation lines Flake8 E122
pcamach2 May 4, 2022
04b5888
Fix Flake8 error E302 expected 2 blank lines, found 1
pcamach2 May 4, 2022
d6f24c5
Fix variable names in fs-subjects-dir nodes
pcamach2 May 4, 2022
280ca53
Fix conda base env for FastSurfer
pcamach2 May 4, 2022
9c5d271
Switch to newer Freesurfer 7.2.0 for FastSufer forward compatibility
pcamach2 May 6, 2022
d433f3b
Creates Dockerfile for stable FastSurfer version, FreeSurfer 6.0.1 co…
pcamach2 May 6, 2022
7a6a6e8
Remove unnecessary copy instruction
pcamach2 May 6, 2022
960fdee
Revert to python3.6 for FastSurfer 1.0.1
pcamach2 May 6, 2022
f79f21c
Remove redundancies in conda envs
pcamach2 May 6, 2022
dc2c5f7
Update Dockerfile
pcamach2 May 7, 2022
bd40cb6
Fix: remove redundant conda build instructions and venv
pcamach2 May 9, 2022
cd4730f
Merge branch 'master' into pcamach2-fastsurfer-patch
pcamach2 May 24, 2022
0784da5
Fix retrieval of FastSurfer dev branch
pcamach2 May 24, 2022
ebd3318
Fix layer order
pcamach2 May 24, 2022
c6e9741
Fix missing libs
pcamach2 May 25, 2022
532313e
Update arguments for fastsurfer
pcamach2 Jun 23, 2022
219a422
Fix support for fastsurfer workflow
pcamach2 Jun 23, 2022
97accf4
Fix workflow for FastSurfer
pcamach2 Jun 23, 2022
26647bb
Fix PEP8 compliance
pcamach2 Jun 23, 2022
0b20fdd
Fix PEP8 compliance
pcamach2 Jun 23, 2022
5328f39
Fix PEP8 compliance
pcamach2 Jun 23, 2022
83a4a8e
Fix PEP8 compliance
pcamach2 Jun 23, 2022
fc0d34e
Merge pull request #2 from nipreps/master
pcamach2 Jul 5, 2022
c093515
Add FastSurfer
pcamach2 Jul 5, 2022
e290f89
Update for compatibility with FastSurfer
pcamach2 Jul 5, 2022
5e5f56d
Update for FastSurfer compatibility
pcamach2 Jul 5, 2022
15cbfb9
Add compatibility with FastSurfer
pcamach2 Jul 5, 2022
25c2305
Add files via upload
pcamach2 Jul 5, 2022
239b01a
Update run.py
pcamach2 Jul 5, 2022
fcd66b4
PEP8 compliance
pcamach2 Jul 5, 2022
d6c16ce
PEP8 compliance
pcamach2 Jul 5, 2022
84938f4
PEP8 compliance
pcamach2 Jul 5, 2022
051580e
Fix Flake8 compliance
pcamach2 Jul 5, 2022
a95b94f
Remove print command artifact from dev testing
pcamach2 Jul 5, 2022
ab0fe2f
Comment out unused import
pcamach2 Jul 5, 2022
fbcd2e4
Update FastSurfer, Freesurfer versions
pcamach2 Jul 6, 2022
a32ce8b
Delete unused Dockerfile
pcamach2 Jul 6, 2022
dfda235
Add explicit in-tree-build argument to pip, debug conda
pcamach2 Jul 6, 2022
f031a40
Update fastsurfer.py
pcamach2 Jul 8, 2022
d17aa7b
Comment out unused import os package
pcamach2 Jul 8, 2022
9263ebb
Merge branch 'master' into pcamach2-fastsurfer-patch
effigies Jul 27, 2022
8e1f998
Update smriprep/interfaces/fastsurfer.py
pcamach2 Aug 1, 2022
26409f4
Apply suggestions from code review
pcamach2 Aug 1, 2022
21d3eff
Update smriprep/cli/run.py
pcamach2 Aug 1, 2022
db59431
Fix logic in surface recon workflow selection
pcamach2 Aug 1, 2022
0e12ed8
Revert to previous outputnode for existing FreeSurfer compatibility
pcamach2 Aug 1, 2022
b89254d
Update smriprep/workflows/anatomical.py
pcamach2 Aug 1, 2022
25c6399
Deduplicating get_surfaces and fssource
pcamach2 Aug 1, 2022
0ea2473
Remove unnecessary FastSurfer report class
pcamach2 Aug 1, 2022
4431be2
Add FASTSURFER_HOME to PATH
pcamach2 Aug 1, 2022
7575402
Update default python version and remove unused default values for in…
pcamach2 Aug 1, 2022
415163c
Sub-class FastSurerSourceOutputSpec from FSSourceOutputSpec
pcamach2 Aug 3, 2022
ac9aa33
De-duplicating surface_recon_wf
pcamach2 Aug 3, 2022
313576e
PEP8 compliance
pcamach2 Aug 3, 2022
e4d7e4d
PEP8 compliance
pcamach2 Aug 3, 2022
5d015ed
PEP8 compliance
pcamach2 Aug 3, 2022
6643b93
PEP8 compliance
pcamach2 Aug 3, 2022
573f0b3
PEP8 compliance
pcamach2 Aug 3, 2022
9bdb72c
Revert to FSSurfaceReport for FastSurfer
pcamach2 Aug 3, 2022
4247e71
Import FreeSurferSource
pcamach2 Aug 3, 2022
5cacac2
Fix typo
pcamach2 Aug 3, 2022
dde9494
Fix typo
pcamach2 Aug 3, 2022
73cfea8
Attempt to fix docstring error in build_docs
pcamach2 Aug 3, 2022
2cbd94a
Revert from FastSurfer v FreeSurfer specific string vars to nipype co…
pcamach2 Aug 4, 2022
712385d
Merge pull request #3 from nipreps/master
pcamach2 Aug 12, 2022
3a535c9
Update python version
pcamach2 Aug 12, 2022
4a4f7a0
Revert miniconda version for FastSurfer compatibility, update nibabel
pcamach2 Aug 15, 2022
18c4117
Nibabel==4.0.1 install after fastsurfer environment update
pcamach2 Aug 15, 2022
0a1ec70
Switch to python 3.8
pcamach2 Aug 16, 2022
98c3a87
Upgrade to latest FastSurfer release v1.1.1
pcamach2 Aug 18, 2022
9b517ec
Update FastSurfer version
pcamach2 Aug 18, 2022
b18e440
Switch to Nibabel 4.0.2
pcamach2 Sep 1, 2022
de08d59
Install nibabel via conda
pcamach2 Sep 1, 2022
1a041ca
Attempt to resolve CircleCI build error
pcamach2 Sep 1, 2022
0c49007
De-duplicating workflow
pcamach2 Sep 1, 2022
73116bb
Remove unused package imports (Flake8 compliance)
pcamach2 Sep 1, 2022
aedf220
Update FastSurfer version
pcamach2 Sep 22, 2022
1094e04
Update installation.rst
pcamach2 Sep 22, 2022
182f47e
Merge branch 'master' into pcamach2-fastsurfer-patch
pcamach2 Oct 18, 2022
87940c9
Fix error for Flake8
pcamach2 Oct 18, 2022
1c1fc21
Fix typo in FastSurfer version
pcamach2 Oct 18, 2022
1bdf326
Change nibabel version after installing FastSurfer dependencies
pcamach2 Oct 19, 2022
6d8e32d
update authors
pcamach2 Jan 6, 2023
3f6b1f6
Merge branch 'nipreps-master' into pcamach2-fastsurfer-patch
pcamach2 Jan 6, 2023
96edd2a
Test FreeSurfer license path fix
pcamach2 Jan 9, 2023
dbb647b
Update Dockerfile
pcamach2 Jan 9, 2023
e9673a7
Update run.py
pcamach2 Jan 9, 2023
8bcb69c
Update run.py
pcamach2 Jan 10, 2023
92c2bbc
Update to FastSurfer v2.0.0
pcamach2 Jan 12, 2023
45d2b54
Fix typo in FastSurfer git clone
pcamach2 Jan 12, 2023
e026c6d
Update FastSurfer version
pcamach2 Jan 30, 2023
e5fbb1c
Update Dockerfile
pcamach2 Jan 30, 2023
2263258
Remove unnecessary SetUpFreeSurfer.sh from bashrc
pcamach2 Jan 30, 2023
f9b9e79
Merge branch 'master' into pcamach2-fastsurfer-patch
pcamach2 Jan 31, 2023
539fe07
Update FastSurfer version
pcamach2 Jan 31, 2023
5c4e680
Restore FS_LICENSE generation from B64
pcamach2 Feb 15, 2023
8f2f0ca
Remove branch tags
pcamach2 Feb 16, 2023
016dc5c
Merge remote-tracking branch 'origin/master' into pcamach2-fastsurfer…
pcamach2 Feb 21, 2023
721ab2c
Merge remote-tracking branch 'origin/master' into pcamach2-fastsurfer…
pcamach2 Feb 21, 2023
0c3c420
Merge branch 'master' into pcamach2-fastsurfer-patch
pcamach2 Feb 21, 2023
7154e1b
Add checkpoints for FastSurfer from FastSurfer Dockerfile
pcamach2 Feb 21, 2023
d2feae9
Switch order of conda env updates
pcamach2 Feb 21, 2023
d0e8a3f
Update FastSurfer to v2.0.4
pcamach2 Feb 22, 2023
d869a16
Reorder FastSurfer directory copy and remove unused git clone
pcamach2 Feb 23, 2023
018da7f
Merge branch 'master' into pcamach2-fastsurfer-patch
pcamach2 Mar 7, 2023
b6f083a
Debugging FastSurfer Workflow
pcamach2 Mar 21, 2023
5d82055
Debugging FastSurfer Workflow
pcamach2 Mar 21, 2023
9b891fa
Debugging FastSurfer Workflow
pcamach2 Mar 21, 2023
90979a7
Merge pull request #6 from nipreps/master
pcamach2 Mar 21, 2023
dffab67
Merge branch 'nipreps:master' into pcamach2-fastsurfer-patch
pcamach2 May 16, 2023
e810a7c
Include mri_mc for FastSurfer compatibility
pcamach2 May 17, 2023
3cee842
Remove exclusion of files needed for FastSurfer v2.0.4
pcamach2 May 18, 2023
456b03a
Remove repeated package installations
pcamach2 May 18, 2023
b5a1bb7
Debugging workflows for FastSurfer
pcamach2 May 18, 2023
ff91fea
Add files via upload
pcamach2 May 18, 2023
ef1054c
Change inputs and defaults to match FastSurfer v2.0.4 CLI
pcamach2 May 18, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"esbonio.server.enabled": false
}
5 changes: 5 additions & 0 deletions .zenodo.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@
"orcid": "0000-0002-5312-6729",
"type": "Researcher"
},
{
"affiliation": "Beckman Institute for Advanced Science & Technology, University of Illinois at Urbana-Champaign, IL, USA",
"name": "Camacho, Paul B.",
"orcid": "0000-0001-9048-7307",
},
{
"affiliation": "Department of Pediatrics, University of Minnesota, MN, USA",
"name": "Feczko, Eric",
Expand Down
64 changes: 55 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ RUN python -m build /src/fmriprep
FROM ubuntu:jammy-20221130

# Prepare environment
ENV DEBIAN_FRONTEND="noninteractive"
ENV LANG=C.UTF-8
ARG PYTHON_VERSION=3.8
ARG CONDA_FILE=Miniconda3-py38_4.11.0-Linux-x86_64.sh
ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && \
apt-get install -y --no-install-recommends \
apt-utils \
Expand All @@ -41,6 +47,9 @@ RUN apt-get update && \
bzip2 \
ca-certificates \
curl \
wget \
upx \
file \
git \
gnupg \
libtool \
Expand All @@ -51,15 +60,45 @@ RUN apt-get update && \
xvfb && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

ENV DEBIAN_FRONTEND="noninteractive" \
LANG="en_US.UTF-8" \
LC_ALL="en_US.UTF-8"
# git clone stable branch of FastSurfer
RUN cd /opt && mkdir /fastsurfer \
&& git clone -b v2.0.4 https://github.com/Deep-MI/FastSurfer.git \
&& cp /opt/FastSurfer/fastsurfer_env_gpu.yml /fastsurfer/fastsurfer_env_gpu.yml

# Copy fastsurfer from git folder
RUN cp -R /opt/FastSurfer/* /fastsurfer/ && rm -rf /opt/FastSurfer

# Install conda
RUN wget --no-check-certificate -qO ~/miniconda.sh https://repo.continuum.io/miniconda/$CONDA_FILE && \
chmod +x ~/miniconda.sh && \
~/miniconda.sh -b -p /opt/conda && \
rm ~/miniconda.sh

# Installing freesurfer
COPY docker/files/freesurfer7.3.2-exclude.txt /usr/local/etc/freesurfer7.3.2-exclude.txt
RUN curl -sSL https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/7.3.2/freesurfer-linux-ubuntu22_amd64-7.3.2.tar.gz \
| tar zxv --no-same-owner -C /opt --exclude-from=/usr/local/etc/freesurfer7.3.2-exclude.txt

# Install required packages for freesurfer to run
RUN apt-get update && apt-get install -y --no-install-recommends \
tcsh \
time \
bc \
gawk \
libgomp1 && \
apt clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Add FreeSurfer Environment variables
ENV OS=Linux \
FS_OVERRIDE=0 \
FIX_VERTEX_AREA= \
SUBJECTS_DIR=/opt/freesurfer/subjects \
FSF_OUTPUT_FORMAT=nii.gz \
FREESURFER_HOME=/opt/freesurfer \
PYTHONUNBUFFERED=0 \
PATH=/opt/freesurfer/bin:$PATH

# Simulate SetUpFreeSurfer.sh
ENV FSL_DIR="/opt/fsl-6.0.5.1" \
OS="Linux" \
Expand Down Expand Up @@ -89,7 +128,6 @@ RUN apt-get update -qq \
libgl1-mesa-dev \
libgl1-mesa-dri \
libglu1-mesa-dev \
libgomp1 \
libice6 \
libxcursor1 \
libxft2 \
Expand All @@ -98,6 +136,7 @@ RUN apt-get update -qq \
libxrender1 \
libxt6 \
sudo \
curl \
wget \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
Expand Down Expand Up @@ -167,21 +206,16 @@ RUN GNUPGHOME=/tmp gpg --keyserver hkps://keyserver.ubuntu.com --no-default-keyr
# AFNI latest (neurodocker build)
RUN apt-get update -qq \
&& apt-get install -y -q --no-install-recommends \
apt-utils \
ed \
gsl-bin \
libglib2.0-0 \
libglu1-mesa-dev \
libglw1-mesa \
libgomp1 \
libjpeg62 \
libpng12-0 \
libxm4 \
libxp6 \
netpbm \
tcsh \
xfonts-base \
xvfb \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& curl -sSL --retry 5 -o /tmp/multiarch.deb http://archive.ubuntu.com/ubuntu/pool/main/g/glibc/multiarch-support_2.27-3ubuntu1.5_amd64.deb \
Expand Down Expand Up @@ -281,10 +315,16 @@ RUN /opt/conda/bin/python fetch_templates.py && \
find $HOME/.cache/templateflow -type d -exec chmod go=u {} + && \
find $HOME/.cache/templateflow -type f -exec chmod go=u {} +

# Installing FastSurfer gpu dependencies
RUN conda env update -n base --file /fastsurfer/fastsurfer_env_gpu.yml

# Installing sMRIPREP
COPY --from=src /src/fmriprep/dist/*.whl .
RUN /opt/conda/bin/python -m pip install --no-cache-dir $( ls *.whl )[all]

# Installing nibabel version 4.0.2
RUN /opt/conda/bin/python -m pip install --no-cache-dir nibabel==4.0.2

RUN find $HOME -type d -exec chmod go=u {} + && \
find $HOME -type f -exec chmod go=u {} + && \
rm -rf $HOME/.npm $HOME/.conda $HOME/.empty
Expand All @@ -294,6 +334,12 @@ RUN find $HOME -type d -exec chmod go=u {} + && \
ENV FREESURFER="/opt/freesurfer"

ENV IS_DOCKER_8395080871=1
ENV FASTSURFER_HOME=/fastsurfer
ENV PATH="$PATH:/fastsurfer"

# Download all remote network checkpoints already
ENV PYTHONPATH=/fastsurfer:$PYTHONPATH
RUN cd /fastsurfer ; python3 FastSurferCNN/download_checkpoints.py --all

RUN ldconfig
WORKDIR /tmp
Expand Down
19 changes: 0 additions & 19 deletions docker/files/freesurfer7.3.2-exclude.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,10 @@ freesurfer/average/3T18yoSchwartzReactN32_as_orig.4dfp.img
freesurfer/average/3T18yoSchwartzReactN32_as_orig.4dfp.img.rec
freesurfer/average/3T18yoSchwartzReactN32_as_orig.4dfp.mat
freesurfer/average/3T18yoSchwartzReactN32_as_orig.lst
freesurfer/average/711-2B_as_mni_average_305.4dfp.hdr
freesurfer/average/711-2B_as_mni_average_305.4dfp.ifh
freesurfer/average/711-2B_as_mni_average_305.4dfp.img
freesurfer/average/711-2B_as_mni_average_305.4dfp.img.rec
freesurfer/average/711-2B_as_mni_average_305_mask.4dfp.hdr
freesurfer/average/711-2B_as_mni_average_305_mask.4dfp.img.rec
freesurfer/average/711-2C_as_mni_average_305.4dfp.hdr
freesurfer/average/711-2C_as_mni_average_305.4dfp.img.rec
freesurfer/average/711-2C_as_mni_average_305.4dfp.mat
freesurfer/average/aseg+spmhead+vermis+pons.ixi.gca
freesurfer/average/BrainstemSS
freesurfer/average/Buckner_JNeurophysiol11_MNI152
freesurfer/average/Choi_JNeurophysiol12_MNI152
freesurfer/average/colortable_desikan_killiany.txt
freesurfer/average/face.gca
freesurfer/average/HippoSF
freesurfer/average/label_scales.dat
Expand All @@ -41,7 +31,6 @@ freesurfer/average/mni305.cor.subfov1.mgz
freesurfer/average/mni305.cor.subfov1.reg
freesurfer/average/mni305.cor.subfov2.mgz
freesurfer/average/mni305.cor.subfov2.reg
freesurfer/average/mni305.mask.cor.mgz
freesurfer/average/mni_average_305.4dfp.hdr
freesurfer/average/mni_average_305.4dfp.ifh
freesurfer/average/mni_average_305.4dfp.img
Expand Down Expand Up @@ -420,7 +409,6 @@ freesurfer/bin/mri_make_template
freesurfer/bin/mri_map_cpdat
freesurfer/bin/mri_maps2csd
freesurfer/bin/mri_mark_temporal_lobe
freesurfer/bin/mri_mc
freesurfer/bin/mri_mcsim
freesurfer/bin/mri_mergelabels
freesurfer/bin/mri_mi
Expand Down Expand Up @@ -504,7 +492,6 @@ freesurfer/bin/mris_gradient
freesurfer/bin/mris_hausdorff_dist
freesurfer/bin/mris_image2vtk
freesurfer/bin/mri_simulate_atrophy
freesurfer/bin/mris_info
freesurfer/bin/mris_init_global_tractography
freesurfer/bin/mris_intensity_profile
freesurfer/bin/mris_interpolate_warp
Expand Down Expand Up @@ -548,7 +535,6 @@ freesurfer/bin/mris_rf_label
freesurfer/bin/mris_rf_train
freesurfer/bin/mris_rotate
freesurfer/bin/mris_sample_label
freesurfer/bin/mris_sample_parc
freesurfer/bin/mris_seg2annot
freesurfer/bin/mris_segment
freesurfer/bin/mris_segmentation_stats
Expand Down Expand Up @@ -749,11 +735,9 @@ freesurfer/bin/xhemireg
freesurfer/bin/xhemi-tal
freesurfer/bin/xsanatreg
freesurfer/bin/zero_lt_4dfp
freesurfer/DefectLUT.txt
freesurfer/diffusion
freesurfer/docs/xml
freesurfer/FreeSurferEnv.csh
freesurfer/FreeSurferEnv.sh
freesurfer/fsfast
freesurfer/lib/bem/ic0.tri
freesurfer/lib/bem/ic1.tri
Expand Down Expand Up @@ -861,11 +845,8 @@ freesurfer/python/lib/python3.8/site-packages/torch
freesurfer/python/lib/python3.8/site-packages/**/tests
freesurfer/python/**/__pycache__
freesurfer/python/share
freesurfer/SegmentNoLUT.txt
freesurfer/sessions
freesurfer/SetUpFreeSurfer.csh
freesurfer/SetUpFreeSurfer.sh
freesurfer/Simple_surface_labels2009.txt
freesurfer/sources.sh
freesurfer/subjects/bert
freesurfer/subjects/cvs_avg35
Expand Down
3 changes: 2 additions & 1 deletion docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -148,5 +148,6 @@ the ``smriprep`` package:
- ANTs_ (version 2.2.0 - NeuroDocker build)
- AFNI_ (version Debian-16.2.07)
- `C3D <https://sourceforge.net/projects/c3d/>`_ (version 1.0.0)
- FreeSurfer_ (version 6.0.1)
- FreeSurfer_ (version 7.2.0)
- `bids-validator <https://github.com/bids-standard/bids-validator>`_ (version 1.1.0)
- FastSurfer_ (version 2.0.1)
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ sphinx
sphinx_rtd_theme
sphinxcontrib-apidoc ~= 0.3.0
templateflow
networkx != 2.8.1
networkx != 2.8.1
21 changes: 20 additions & 1 deletion smriprep/cli/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,14 +222,21 @@ def get_parser():
dest="hires",
help="disable sub-millimeter (hires) reconstruction",
)
g_surfs_xor = g_surfs.add_mutually_exclusive_group()

g_surfs_xor = g_surfs.add_mutually_exclusive_group()
g_surfs_xor.add_argument(
"--fs-no-reconall",
action="store_false",
dest="run_reconall",
help="disable FreeSurfer surface preprocessing.",
)
g_surfs_xor.add_argument(
"--fastsurfer",
action="store_true",
default=False,
dest="fastsurfer",
help="enable FastSurfer surface preprocessing.",
)

g_other = parser.add_argument_group("Other options")
g_other.add_argument(
Expand Down Expand Up @@ -394,6 +401,17 @@ def _warn_redirect(message, category, filename, lineno, file=None, line=None):
from templateflow import api
from niworkflows.utils.misc import _copy_any

dseg_tsv = str(api.get("fsaverage", suffix="dseg", extension=[".tsv"]))
_copy_any(
dseg_tsv, str(Path(output_dir) / "smriprep" / "desc-aseg_dseg.tsv")
)
_copy_any(
dseg_tsv, str(Path(output_dir) / "smriprep" / "desc-aparcaseg_dseg.tsv")
)
elif opts.fastsurfer:
pcamach2 marked this conversation as resolved.
Show resolved Hide resolved
from templateflow import api
from niworkflows.utils.misc import _copy_any

dseg_tsv = str(api.get("fsaverage", suffix="dseg", extension=[".tsv"]))
_copy_any(
dseg_tsv, str(Path(output_dir) / "smriprep" / "desc-aseg_dseg.tsv")
Expand Down Expand Up @@ -584,6 +602,7 @@ def build_workflow(opts, retval):
freesurfer=opts.run_reconall,
fs_subjects_dir=opts.fs_subjects_dir,
hires=opts.hires,
fastsurfer=opts.fastsurfer,
layout=layout,
longitudinal=opts.longitudinal,
low_mem=opts.low_mem,
Expand Down
28 changes: 28 additions & 0 deletions smriprep/data/boilerplate.bib
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,34 @@ @article{fs_reconall
year = 1999
}

@article{fastsurfer,
title = {FastSurfer - A fast and accurate deep learning based neuroimaging pipeline},
journal = {NeuroImage},
volume = {219},
pages = {117012},
year = {2020},
issn = {1053-8119},
doi = {https://doi.org/10.1016/j.neuroimage.2020.117012},
url = {https://www.sciencedirect.com/science/article/pii/S1053811920304985},
author = {Leonie Henschel and Sailesh Conjeti and Santiago Estrada and Kersten Diers and Bruce Fischl and Martin Reuter},
keywords = {Freesurfer, Computational neuroimaging, Deep learning, Structural MRI, Artificial intelligence},
abstract = {Traditional neuroimage analysis pipelines involve computationally intensive, time-consuming optimization steps, and thus, do not scale well to large cohort studies with thousands or tens of thousands of individuals. In this work we propose a fast and accurate deep learning based neuroimaging pipeline for the automated processing of structural human brain MRI scans, replicating FreeSurfer’s anatomical segmentation including surface reconstruction and cortical parcellation. To this end, we introduce an advanced deep learning architecture capable of whole-brain segmentation into 95 classes. The network architecture incorporates local and global competition via competitive dense blocks and competitive skip pathways, as well as multi-slice information aggregation that specifically tailor network performance towards accurate segmentation of both cortical and subcortical structures. Further, we perform fast cortical surface reconstruction and thickness analysis by introducing a spectral spherical embedding and by directly mapping the cortical labels from the image to the surface. This approach provides a full FreeSurfer alternative for volumetric analysis (in under 1 ​min) and surface-based thickness analysis (within only around 1 ​h runtime). For sustainability of this approach we perform extensive validation: we assert high segmentation accuracy on several unseen datasets, measure generalizability and demonstrate increased test-retest reliability, and high sensitivity to group differences in dementia.}
}

@article{fastsufrer_hires,
title = {FastSurferVINN: Building resolution-independence into deep learning segmentation methods—A solution for HighRes brain MRI},
journal = {NeuroImage},
volume = {251},
pages = {118933},
year = {2022},
issn = {1053-8119},
doi = {https://doi.org/10.1016/j.neuroimage.2022.118933},
url = {https://www.sciencedirect.com/science/article/pii/S1053811922000623},
author = {Leonie Henschel and David Kügler and Martin Reuter},
keywords = {Computational neuroimaging, Deep learning, Structural MRI, Artificial intelligence, High-resolution},
abstract = {Leading neuroimaging studies have pushed 3T MRI acquisition resolutions below 1.0 mm for improved structure definition and morphometry. Yet, only few, time-intensive automated image analysis pipelines have been validated for high-resolution (HiRes) settings. Efficient deep learning approaches, on the other hand, rarely support more than one fixed resolution (usually 1.0 mm). Furthermore, the lack of a standard submillimeter resolution as well as limited availability of diverse HiRes data with sufficient coverage of scanner, age, diseases, or genetic variance poses additional, unsolved challenges for training HiRes networks. Incorporating resolution-independence into deep learning-based segmentation, i.e., the ability to segment images at their native resolution across a range of different voxel sizes, promises to overcome these challenges, yet no such approach currently exists. We now fill this gap by introducing a Voxel-size Independent Neural Network (VINN) for resolution-independent segmentation tasks and present FastSurferVINN, which (i) establishes and implements resolution-independence for deep learning as the first method simultaneously supporting 0.7–1.0 mm whole brain segmentation, (ii) significantly outperforms state-of-the-art methods across resolutions, and (iii) mitigates the data imbalance problem present in HiRes datasets. Overall, internal resolution-independence mutually benefits both HiRes and 1.0 mm MRI segmentation. With our rigorously validated FastSurferVINN we distribute a rapid tool for morphometric neuroimage analysis. The VINN architecture, furthermore, represents an efficient resolution-independent segmentation method for wider application.}
}

@article{mindboggle,
author = {Klein, Arno and Ghosh, Satrajit S. and Bao, Forrest S. and Giard, Joachim and Häme, Yrjö and Stavsky, Eliezer and Lee, Noah and Rossa, Brian and Reuter, Martin and Neto, Elias Chaibub and Keshavan, Anisha},
doi = {10.1371/journal.pcbi.1005350},
Expand Down
Loading