diff --git a/.circleci/config.yml b/.circleci/config.yml index f9833b5..815d4a4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -190,8 +190,10 @@ jobs: FS_MAJOR_VERSION=<< parameters.version >> if [[ FS_MAJOR_VERSION -eq 6 ]]; then FS_VERSION=6.0.1 - else + elif [[ FS_MAJOR_VERSION -eq 7 ]]; then FS_VERSION=7.4.1 + else + FS_VERSION=8.2.0 fi : "Pushing unstable versions for ${FS_MAJOR_VERSION} to DockerHub" @@ -227,7 +229,7 @@ jobs: else : "No DOCKER_TOKEN, skipping push to DockerHub" - exit 1 + exit 0 fi workflows: @@ -252,6 +254,20 @@ workflows: branches: only: /.*/ + # fs8 has no precomputed group2 fixture (test job compares against + # ds114_test_freesurfer_precomp_v6.0.0), so it's built/deployed here + # without going through the test job/matrix, unlike 6/7. + - build: + name: build_<< matrix.version >> + matrix: + parameters: + version: ['8'] + filters: + tags: + only: /.*/ + branches: + only: /.*/ + - test: name: test_<< matrix.version >>_<< matrix.test >> matrix: @@ -281,3 +297,19 @@ workflows: only: /.*/ tags: only: /.*/ + + # No test_8_* jobs (see build_8 above), so this only requires build_8. + - deploy: + name: deploy_<< matrix.version >> + matrix: + parameters: + version: ['8'] + context: + - dockerhub + requires: + - build_<< matrix.version >> + filters: + branches: + only: /.*/ + tags: + only: /.*/ diff --git a/Dockerfile_fs6 b/Dockerfile_fs6 index 741c75e..79a4e95 100644 --- a/Dockerfile_fs6 +++ b/Dockerfile_fs6 @@ -64,43 +64,7 @@ RUN apt-get update -qq \ --exclude='subjects/fsaverage6' \ --exclude='subjects/fsaverage_sym' \ --exclude='trctrain' -ENV CONDA_DIR="/opt/miniconda-latest" \ - PATH="/opt/miniconda-latest/bin:$PATH" -RUN apt-get update -qq \ - && apt-get install -y -q --no-install-recommends \ - bzip2 \ - ca-certificates \ - curl \ - && rm -rf /var/lib/apt/lists/* \ - # Install dependencies. - && export PATH="/opt/miniconda-latest/bin:$PATH" \ - && echo "Downloading Miniconda installer ..." \ - && conda_installer="/tmp/miniconda.sh" \ - && curl -fsSL -o "$conda_installer" https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh \ - && bash "$conda_installer" -b -p /opt/miniconda-latest \ - && rm -f "$conda_installer" \ - && conda update -yq -nbase conda \ - && conda install -yq -nbase conda-libmamba-solver \ - && conda config --set solver libmamba \ - # Prefer packages in conda-forge - && conda config --system --prepend channels conda-forge \ - # Packages in lower-priority channels not considered if a package with the same - # name exists in a higher priority channel. Can dramatically speed up installations. - # Conda recommends this as a default - # https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-channels.html - && conda config --set channel_priority strict \ - && conda config --system --set auto_update_conda false \ - && conda config --system --set show_channel_urls true \ - # Enable `conda activate` - && conda init bash \ - && conda install -y --name base \ - "pandas=1.5.3" \ - && bash -c "source activate base \ - && python -m pip install --no-cache-dir \ - "nibabel"" \ - # Clean up - && sync && conda clean --all --yes && sync \ - && rm -rf ~/.cache/pip/* +RUN bash -c 'apt-get update -qq && apt-get install -y -q --no-install-recommends bzip2 ca-certificates curl && rm -rf /var/lib/apt/lists/* && export PATH="/opt/miniconda-latest/bin:$PATH" && echo "Downloading Miniconda installer ..." && conda_installer="/tmp/miniconda.sh" && curl -fsSL -o "$conda_installer" https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh && bash "$conda_installer" -b -p /opt/miniconda-latest && rm -f "$conda_installer" && conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main && conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r && conda update -yq -nbase conda && conda install -yq -nbase conda-libmamba-solver && conda config --set solver libmamba && conda config --system --prepend channels conda-forge && conda config --set channel_priority strict && conda config --system --set auto_update_conda false && conda config --system --set show_channel_urls true && conda init bash && conda install -y --name base pandas && bash -c "source activate base && python -m pip install --no-cache-dir nibabel" && sync && conda clean --all --yes && sync && rm -rf ~/.cache/pip/*' RUN bash -c 'curl -sL https://deb.nodesource.com/setup_18.x | bash -' RUN apt-get update -qq \ && apt-get install -y -q --no-install-recommends \ @@ -114,6 +78,7 @@ ENV FSLDIR="/usr/share/fsl/5.0" \ LD_LIBRARY_PATH="/usr/lib/fsl/5.0:" \ FSLTCLSH="/usr/bin/tclsh" \ FSLWISH="/usr/bin/wish" +ENV FS_VERSION="6.0.1" ENV OS="Linux" \ FS_OVERRIDE="0" \ FIX_VERTEX_AREA="" \ @@ -122,11 +87,13 @@ ENV OS="Linux" \ MNI_DIR="/opt/freesurfer/mni" \ LOCAL_DIR="/opt/freesurfer/local" \ FREESURFER_HOME="/opt/freesurfer" \ + FREESURFER="/opt/freesurfer" \ FSFAST_HOME="/opt/freesurfer/fsfast" \ MINC_BIN_DIR="/opt/freesurfer/mni/bin" \ MINC_LIB_DIR="/opt/freesurfer/mni/lib" \ MNI_DATAPATH="/opt/freesurfer/mni/data" \ FMRI_ANALYSIS_DIR="/opt/freesurfer/fsfast" \ + FUNCTIONALS_DIR="/opt/freesurfer/sessions" \ PERL5LIB="/opt/freesurfer/mni/share/perl5" \ MNI_PERL5LIB="/opt/freesurfer/mni/share/perl5/" \ PATH="/opt/miniconda-latest/bin:/opt/freesurfer/bin:/opt/freesurfer/fsfast/bin:/opt/freesurfer/tktools:/opt/freesurfer/mni/bin:/usr/lib/fsl/5.0:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" \ @@ -211,17 +178,10 @@ RUN printf '{ \ "command": "apt-get update -qq\\napt-get install -y -q --no-install-recommends \\\\\\n bc \\\\\\n ca-certificates \\\\\\n curl \\\\\\n libgomp1 \\\\\\n libxmu6 \\\\\\n libxt6 \\\\\\n perl \\\\\\n tcsh\\nrm -rf /var/lib/apt/lists/*\\necho \\"Downloading FreeSurfer ...\\"\\nmkdir -p /opt/freesurfer\\ncurl -fL ftp://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/6.0.1/freesurfer-Linux-centos6_x86_64-stable-pub-v6.0.1.tar.gz \\\\\\n| tar -xz -C /opt/freesurfer --owner root --group root --no-same-owner --strip-components 1 \\\\\\n --exclude='"'"'average/mult-comp-cor'"'"' \\\\\\n --exclude='"'"'lib/cuda'"'"' \\\\\\n --exclude='"'"'lib/qt'"'"' \\\\\\n --exclude='"'"'subjects/V1_average'"'"' \\\\\\n --exclude='"'"'subjects/bert'"'"' \\\\\\n --exclude='"'"'subjects/cvs_avg35'"'"' \\\\\\n --exclude='"'"'subjects/cvs_avg35_inMNI152'"'"' \\\\\\n --exclude='"'"'subjects/fsaverage3'"'"' \\\\\\n --exclude='"'"'subjects/fsaverage4'"'"' \\\\\\n --exclude='"'"'subjects/fsaverage5'"'"' \\\\\\n --exclude='"'"'subjects/fsaverage6'"'"' \\\\\\n --exclude='"'"'subjects/fsaverage_sym'"'"' \\\\\\n --exclude='"'"'trctrain'"'"'" \ } \ }, \ - { \ - "name": "env", \ - "kwds": { \ - "CONDA_DIR": "/opt/miniconda-latest", \ - "PATH": "/opt/miniconda-latest/bin:$PATH" \ - } \ - }, \ { \ "name": "run", \ "kwds": { \ - "command": "apt-get update -qq\\napt-get install -y -q --no-install-recommends \\\\\\n bzip2 \\\\\\n ca-certificates \\\\\\n curl\\nrm -rf /var/lib/apt/lists/*\\n# Install dependencies.\\nexport PATH=\\"/opt/miniconda-latest/bin:$PATH\\"\\necho \\"Downloading Miniconda installer ...\\"\\nconda_installer=\\"/tmp/miniconda.sh\\"\\ncurl -fsSL -o \\"$conda_installer\\" https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh\\nbash \\"$conda_installer\\" -b -p /opt/miniconda-latest\\nrm -f \\"$conda_installer\\"\\nconda update -yq -nbase conda\\nconda install -yq -nbase conda-libmamba-solver\\nconda config --set solver libmamba\\n# Prefer packages in conda-forge\\nconda config --system --prepend channels conda-forge\\n# Packages in lower-priority channels not considered if a package with the same\\n# name exists in a higher priority channel. Can dramatically speed up installations.\\n# Conda recommends this as a default\\n# https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-channels.html\\nconda config --set channel_priority strict\\nconda config --system --set auto_update_conda false\\nconda config --system --set show_channel_urls true\\n# Enable `conda activate`\\nconda init bash\\nconda install -y --name base \\\\\\n \\"pandas=1.5.3\\"\\nbash -c \\"source activate base\\n python -m pip install --no-cache-dir \\\\\\n \\"nibabel\\"\\"\\n# Clean up\\nsync && conda clean --all --yes && sync\\nrm -rf ~/.cache/pip/*" \ + "command": "bash -c '"'"'apt-get update -qq && apt-get install -y -q --no-install-recommends bzip2 ca-certificates curl && rm -rf /var/lib/apt/lists/* && export PATH=\\"/opt/miniconda-latest/bin:$PATH\\" && echo \\"Downloading Miniconda installer ...\\" && conda_installer=\\"/tmp/miniconda.sh\\" && curl -fsSL -o \\"$conda_installer\\" https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh && bash \\"$conda_installer\\" -b -p /opt/miniconda-latest && rm -f \\"$conda_installer\\" && conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main && conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r && conda update -yq -nbase conda && conda install -yq -nbase conda-libmamba-solver && conda config --set solver libmamba && conda config --system --prepend channels conda-forge && conda config --set channel_priority strict && conda config --system --set auto_update_conda false && conda config --system --set show_channel_urls true && conda init bash && conda install -y --name base pandas && bash -c \\"source activate base && python -m pip install --no-cache-dir nibabel\\" && sync && conda clean --all --yes && sync && rm -rf ~/.cache/pip/*'"'"'" \ } \ }, \ { \ @@ -263,6 +223,12 @@ RUN printf '{ \ "FSLWISH": "/usr/bin/wish" \ } \ }, \ + { \ + "name": "env", \ + "kwds": { \ + "FS_VERSION": "6.0.1" \ + } \ + }, \ { \ "name": "env", \ "kwds": { \ @@ -274,11 +240,13 @@ RUN printf '{ \ "MNI_DIR": "/opt/freesurfer/mni", \ "LOCAL_DIR": "/opt/freesurfer/local", \ "FREESURFER_HOME": "/opt/freesurfer", \ + "FREESURFER": "/opt/freesurfer", \ "FSFAST_HOME": "/opt/freesurfer/fsfast", \ "MINC_BIN_DIR": "/opt/freesurfer/mni/bin", \ "MINC_LIB_DIR": "/opt/freesurfer/mni/lib", \ "MNI_DATAPATH": "/opt/freesurfer/mni/data", \ "FMRI_ANALYSIS_DIR": "/opt/freesurfer/fsfast", \ + "FUNCTIONALS_DIR": "/opt/freesurfer/sessions", \ "PERL5LIB": "/opt/freesurfer/mni/share/perl5", \ "MNI_PERL5LIB": "/opt/freesurfer/mni/share/perl5/", \ "PATH": "/opt/miniconda-latest/bin:/opt/freesurfer/bin:/opt/freesurfer/fsfast/bin:/opt/freesurfer/tktools:/opt/freesurfer/mni/bin:/usr/lib/fsl/5.0:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", \ diff --git a/Dockerfile_fs7 b/Dockerfile_fs7 index 241ac6d..193ec39 100644 --- a/Dockerfile_fs7 +++ b/Dockerfile_fs7 @@ -64,43 +64,7 @@ RUN apt-get update -qq \ --exclude='subjects/fsaverage6' \ --exclude='subjects/fsaverage_sym' \ --exclude='trctrain' -ENV CONDA_DIR="/opt/miniconda-latest" \ - PATH="/opt/miniconda-latest/bin:$PATH" -RUN apt-get update -qq \ - && apt-get install -y -q --no-install-recommends \ - bzip2 \ - ca-certificates \ - curl \ - && rm -rf /var/lib/apt/lists/* \ - # Install dependencies. - && export PATH="/opt/miniconda-latest/bin:$PATH" \ - && echo "Downloading Miniconda installer ..." \ - && conda_installer="/tmp/miniconda.sh" \ - && curl -fsSL -o "$conda_installer" https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh \ - && bash "$conda_installer" -b -p /opt/miniconda-latest \ - && rm -f "$conda_installer" \ - && conda update -yq -nbase conda \ - && conda install -yq -nbase conda-libmamba-solver \ - && conda config --set solver libmamba \ - # Prefer packages in conda-forge - && conda config --system --prepend channels conda-forge \ - # Packages in lower-priority channels not considered if a package with the same - # name exists in a higher priority channel. Can dramatically speed up installations. - # Conda recommends this as a default - # https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-channels.html - && conda config --set channel_priority strict \ - && conda config --system --set auto_update_conda false \ - && conda config --system --set show_channel_urls true \ - # Enable `conda activate` - && conda init bash \ - && conda install -y --name base \ - "pandas=1.5.3" \ - && bash -c "source activate base \ - && python -m pip install --no-cache-dir \ - "nibabel"" \ - # Clean up - && sync && conda clean --all --yes && sync \ - && rm -rf ~/.cache/pip/* +RUN bash -c 'apt-get update -qq && apt-get install -y -q --no-install-recommends bzip2 ca-certificates curl && rm -rf /var/lib/apt/lists/* && export PATH="/opt/miniconda-latest/bin:$PATH" && echo "Downloading Miniconda installer ..." && conda_installer="/tmp/miniconda.sh" && curl -fsSL -o "$conda_installer" https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh && bash "$conda_installer" -b -p /opt/miniconda-latest && rm -f "$conda_installer" && conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main && conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r && conda update -yq -nbase conda && conda install -yq -nbase conda-libmamba-solver && conda config --set solver libmamba && conda config --system --prepend channels conda-forge && conda config --set channel_priority strict && conda config --system --set auto_update_conda false && conda config --system --set show_channel_urls true && conda init bash && conda install -y --name base pandas && bash -c "source activate base && python -m pip install --no-cache-dir nibabel" && sync && conda clean --all --yes && sync && rm -rf ~/.cache/pip/*' RUN bash -c 'curl -sL https://deb.nodesource.com/setup_18.x | bash -' RUN apt-get update -qq \ && apt-get install -y -q --no-install-recommends \ @@ -114,6 +78,7 @@ ENV FSLDIR="/usr/share/fsl/5.0" \ LD_LIBRARY_PATH="/usr/lib/fsl/5.0:" \ FSLTCLSH="/usr/bin/tclsh" \ FSLWISH="/usr/bin/wish" +ENV FS_VERSION="7.4.1" ENV OS="Linux" \ FS_OVERRIDE="0" \ FIX_VERTEX_AREA="" \ @@ -122,11 +87,13 @@ ENV OS="Linux" \ MNI_DIR="/opt/freesurfer/mni" \ LOCAL_DIR="/opt/freesurfer/local" \ FREESURFER_HOME="/opt/freesurfer" \ + FREESURFER="/opt/freesurfer" \ FSFAST_HOME="/opt/freesurfer/fsfast" \ MINC_BIN_DIR="/opt/freesurfer/mni/bin" \ MINC_LIB_DIR="/opt/freesurfer/mni/lib" \ MNI_DATAPATH="/opt/freesurfer/mni/data" \ FMRI_ANALYSIS_DIR="/opt/freesurfer/fsfast" \ + FUNCTIONALS_DIR="/opt/freesurfer/sessions" \ PERL5LIB="/opt/freesurfer/mni/share/perl5" \ MNI_PERL5LIB="/opt/freesurfer/mni/share/perl5/" \ PATH="/opt/miniconda-latest/bin:/opt/freesurfer/bin:/opt/freesurfer/fsfast/bin:/opt/freesurfer/tktools:/opt/freesurfer/mni/bin:/usr/lib/fsl/5.0:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" \ @@ -211,17 +178,10 @@ RUN printf '{ \ "command": "apt-get update -qq\\napt-get install -y -q --no-install-recommends \\\\\\n bc \\\\\\n ca-certificates \\\\\\n curl \\\\\\n libgomp1 \\\\\\n libxmu6 \\\\\\n libxt6 \\\\\\n perl \\\\\\n tcsh\\nrm -rf /var/lib/apt/lists/*\\necho \\"Downloading FreeSurfer ...\\"\\nmkdir -p /opt/\\ncurl -fL https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/7.4.1/freesurfer-linux-centos7_x86_64-7.4.1.tar.gz \\\\\\n| tar -xz -C /opt/ --owner root --group root --no-same-owner --strip-components 1 \\\\\\n --exclude='"'"'average/mult-comp-cor'"'"' \\\\\\n --exclude='"'"'lib/cuda'"'"' \\\\\\n --exclude='"'"'lib/qt'"'"' \\\\\\n --exclude='"'"'subjects/V1_average'"'"' \\\\\\n --exclude='"'"'subjects/bert'"'"' \\\\\\n --exclude='"'"'subjects/cvs_avg35'"'"' \\\\\\n --exclude='"'"'subjects/cvs_avg35_inMNI152'"'"' \\\\\\n --exclude='"'"'subjects/fsaverage3'"'"' \\\\\\n --exclude='"'"'subjects/fsaverage4'"'"' \\\\\\n --exclude='"'"'subjects/fsaverage5'"'"' \\\\\\n --exclude='"'"'subjects/fsaverage6'"'"' \\\\\\n --exclude='"'"'subjects/fsaverage_sym'"'"' \\\\\\n --exclude='"'"'trctrain'"'"'" \ } \ }, \ - { \ - "name": "env", \ - "kwds": { \ - "CONDA_DIR": "/opt/miniconda-latest", \ - "PATH": "/opt/miniconda-latest/bin:$PATH" \ - } \ - }, \ { \ "name": "run", \ "kwds": { \ - "command": "apt-get update -qq\\napt-get install -y -q --no-install-recommends \\\\\\n bzip2 \\\\\\n ca-certificates \\\\\\n curl\\nrm -rf /var/lib/apt/lists/*\\n# Install dependencies.\\nexport PATH=\\"/opt/miniconda-latest/bin:$PATH\\"\\necho \\"Downloading Miniconda installer ...\\"\\nconda_installer=\\"/tmp/miniconda.sh\\"\\ncurl -fsSL -o \\"$conda_installer\\" https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh\\nbash \\"$conda_installer\\" -b -p /opt/miniconda-latest\\nrm -f \\"$conda_installer\\"\\nconda update -yq -nbase conda\\nconda install -yq -nbase conda-libmamba-solver\\nconda config --set solver libmamba\\n# Prefer packages in conda-forge\\nconda config --system --prepend channels conda-forge\\n# Packages in lower-priority channels not considered if a package with the same\\n# name exists in a higher priority channel. Can dramatically speed up installations.\\n# Conda recommends this as a default\\n# https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-channels.html\\nconda config --set channel_priority strict\\nconda config --system --set auto_update_conda false\\nconda config --system --set show_channel_urls true\\n# Enable `conda activate`\\nconda init bash\\nconda install -y --name base \\\\\\n \\"pandas=1.5.3\\"\\nbash -c \\"source activate base\\n python -m pip install --no-cache-dir \\\\\\n \\"nibabel\\"\\"\\n# Clean up\\nsync && conda clean --all --yes && sync\\nrm -rf ~/.cache/pip/*" \ + "command": "bash -c '"'"'apt-get update -qq && apt-get install -y -q --no-install-recommends bzip2 ca-certificates curl && rm -rf /var/lib/apt/lists/* && export PATH=\\"/opt/miniconda-latest/bin:$PATH\\" && echo \\"Downloading Miniconda installer ...\\" && conda_installer=\\"/tmp/miniconda.sh\\" && curl -fsSL -o \\"$conda_installer\\" https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh && bash \\"$conda_installer\\" -b -p /opt/miniconda-latest && rm -f \\"$conda_installer\\" && conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main && conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r && conda update -yq -nbase conda && conda install -yq -nbase conda-libmamba-solver && conda config --set solver libmamba && conda config --system --prepend channels conda-forge && conda config --set channel_priority strict && conda config --system --set auto_update_conda false && conda config --system --set show_channel_urls true && conda init bash && conda install -y --name base pandas && bash -c \\"source activate base && python -m pip install --no-cache-dir nibabel\\" && sync && conda clean --all --yes && sync && rm -rf ~/.cache/pip/*'"'"'" \ } \ }, \ { \ @@ -263,6 +223,12 @@ RUN printf '{ \ "FSLWISH": "/usr/bin/wish" \ } \ }, \ + { \ + "name": "env", \ + "kwds": { \ + "FS_VERSION": "7.4.1" \ + } \ + }, \ { \ "name": "env", \ "kwds": { \ @@ -274,11 +240,13 @@ RUN printf '{ \ "MNI_DIR": "/opt/freesurfer/mni", \ "LOCAL_DIR": "/opt/freesurfer/local", \ "FREESURFER_HOME": "/opt/freesurfer", \ + "FREESURFER": "/opt/freesurfer", \ "FSFAST_HOME": "/opt/freesurfer/fsfast", \ "MINC_BIN_DIR": "/opt/freesurfer/mni/bin", \ "MINC_LIB_DIR": "/opt/freesurfer/mni/lib", \ "MNI_DATAPATH": "/opt/freesurfer/mni/data", \ "FMRI_ANALYSIS_DIR": "/opt/freesurfer/fsfast", \ + "FUNCTIONALS_DIR": "/opt/freesurfer/sessions", \ "PERL5LIB": "/opt/freesurfer/mni/share/perl5", \ "MNI_PERL5LIB": "/opt/freesurfer/mni/share/perl5/", \ "PATH": "/opt/miniconda-latest/bin:/opt/freesurfer/bin:/opt/freesurfer/fsfast/bin:/opt/freesurfer/tktools:/opt/freesurfer/mni/bin:/usr/lib/fsl/5.0:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", \ diff --git a/Dockerfile_fs8 b/Dockerfile_fs8 new file mode 100644 index 0000000..879839a --- /dev/null +++ b/Dockerfile_fs8 @@ -0,0 +1,229 @@ +# Generated by Neurodocker and Reproenv. + +FROM ubuntu:jammy +RUN apt-get update -qq \ + && apt-get install -y -q --no-install-recommends \ + bc \ + ca-certificates \ + curl \ + libgomp1 \ + tar \ + tcsh \ + wget \ + && rm -rf /var/lib/apt/lists/* +RUN bash -c 'wget -q -O /tmp/freesurfer_8.2.0.deb https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/8.2.0/freesurfer_ubuntu22-8.2.0_amd64.deb && apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get install -y -q /tmp/freesurfer_8.2.0.deb && rm -f /tmp/freesurfer_8.2.0.deb && rm -rf /var/lib/apt/lists/*' +RUN bash -c 'apt-get update -qq && apt-get install -y -q --no-install-recommends bzip2 ca-certificates curl && rm -rf /var/lib/apt/lists/* && export PATH="/opt/miniconda-latest/bin:$PATH" && echo "Downloading Miniconda installer ..." && conda_installer="/tmp/miniconda.sh" && curl -fsSL -o "$conda_installer" https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh && bash "$conda_installer" -b -p /opt/miniconda-latest && rm -f "$conda_installer" && conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main && conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r && conda update -yq -nbase conda && conda install -yq -nbase conda-libmamba-solver && conda config --set solver libmamba && conda config --system --prepend channels conda-forge && conda config --set channel_priority strict && conda config --system --set auto_update_conda false && conda config --system --set show_channel_urls true && conda init bash && conda install -y --name base pandas && bash -c "source activate base && python -m pip install --no-cache-dir nibabel" && sync && conda clean --all --yes && sync && rm -rf ~/.cache/pip/*' +RUN bash -c 'curl -sL https://deb.nodesource.com/setup_18.x | bash -' +RUN apt-get update -qq \ + && apt-get install -y -q --no-install-recommends \ + nodejs \ + && rm -rf /var/lib/apt/lists/* +RUN bash -c 'npm install -g bids-validator@1.12.0' +ENV FSLDIR="/usr/share/fsl/5.0" \ + FSLOUTPUTTYPE="NIFTI_GZ" \ + FSLMULTIFILEQUIT="TRUE" \ + POSSUMDIR="/usr/share/fsl/5.0" \ + LD_LIBRARY_PATH="/usr/lib/fsl/5.0:" \ + FSLTCLSH="/usr/bin/tclsh" \ + FSLWISH="/usr/bin/wish" +ENV FS_VERSION="8.2.0" +ENV OS="Linux" \ + FS_OVERRIDE="0" \ + FIX_VERTEX_AREA="" \ + SUBJECTS_DIR="/usr/local/freesurfer/8.2.0/subjects" \ + FSF_OUTPUT_FORMAT="nii.gz" \ + MNI_DIR="/usr/local/freesurfer/8.2.0/mni" \ + LOCAL_DIR="/usr/local/freesurfer/8.2.0/local" \ + FREESURFER_HOME="/usr/local/freesurfer/8.2.0" \ + FREESURFER="/usr/local/freesurfer/8.2.0" \ + FSFAST_HOME="/usr/local/freesurfer/8.2.0/fsfast" \ + MINC_BIN_DIR="/usr/local/freesurfer/8.2.0/mni/bin" \ + MINC_LIB_DIR="/usr/local/freesurfer/8.2.0/mni/lib" \ + MNI_DATAPATH="/usr/local/freesurfer/8.2.0/mni/data" \ + FMRI_ANALYSIS_DIR="/usr/local/freesurfer/8.2.0/fsfast" \ + FUNCTIONALS_DIR="/usr/local/freesurfer/8.2.0/sessions" \ + PERL5LIB="/usr/local/freesurfer/8.2.0/mni/share/perl5" \ + MNI_PERL5LIB="/usr/local/freesurfer/8.2.0/mni/share/perl5/" \ + PATH="/opt/miniconda-latest/bin:/usr/local/freesurfer/8.2.0/bin:/usr/local/freesurfer/8.2.0/fsfast/bin:/usr/local/freesurfer/8.2.0/tktools:/usr/local/freesurfer/8.2.0/mni/bin:/usr/lib/fsl/5.0:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" \ + PYTHONPATH="" +RUN mkdir root/matlab && touch root/matlab/startup.m +RUN mkdir /scratch +RUN mkdir /local-scratch +COPY ["run.py", \ + "/run.py"] +RUN chmod +x /run.py +COPY ["version", \ + "/version"] +ENTRYPOINT ["python", "/run.py"] + +# Save specification to JSON. +RUN printf '{ \ + "pkg_manager": "apt", \ + "existing_users": [ \ + "root" \ + ], \ + "instructions": [ \ + { \ + "name": "from_", \ + "kwds": { \ + "base_image": "ubuntu:jammy" \ + } \ + }, \ + { \ + "name": "install", \ + "kwds": { \ + "pkgs": [ \ + "tcsh", \ + "bc", \ + "tar", \ + "libgomp1", \ + "wget", \ + "curl", \ + "ca-certificates" \ + ], \ + "opts": null \ + } \ + }, \ + { \ + "name": "run", \ + "kwds": { \ + "command": "apt-get update -qq \\\\\\n && apt-get install -y -q --no-install-recommends \\\\\\n bc \\\\\\n ca-certificates \\\\\\n curl \\\\\\n libgomp1 \\\\\\n tar \\\\\\n tcsh \\\\\\n wget \\\\\\n && rm -rf /var/lib/apt/lists/*" \ + } \ + }, \ + { \ + "name": "run", \ + "kwds": { \ + "command": "bash -c '"'"'wget -q -O /tmp/freesurfer_8.2.0.deb https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/8.2.0/freesurfer_ubuntu22-8.2.0_amd64.deb && apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get install -y -q /tmp/freesurfer_8.2.0.deb && rm -f /tmp/freesurfer_8.2.0.deb && rm -rf /var/lib/apt/lists/*'"'"'" \ + } \ + }, \ + { \ + "name": "run", \ + "kwds": { \ + "command": "bash -c '"'"'apt-get update -qq && apt-get install -y -q --no-install-recommends bzip2 ca-certificates curl && rm -rf /var/lib/apt/lists/* && export PATH=\\"/opt/miniconda-latest/bin:$PATH\\" && echo \\"Downloading Miniconda installer ...\\" && conda_installer=\\"/tmp/miniconda.sh\\" && curl -fsSL -o \\"$conda_installer\\" https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh && bash \\"$conda_installer\\" -b -p /opt/miniconda-latest && rm -f \\"$conda_installer\\" && conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main && conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r && conda update -yq -nbase conda && conda install -yq -nbase conda-libmamba-solver && conda config --set solver libmamba && conda config --system --prepend channels conda-forge && conda config --set channel_priority strict && conda config --system --set auto_update_conda false && conda config --system --set show_channel_urls true && conda init bash && conda install -y --name base pandas && bash -c \\"source activate base && python -m pip install --no-cache-dir nibabel\\" && sync && conda clean --all --yes && sync && rm -rf ~/.cache/pip/*'"'"'" \ + } \ + }, \ + { \ + "name": "run", \ + "kwds": { \ + "command": "bash -c '"'"'curl -sL https://deb.nodesource.com/setup_18.x | bash -'"'"'" \ + } \ + }, \ + { \ + "name": "install", \ + "kwds": { \ + "pkgs": [ \ + "nodejs" \ + ], \ + "opts": null \ + } \ + }, \ + { \ + "name": "run", \ + "kwds": { \ + "command": "apt-get update -qq \\\\\\n && apt-get install -y -q --no-install-recommends \\\\\\n nodejs \\\\\\n && rm -rf /var/lib/apt/lists/*" \ + } \ + }, \ + { \ + "name": "run", \ + "kwds": { \ + "command": "bash -c '"'"'npm install -g bids-validator@1.12.0'"'"'" \ + } \ + }, \ + { \ + "name": "env", \ + "kwds": { \ + "FSLDIR": "/usr/share/fsl/5.0", \ + "FSLOUTPUTTYPE": "NIFTI_GZ", \ + "FSLMULTIFILEQUIT": "TRUE", \ + "POSSUMDIR": "/usr/share/fsl/5.0", \ + "LD_LIBRARY_PATH": "/usr/lib/fsl/5.0:", \ + "FSLTCLSH": "/usr/bin/tclsh", \ + "FSLWISH": "/usr/bin/wish" \ + } \ + }, \ + { \ + "name": "env", \ + "kwds": { \ + "FS_VERSION": "8.2.0" \ + } \ + }, \ + { \ + "name": "env", \ + "kwds": { \ + "OS": "Linux", \ + "FS_OVERRIDE": "0", \ + "FIX_VERTEX_AREA": "", \ + "SUBJECTS_DIR": "/usr/local/freesurfer/8.2.0/subjects", \ + "FSF_OUTPUT_FORMAT": "nii.gz", \ + "MNI_DIR": "/usr/local/freesurfer/8.2.0/mni", \ + "LOCAL_DIR": "/usr/local/freesurfer/8.2.0/local", \ + "FREESURFER_HOME": "/usr/local/freesurfer/8.2.0", \ + "FREESURFER": "/usr/local/freesurfer/8.2.0", \ + "FSFAST_HOME": "/usr/local/freesurfer/8.2.0/fsfast", \ + "MINC_BIN_DIR": "/usr/local/freesurfer/8.2.0/mni/bin", \ + "MINC_LIB_DIR": "/usr/local/freesurfer/8.2.0/mni/lib", \ + "MNI_DATAPATH": "/usr/local/freesurfer/8.2.0/mni/data", \ + "FMRI_ANALYSIS_DIR": "/usr/local/freesurfer/8.2.0/fsfast", \ + "FUNCTIONALS_DIR": "/usr/local/freesurfer/8.2.0/sessions", \ + "PERL5LIB": "/usr/local/freesurfer/8.2.0/mni/share/perl5", \ + "MNI_PERL5LIB": "/usr/local/freesurfer/8.2.0/mni/share/perl5/", \ + "PATH": "/opt/miniconda-latest/bin:/usr/local/freesurfer/8.2.0/bin:/usr/local/freesurfer/8.2.0/fsfast/bin:/usr/local/freesurfer/8.2.0/tktools:/usr/local/freesurfer/8.2.0/mni/bin:/usr/lib/fsl/5.0:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", \ + "PYTHONPATH": "" \ + } \ + }, \ + { \ + "name": "run", \ + "kwds": { \ + "command": "mkdir root/matlab && touch root/matlab/startup.m" \ + } \ + }, \ + { \ + "name": "run", \ + "kwds": { \ + "command": "mkdir /scratch" \ + } \ + }, \ + { \ + "name": "run", \ + "kwds": { \ + "command": "mkdir /local-scratch" \ + } \ + }, \ + { \ + "name": "copy", \ + "kwds": { \ + "source": [ \ + "run.py", \ + "/run.py" \ + ], \ + "destination": "/run.py" \ + } \ + }, \ + { \ + "name": "run", \ + "kwds": { \ + "command": "chmod +x /run.py" \ + } \ + }, \ + { \ + "name": "copy", \ + "kwds": { \ + "source": [ \ + "version", \ + "/version" \ + ], \ + "destination": "/version" \ + } \ + }, \ + { \ + "name": "entrypoint", \ + "kwds": { \ + "args": [ \ + "python", \ + "/run.py" \ + ] \ + } \ + } \ + ] \ +}' > /.reproenv.json +# End saving to specification to JSON. diff --git a/README.md b/README.md index 1388663..d451a72 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ It reconstructs the surface for each subject individually and then creates a study specific template. In case there are multiple sessions the Freesurfer longitudinal pipeline is used (creating subject specific templates) unless instructed to combine data across sessions. -This app is available for both Freesurfer 6 and 7. +This app is available for Freesurfer 6, 7, and 8. The current Freesurfer version for Freesurfer 6 is based on: @@ -18,7 +18,11 @@ The current Freesurfer version for Freesurfer 7 is based on: - `freesurfer-linux-centos7_x86_64-7.4.1.tar.gz` -We only plan to support only one version of Freesurfer 6 and Freesurfer 7 at a time. +The current Freesurfer version for Freesurfer 8 is based on: + +- `freesurfer_ubuntu22-8.2.0_amd64.deb` + +We only plan to support only one version of Freesurfer 6, Freesurfer 7, and Freesurfer 8 at a time. The output of the pipeline consist of the `SUBJECTS_DIR` created during the analysis. @@ -27,6 +31,8 @@ Freesurfer 6 will remain the default image till 2024, at which point Freesurfer You can get the default version with `docker pull bids/freesurfer`. +Freesurfer 8 is available at `docker pull bids/freesurfer:8`. + Freesurfer 7 is available at `docker pull bids/freesurfer:7`. Freesurfer 6 is available at `docker pull bids/freesurfer:6`. diff --git a/Singularity_fs6 b/Singularity_fs6 index d44a85f..8bf9ad8 100644 --- a/Singularity_fs6 +++ b/Singularity_fs6 @@ -26,8 +26,6 @@ export MNI_DIR="/opt/freesurfer/mni" export MNI_DATAPATH="/opt/freesurfer/mni/data" export MNI_PERL5LIB="/opt/freesurfer/mni/share/perl5" export PERL5LIB="/opt/freesurfer/mni/share/perl5" -export CONDA_DIR="/opt/miniconda-latest" -export PATH="/opt/miniconda-latest/bin:$PATH" export FSLDIR="/usr/share/fsl/5.0" export FSLOUTPUTTYPE="NIFTI_GZ" export FSLMULTIFILEQUIT="TRUE" @@ -35,6 +33,7 @@ export POSSUMDIR="/usr/share/fsl/5.0" export LD_LIBRARY_PATH="/usr/lib/fsl/5.0:" export FSLTCLSH="/usr/bin/tclsh" export FSLWISH="/usr/bin/wish" +export FS_VERSION="6.0.1" export OS="Linux" export FS_OVERRIDE="0" export FIX_VERTEX_AREA="" @@ -43,11 +42,13 @@ export FSF_OUTPUT_FORMAT="nii.gz" export MNI_DIR="/opt/freesurfer/mni" export LOCAL_DIR="/opt/freesurfer/local" export FREESURFER_HOME="/opt/freesurfer" +export FREESURFER="/opt/freesurfer" export FSFAST_HOME="/opt/freesurfer/fsfast" export MINC_BIN_DIR="/opt/freesurfer/mni/bin" export MINC_LIB_DIR="/opt/freesurfer/mni/lib" export MNI_DATAPATH="/opt/freesurfer/mni/data" export FMRI_ANALYSIS_DIR="/opt/freesurfer/fsfast" +export FUNCTIONALS_DIR="/opt/freesurfer/sessions" export PERL5LIB="/opt/freesurfer/mni/share/perl5" export MNI_PERL5LIB="/opt/freesurfer/mni/share/perl5/" export PATH="/opt/miniconda-latest/bin:/opt/freesurfer/bin:/opt/freesurfer/fsfast/bin:/opt/freesurfer/tktools:/opt/freesurfer/mni/bin:/usr/lib/fsl/5.0:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" @@ -101,41 +102,7 @@ curl -fL ftp://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/6.0.1/freesurfer-L --exclude='subjects/fsaverage_sym' \ --exclude='trctrain' -apt-get update -qq -apt-get install -y -q --no-install-recommends \ - bzip2 \ - ca-certificates \ - curl -rm -rf /var/lib/apt/lists/* -# Install dependencies. -export PATH="/opt/miniconda-latest/bin:$PATH" -echo "Downloading Miniconda installer ..." -conda_installer="/tmp/miniconda.sh" -curl -fsSL -o "$conda_installer" https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -bash "$conda_installer" -b -p /opt/miniconda-latest -rm -f "$conda_installer" -conda update -yq -nbase conda -conda install -yq -nbase conda-libmamba-solver -conda config --set solver libmamba -# Prefer packages in conda-forge -conda config --system --prepend channels conda-forge -# Packages in lower-priority channels not considered if a package with the same -# name exists in a higher priority channel. Can dramatically speed up installations. -# Conda recommends this as a default -# https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-channels.html -conda config --set channel_priority strict -conda config --system --set auto_update_conda false -conda config --system --set show_channel_urls true -# Enable `conda activate` -conda init bash -conda install -y --name base \ - "pandas=1.5.3" -bash -c "source activate base - python -m pip install --no-cache-dir \ - "nibabel"" -# Clean up -sync && conda clean --all --yes && sync -rm -rf ~/.cache/pip/* +bash -c 'apt-get update -qq && apt-get install -y -q --no-install-recommends bzip2 ca-certificates curl && rm -rf /var/lib/apt/lists/* && export PATH="/opt/miniconda-latest/bin:$PATH" && echo "Downloading Miniconda installer ..." && conda_installer="/tmp/miniconda.sh" && curl -fsSL -o "$conda_installer" https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh && bash "$conda_installer" -b -p /opt/miniconda-latest && rm -f "$conda_installer" && conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main && conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r && conda update -yq -nbase conda && conda install -yq -nbase conda-libmamba-solver && conda config --set solver libmamba && conda config --system --prepend channels conda-forge && conda config --set channel_priority strict && conda config --system --set auto_update_conda false && conda config --system --set show_channel_urls true && conda init bash && conda install -y --name base pandas && bash -c "source activate base && python -m pip install --no-cache-dir nibabel" && sync && conda clean --all --yes && sync && rm -rf ~/.cache/pip/*' bash -c 'curl -sL https://deb.nodesource.com/setup_18.x | bash -' @@ -224,17 +191,10 @@ printf '{ \ "command": "apt-get update -qq\\napt-get install -y -q --no-install-recommends \\\\\\n bc \\\\\\n ca-certificates \\\\\\n curl \\\\\\n libgomp1 \\\\\\n libxmu6 \\\\\\n libxt6 \\\\\\n perl \\\\\\n tcsh\\nrm -rf /var/lib/apt/lists/*\\necho \\"Downloading FreeSurfer ...\\"\\nmkdir -p /opt/freesurfer\\ncurl -fL ftp://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/6.0.1/freesurfer-Linux-centos6_x86_64-stable-pub-v6.0.1.tar.gz \\\\\\n| tar -xz -C /opt/freesurfer --owner root --group root --no-same-owner --strip-components 1 \\\\\\n --exclude='"'"'average/mult-comp-cor'"'"' \\\\\\n --exclude='"'"'lib/cuda'"'"' \\\\\\n --exclude='"'"'lib/qt'"'"' \\\\\\n --exclude='"'"'subjects/V1_average'"'"' \\\\\\n --exclude='"'"'subjects/bert'"'"' \\\\\\n --exclude='"'"'subjects/cvs_avg35'"'"' \\\\\\n --exclude='"'"'subjects/cvs_avg35_inMNI152'"'"' \\\\\\n --exclude='"'"'subjects/fsaverage3'"'"' \\\\\\n --exclude='"'"'subjects/fsaverage4'"'"' \\\\\\n --exclude='"'"'subjects/fsaverage5'"'"' \\\\\\n --exclude='"'"'subjects/fsaverage6'"'"' \\\\\\n --exclude='"'"'subjects/fsaverage_sym'"'"' \\\\\\n --exclude='"'"'trctrain'"'"'" \ } \ }, \ - { \ - "name": "env", \ - "kwds": { \ - "CONDA_DIR": "/opt/miniconda-latest", \ - "PATH": "/opt/miniconda-latest/bin:$PATH" \ - } \ - }, \ { \ "name": "run", \ "kwds": { \ - "command": "apt-get update -qq\\napt-get install -y -q --no-install-recommends \\\\\\n bzip2 \\\\\\n ca-certificates \\\\\\n curl\\nrm -rf /var/lib/apt/lists/*\\n# Install dependencies.\\nexport PATH=\\"/opt/miniconda-latest/bin:$PATH\\"\\necho \\"Downloading Miniconda installer ...\\"\\nconda_installer=\\"/tmp/miniconda.sh\\"\\ncurl -fsSL -o \\"$conda_installer\\" https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh\\nbash \\"$conda_installer\\" -b -p /opt/miniconda-latest\\nrm -f \\"$conda_installer\\"\\nconda update -yq -nbase conda\\nconda install -yq -nbase conda-libmamba-solver\\nconda config --set solver libmamba\\n# Prefer packages in conda-forge\\nconda config --system --prepend channels conda-forge\\n# Packages in lower-priority channels not considered if a package with the same\\n# name exists in a higher priority channel. Can dramatically speed up installations.\\n# Conda recommends this as a default\\n# https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-channels.html\\nconda config --set channel_priority strict\\nconda config --system --set auto_update_conda false\\nconda config --system --set show_channel_urls true\\n# Enable `conda activate`\\nconda init bash\\nconda install -y --name base \\\\\\n \\"pandas=1.5.3\\"\\nbash -c \\"source activate base\\n python -m pip install --no-cache-dir \\\\\\n \\"nibabel\\"\\"\\n# Clean up\\nsync && conda clean --all --yes && sync\\nrm -rf ~/.cache/pip/*" \ + "command": "bash -c '"'"'apt-get update -qq && apt-get install -y -q --no-install-recommends bzip2 ca-certificates curl && rm -rf /var/lib/apt/lists/* && export PATH=\\"/opt/miniconda-latest/bin:$PATH\\" && echo \\"Downloading Miniconda installer ...\\" && conda_installer=\\"/tmp/miniconda.sh\\" && curl -fsSL -o \\"$conda_installer\\" https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh && bash \\"$conda_installer\\" -b -p /opt/miniconda-latest && rm -f \\"$conda_installer\\" && conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main && conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r && conda update -yq -nbase conda && conda install -yq -nbase conda-libmamba-solver && conda config --set solver libmamba && conda config --system --prepend channels conda-forge && conda config --set channel_priority strict && conda config --system --set auto_update_conda false && conda config --system --set show_channel_urls true && conda init bash && conda install -y --name base pandas && bash -c \\"source activate base && python -m pip install --no-cache-dir nibabel\\" && sync && conda clean --all --yes && sync && rm -rf ~/.cache/pip/*'"'"'" \ } \ }, \ { \ @@ -276,6 +236,12 @@ printf '{ \ "FSLWISH": "/usr/bin/wish" \ } \ }, \ + { \ + "name": "env", \ + "kwds": { \ + "FS_VERSION": "6.0.1" \ + } \ + }, \ { \ "name": "env", \ "kwds": { \ @@ -287,11 +253,13 @@ printf '{ \ "MNI_DIR": "/opt/freesurfer/mni", \ "LOCAL_DIR": "/opt/freesurfer/local", \ "FREESURFER_HOME": "/opt/freesurfer", \ + "FREESURFER": "/opt/freesurfer", \ "FSFAST_HOME": "/opt/freesurfer/fsfast", \ "MINC_BIN_DIR": "/opt/freesurfer/mni/bin", \ "MINC_LIB_DIR": "/opt/freesurfer/mni/lib", \ "MNI_DATAPATH": "/opt/freesurfer/mni/data", \ "FMRI_ANALYSIS_DIR": "/opt/freesurfer/fsfast", \ + "FUNCTIONALS_DIR": "/opt/freesurfer/sessions", \ "PERL5LIB": "/opt/freesurfer/mni/share/perl5", \ "MNI_PERL5LIB": "/opt/freesurfer/mni/share/perl5/", \ "PATH": "/opt/miniconda-latest/bin:/opt/freesurfer/bin:/opt/freesurfer/fsfast/bin:/opt/freesurfer/tktools:/opt/freesurfer/mni/bin:/usr/lib/fsl/5.0:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", \ diff --git a/Singularity_fs7 b/Singularity_fs7 index d310859..05efa4f 100644 --- a/Singularity_fs7 +++ b/Singularity_fs7 @@ -26,8 +26,6 @@ export MNI_DIR="/opt//mni" export MNI_DATAPATH="/opt//mni/data" export MNI_PERL5LIB="/opt//mni/share/perl5" export PERL5LIB="/opt//mni/share/perl5" -export CONDA_DIR="/opt/miniconda-latest" -export PATH="/opt/miniconda-latest/bin:$PATH" export FSLDIR="/usr/share/fsl/5.0" export FSLOUTPUTTYPE="NIFTI_GZ" export FSLMULTIFILEQUIT="TRUE" @@ -35,6 +33,7 @@ export POSSUMDIR="/usr/share/fsl/5.0" export LD_LIBRARY_PATH="/usr/lib/fsl/5.0:" export FSLTCLSH="/usr/bin/tclsh" export FSLWISH="/usr/bin/wish" +export FS_VERSION="7.4.1" export OS="Linux" export FS_OVERRIDE="0" export FIX_VERTEX_AREA="" @@ -43,11 +42,13 @@ export FSF_OUTPUT_FORMAT="nii.gz" export MNI_DIR="/opt/freesurfer/mni" export LOCAL_DIR="/opt/freesurfer/local" export FREESURFER_HOME="/opt/freesurfer" +export FREESURFER="/opt/freesurfer" export FSFAST_HOME="/opt/freesurfer/fsfast" export MINC_BIN_DIR="/opt/freesurfer/mni/bin" export MINC_LIB_DIR="/opt/freesurfer/mni/lib" export MNI_DATAPATH="/opt/freesurfer/mni/data" export FMRI_ANALYSIS_DIR="/opt/freesurfer/fsfast" +export FUNCTIONALS_DIR="/opt/freesurfer/sessions" export PERL5LIB="/opt/freesurfer/mni/share/perl5" export MNI_PERL5LIB="/opt/freesurfer/mni/share/perl5/" export PATH="/opt/miniconda-latest/bin:/opt/freesurfer/bin:/opt/freesurfer/fsfast/bin:/opt/freesurfer/tktools:/opt/freesurfer/mni/bin:/usr/lib/fsl/5.0:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" @@ -101,41 +102,7 @@ curl -fL https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/7.4.1/freesurfer --exclude='subjects/fsaverage_sym' \ --exclude='trctrain' -apt-get update -qq -apt-get install -y -q --no-install-recommends \ - bzip2 \ - ca-certificates \ - curl -rm -rf /var/lib/apt/lists/* -# Install dependencies. -export PATH="/opt/miniconda-latest/bin:$PATH" -echo "Downloading Miniconda installer ..." -conda_installer="/tmp/miniconda.sh" -curl -fsSL -o "$conda_installer" https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -bash "$conda_installer" -b -p /opt/miniconda-latest -rm -f "$conda_installer" -conda update -yq -nbase conda -conda install -yq -nbase conda-libmamba-solver -conda config --set solver libmamba -# Prefer packages in conda-forge -conda config --system --prepend channels conda-forge -# Packages in lower-priority channels not considered if a package with the same -# name exists in a higher priority channel. Can dramatically speed up installations. -# Conda recommends this as a default -# https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-channels.html -conda config --set channel_priority strict -conda config --system --set auto_update_conda false -conda config --system --set show_channel_urls true -# Enable `conda activate` -conda init bash -conda install -y --name base \ - "pandas=1.5.3" -bash -c "source activate base - python -m pip install --no-cache-dir \ - "nibabel"" -# Clean up -sync && conda clean --all --yes && sync -rm -rf ~/.cache/pip/* +bash -c 'apt-get update -qq && apt-get install -y -q --no-install-recommends bzip2 ca-certificates curl && rm -rf /var/lib/apt/lists/* && export PATH="/opt/miniconda-latest/bin:$PATH" && echo "Downloading Miniconda installer ..." && conda_installer="/tmp/miniconda.sh" && curl -fsSL -o "$conda_installer" https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh && bash "$conda_installer" -b -p /opt/miniconda-latest && rm -f "$conda_installer" && conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main && conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r && conda update -yq -nbase conda && conda install -yq -nbase conda-libmamba-solver && conda config --set solver libmamba && conda config --system --prepend channels conda-forge && conda config --set channel_priority strict && conda config --system --set auto_update_conda false && conda config --system --set show_channel_urls true && conda init bash && conda install -y --name base pandas && bash -c "source activate base && python -m pip install --no-cache-dir nibabel" && sync && conda clean --all --yes && sync && rm -rf ~/.cache/pip/*' bash -c 'curl -sL https://deb.nodesource.com/setup_18.x | bash -' @@ -224,17 +191,10 @@ printf '{ \ "command": "apt-get update -qq\\napt-get install -y -q --no-install-recommends \\\\\\n bc \\\\\\n ca-certificates \\\\\\n curl \\\\\\n libgomp1 \\\\\\n libxmu6 \\\\\\n libxt6 \\\\\\n perl \\\\\\n tcsh\\nrm -rf /var/lib/apt/lists/*\\necho \\"Downloading FreeSurfer ...\\"\\nmkdir -p /opt/\\ncurl -fL https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/7.4.1/freesurfer-linux-centos7_x86_64-7.4.1.tar.gz \\\\\\n| tar -xz -C /opt/ --owner root --group root --no-same-owner --strip-components 1 \\\\\\n --exclude='"'"'average/mult-comp-cor'"'"' \\\\\\n --exclude='"'"'lib/cuda'"'"' \\\\\\n --exclude='"'"'lib/qt'"'"' \\\\\\n --exclude='"'"'subjects/V1_average'"'"' \\\\\\n --exclude='"'"'subjects/bert'"'"' \\\\\\n --exclude='"'"'subjects/cvs_avg35'"'"' \\\\\\n --exclude='"'"'subjects/cvs_avg35_inMNI152'"'"' \\\\\\n --exclude='"'"'subjects/fsaverage3'"'"' \\\\\\n --exclude='"'"'subjects/fsaverage4'"'"' \\\\\\n --exclude='"'"'subjects/fsaverage5'"'"' \\\\\\n --exclude='"'"'subjects/fsaverage6'"'"' \\\\\\n --exclude='"'"'subjects/fsaverage_sym'"'"' \\\\\\n --exclude='"'"'trctrain'"'"'" \ } \ }, \ - { \ - "name": "env", \ - "kwds": { \ - "CONDA_DIR": "/opt/miniconda-latest", \ - "PATH": "/opt/miniconda-latest/bin:$PATH" \ - } \ - }, \ { \ "name": "run", \ "kwds": { \ - "command": "apt-get update -qq\\napt-get install -y -q --no-install-recommends \\\\\\n bzip2 \\\\\\n ca-certificates \\\\\\n curl\\nrm -rf /var/lib/apt/lists/*\\n# Install dependencies.\\nexport PATH=\\"/opt/miniconda-latest/bin:$PATH\\"\\necho \\"Downloading Miniconda installer ...\\"\\nconda_installer=\\"/tmp/miniconda.sh\\"\\ncurl -fsSL -o \\"$conda_installer\\" https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh\\nbash \\"$conda_installer\\" -b -p /opt/miniconda-latest\\nrm -f \\"$conda_installer\\"\\nconda update -yq -nbase conda\\nconda install -yq -nbase conda-libmamba-solver\\nconda config --set solver libmamba\\n# Prefer packages in conda-forge\\nconda config --system --prepend channels conda-forge\\n# Packages in lower-priority channels not considered if a package with the same\\n# name exists in a higher priority channel. Can dramatically speed up installations.\\n# Conda recommends this as a default\\n# https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-channels.html\\nconda config --set channel_priority strict\\nconda config --system --set auto_update_conda false\\nconda config --system --set show_channel_urls true\\n# Enable `conda activate`\\nconda init bash\\nconda install -y --name base \\\\\\n \\"pandas=1.5.3\\"\\nbash -c \\"source activate base\\n python -m pip install --no-cache-dir \\\\\\n \\"nibabel\\"\\"\\n# Clean up\\nsync && conda clean --all --yes && sync\\nrm -rf ~/.cache/pip/*" \ + "command": "bash -c '"'"'apt-get update -qq && apt-get install -y -q --no-install-recommends bzip2 ca-certificates curl && rm -rf /var/lib/apt/lists/* && export PATH=\\"/opt/miniconda-latest/bin:$PATH\\" && echo \\"Downloading Miniconda installer ...\\" && conda_installer=\\"/tmp/miniconda.sh\\" && curl -fsSL -o \\"$conda_installer\\" https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh && bash \\"$conda_installer\\" -b -p /opt/miniconda-latest && rm -f \\"$conda_installer\\" && conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main && conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r && conda update -yq -nbase conda && conda install -yq -nbase conda-libmamba-solver && conda config --set solver libmamba && conda config --system --prepend channels conda-forge && conda config --set channel_priority strict && conda config --system --set auto_update_conda false && conda config --system --set show_channel_urls true && conda init bash && conda install -y --name base pandas && bash -c \\"source activate base && python -m pip install --no-cache-dir nibabel\\" && sync && conda clean --all --yes && sync && rm -rf ~/.cache/pip/*'"'"'" \ } \ }, \ { \ @@ -276,6 +236,12 @@ printf '{ \ "FSLWISH": "/usr/bin/wish" \ } \ }, \ + { \ + "name": "env", \ + "kwds": { \ + "FS_VERSION": "7.4.1" \ + } \ + }, \ { \ "name": "env", \ "kwds": { \ @@ -287,11 +253,13 @@ printf '{ \ "MNI_DIR": "/opt/freesurfer/mni", \ "LOCAL_DIR": "/opt/freesurfer/local", \ "FREESURFER_HOME": "/opt/freesurfer", \ + "FREESURFER": "/opt/freesurfer", \ "FSFAST_HOME": "/opt/freesurfer/fsfast", \ "MINC_BIN_DIR": "/opt/freesurfer/mni/bin", \ "MINC_LIB_DIR": "/opt/freesurfer/mni/lib", \ "MNI_DATAPATH": "/opt/freesurfer/mni/data", \ "FMRI_ANALYSIS_DIR": "/opt/freesurfer/fsfast", \ + "FUNCTIONALS_DIR": "/opt/freesurfer/sessions", \ "PERL5LIB": "/opt/freesurfer/mni/share/perl5", \ "MNI_PERL5LIB": "/opt/freesurfer/mni/share/perl5/", \ "PATH": "/opt/miniconda-latest/bin:/opt/freesurfer/bin:/opt/freesurfer/fsfast/bin:/opt/freesurfer/tktools:/opt/freesurfer/mni/bin:/usr/lib/fsl/5.0:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", \ diff --git a/Singularity_fs8 b/Singularity_fs8 new file mode 100644 index 0000000..c4610a6 --- /dev/null +++ b/Singularity_fs8 @@ -0,0 +1,243 @@ +# Generated by Neurodocker and Reproenv. + +Bootstrap: docker +From: ubuntu:jammy + +%files +run.py /run.py +version /version + +%environment +export FSLDIR="/usr/share/fsl/5.0" +export FSLOUTPUTTYPE="NIFTI_GZ" +export FSLMULTIFILEQUIT="TRUE" +export POSSUMDIR="/usr/share/fsl/5.0" +export LD_LIBRARY_PATH="/usr/lib/fsl/5.0:" +export FSLTCLSH="/usr/bin/tclsh" +export FSLWISH="/usr/bin/wish" +export FS_VERSION="8.2.0" +export OS="Linux" +export FS_OVERRIDE="0" +export FIX_VERTEX_AREA="" +export SUBJECTS_DIR="/usr/local/freesurfer/8.2.0/subjects" +export FSF_OUTPUT_FORMAT="nii.gz" +export MNI_DIR="/usr/local/freesurfer/8.2.0/mni" +export LOCAL_DIR="/usr/local/freesurfer/8.2.0/local" +export FREESURFER_HOME="/usr/local/freesurfer/8.2.0" +export FREESURFER="/usr/local/freesurfer/8.2.0" +export FSFAST_HOME="/usr/local/freesurfer/8.2.0/fsfast" +export MINC_BIN_DIR="/usr/local/freesurfer/8.2.0/mni/bin" +export MINC_LIB_DIR="/usr/local/freesurfer/8.2.0/mni/lib" +export MNI_DATAPATH="/usr/local/freesurfer/8.2.0/mni/data" +export FMRI_ANALYSIS_DIR="/usr/local/freesurfer/8.2.0/fsfast" +export FUNCTIONALS_DIR="/usr/local/freesurfer/8.2.0/sessions" +export PERL5LIB="/usr/local/freesurfer/8.2.0/mni/share/perl5" +export MNI_PERL5LIB="/usr/local/freesurfer/8.2.0/mni/share/perl5/" +export PATH="/opt/miniconda-latest/bin:/usr/local/freesurfer/8.2.0/bin:/usr/local/freesurfer/8.2.0/fsfast/bin:/usr/local/freesurfer/8.2.0/tktools:/usr/local/freesurfer/8.2.0/mni/bin:/usr/lib/fsl/5.0:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" +export PYTHONPATH="" + +%post +apt-get update -qq +apt-get install -y -q --no-install-recommends \ + bc \ + ca-certificates \ + curl \ + libgomp1 \ + tar \ + tcsh \ + wget +rm -rf /var/lib/apt/lists/* + +bash -c 'wget -q -O /tmp/freesurfer_8.2.0.deb https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/8.2.0/freesurfer_ubuntu22-8.2.0_amd64.deb && apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get install -y -q /tmp/freesurfer_8.2.0.deb && rm -f /tmp/freesurfer_8.2.0.deb && rm -rf /var/lib/apt/lists/*' + +bash -c 'apt-get update -qq && apt-get install -y -q --no-install-recommends bzip2 ca-certificates curl && rm -rf /var/lib/apt/lists/* && export PATH="/opt/miniconda-latest/bin:$PATH" && echo "Downloading Miniconda installer ..." && conda_installer="/tmp/miniconda.sh" && curl -fsSL -o "$conda_installer" https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh && bash "$conda_installer" -b -p /opt/miniconda-latest && rm -f "$conda_installer" && conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main && conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r && conda update -yq -nbase conda && conda install -yq -nbase conda-libmamba-solver && conda config --set solver libmamba && conda config --system --prepend channels conda-forge && conda config --set channel_priority strict && conda config --system --set auto_update_conda false && conda config --system --set show_channel_urls true && conda init bash && conda install -y --name base pandas && bash -c "source activate base && python -m pip install --no-cache-dir nibabel" && sync && conda clean --all --yes && sync && rm -rf ~/.cache/pip/*' + +bash -c 'curl -sL https://deb.nodesource.com/setup_18.x | bash -' + +apt-get update -qq +apt-get install -y -q --no-install-recommends \ + nodejs +rm -rf /var/lib/apt/lists/* + +bash -c 'npm install -g bids-validator@1.12.0' + +mkdir root/matlab && touch root/matlab/startup.m + +mkdir /scratch + +mkdir /local-scratch + +chmod +x /run.py + +# Save specification to JSON. +printf '{ \ + "pkg_manager": "apt", \ + "existing_users": [ \ + "root" \ + ], \ + "instructions": [ \ + { \ + "name": "from_", \ + "kwds": { \ + "base_image": "ubuntu:jammy" \ + } \ + }, \ + { \ + "name": "install", \ + "kwds": { \ + "pkgs": [ \ + "tcsh", \ + "bc", \ + "tar", \ + "libgomp1", \ + "wget", \ + "curl", \ + "ca-certificates" \ + ], \ + "opts": null \ + } \ + }, \ + { \ + "name": "run", \ + "kwds": { \ + "command": "apt-get update -qq\\napt-get install -y -q --no-install-recommends \\\\\\n bc \\\\\\n ca-certificates \\\\\\n curl \\\\\\n libgomp1 \\\\\\n tar \\\\\\n tcsh \\\\\\n wget\\nrm -rf /var/lib/apt/lists/*" \ + } \ + }, \ + { \ + "name": "run", \ + "kwds": { \ + "command": "bash -c '"'"'wget -q -O /tmp/freesurfer_8.2.0.deb https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/8.2.0/freesurfer_ubuntu22-8.2.0_amd64.deb && apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get install -y -q /tmp/freesurfer_8.2.0.deb && rm -f /tmp/freesurfer_8.2.0.deb && rm -rf /var/lib/apt/lists/*'"'"'" \ + } \ + }, \ + { \ + "name": "run", \ + "kwds": { \ + "command": "bash -c '"'"'apt-get update -qq && apt-get install -y -q --no-install-recommends bzip2 ca-certificates curl && rm -rf /var/lib/apt/lists/* && export PATH=\\"/opt/miniconda-latest/bin:$PATH\\" && echo \\"Downloading Miniconda installer ...\\" && conda_installer=\\"/tmp/miniconda.sh\\" && curl -fsSL -o \\"$conda_installer\\" https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh && bash \\"$conda_installer\\" -b -p /opt/miniconda-latest && rm -f \\"$conda_installer\\" && conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main && conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r && conda update -yq -nbase conda && conda install -yq -nbase conda-libmamba-solver && conda config --set solver libmamba && conda config --system --prepend channels conda-forge && conda config --set channel_priority strict && conda config --system --set auto_update_conda false && conda config --system --set show_channel_urls true && conda init bash && conda install -y --name base pandas && bash -c \\"source activate base && python -m pip install --no-cache-dir nibabel\\" && sync && conda clean --all --yes && sync && rm -rf ~/.cache/pip/*'"'"'" \ + } \ + }, \ + { \ + "name": "run", \ + "kwds": { \ + "command": "bash -c '"'"'curl -sL https://deb.nodesource.com/setup_18.x | bash -'"'"'" \ + } \ + }, \ + { \ + "name": "install", \ + "kwds": { \ + "pkgs": [ \ + "nodejs" \ + ], \ + "opts": null \ + } \ + }, \ + { \ + "name": "run", \ + "kwds": { \ + "command": "apt-get update -qq\\napt-get install -y -q --no-install-recommends \\\\\\n nodejs\\nrm -rf /var/lib/apt/lists/*" \ + } \ + }, \ + { \ + "name": "run", \ + "kwds": { \ + "command": "bash -c '"'"'npm install -g bids-validator@1.12.0'"'"'" \ + } \ + }, \ + { \ + "name": "env", \ + "kwds": { \ + "FSLDIR": "/usr/share/fsl/5.0", \ + "FSLOUTPUTTYPE": "NIFTI_GZ", \ + "FSLMULTIFILEQUIT": "TRUE", \ + "POSSUMDIR": "/usr/share/fsl/5.0", \ + "LD_LIBRARY_PATH": "/usr/lib/fsl/5.0:", \ + "FSLTCLSH": "/usr/bin/tclsh", \ + "FSLWISH": "/usr/bin/wish" \ + } \ + }, \ + { \ + "name": "env", \ + "kwds": { \ + "FS_VERSION": "8.2.0" \ + } \ + }, \ + { \ + "name": "env", \ + "kwds": { \ + "OS": "Linux", \ + "FS_OVERRIDE": "0", \ + "FIX_VERTEX_AREA": "", \ + "SUBJECTS_DIR": "/usr/local/freesurfer/8.2.0/subjects", \ + "FSF_OUTPUT_FORMAT": "nii.gz", \ + "MNI_DIR": "/usr/local/freesurfer/8.2.0/mni", \ + "LOCAL_DIR": "/usr/local/freesurfer/8.2.0/local", \ + "FREESURFER_HOME": "/usr/local/freesurfer/8.2.0", \ + "FREESURFER": "/usr/local/freesurfer/8.2.0", \ + "FSFAST_HOME": "/usr/local/freesurfer/8.2.0/fsfast", \ + "MINC_BIN_DIR": "/usr/local/freesurfer/8.2.0/mni/bin", \ + "MINC_LIB_DIR": "/usr/local/freesurfer/8.2.0/mni/lib", \ + "MNI_DATAPATH": "/usr/local/freesurfer/8.2.0/mni/data", \ + "FMRI_ANALYSIS_DIR": "/usr/local/freesurfer/8.2.0/fsfast", \ + "FUNCTIONALS_DIR": "/usr/local/freesurfer/8.2.0/sessions", \ + "PERL5LIB": "/usr/local/freesurfer/8.2.0/mni/share/perl5", \ + "MNI_PERL5LIB": "/usr/local/freesurfer/8.2.0/mni/share/perl5/", \ + "PATH": "/opt/miniconda-latest/bin:/usr/local/freesurfer/8.2.0/bin:/usr/local/freesurfer/8.2.0/fsfast/bin:/usr/local/freesurfer/8.2.0/tktools:/usr/local/freesurfer/8.2.0/mni/bin:/usr/lib/fsl/5.0:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", \ + "PYTHONPATH": "" \ + } \ + }, \ + { \ + "name": "run", \ + "kwds": { \ + "command": "mkdir root/matlab && touch root/matlab/startup.m" \ + } \ + }, \ + { \ + "name": "run", \ + "kwds": { \ + "command": "mkdir /scratch" \ + } \ + }, \ + { \ + "name": "run", \ + "kwds": { \ + "command": "mkdir /local-scratch" \ + } \ + }, \ + { \ + "name": "copy", \ + "kwds": { \ + "source": [ \ + "run.py" \ + ], \ + "destination": "/run.py" \ + } \ + }, \ + { \ + "name": "run", \ + "kwds": { \ + "command": "chmod +x /run.py" \ + } \ + }, \ + { \ + "name": "copy", \ + "kwds": { \ + "source": [ \ + "version" \ + ], \ + "destination": "/version" \ + } \ + }, \ + { \ + "name": "entrypoint", \ + "kwds": { \ + "args": [ \ + "python", \ + "/run.py" \ + ] \ + } \ + } \ + ] \ +}' > /.reproenv.json +# End saving to specification to JSON. + +%runscript +python /run.py diff --git a/generate_freesurfer_images.sh b/generate_freesurfer_images.sh index 6aec875..568ed17 100644 --- a/generate_freesurfer_images.sh +++ b/generate_freesurfer_images.sh @@ -48,38 +48,86 @@ do else OUTFILEBASE=Singularity fi - for VERSION in "6.0.1" "7.4.1" + for VERSION in "6.0.1" "7.4.1" "8.2.0" do if [ $VERSION = "6.0.1" ] then OUTFILE=${OUTFILEBASE}_fs6 INSTALL_DIR=/opt/freesurfer - else + FS_ROOT=$INSTALL_DIR + elif [ $VERSION = "7.4.1" ] + then OUTFILE=${OUTFILEBASE}_fs7 + # INSTALL_DIR here is the --freesurfer install_path=, i.e. the tar + # extraction target below (-C $INSTALL_DIR --strip-components 1) -- + # it is NOT the same as the true FreeSurfer root (FS_ROOT). The + # 7.4.1 tarball's entries are "./freesurfer/...", so + # --strip-components 1 only strips the leading "./"; extracting + # into /opt/freesurfer directly (like fs6) would double-nest to + # /opt/freesurfer/freesurfer. Extracting into /opt/ instead lands + # the files at /opt/freesurfer, one level below INSTALL_DIR. + # Confirmed by actually building both variants and inspecting the + # image (`docker run --entrypoint bash ... find /opt`), not just + # reading the extraction command -- a "fix" here that made FS_ROOT + # equal INSTALL_DIR broke recon-all's PATH entirely (caught by CI: + # bids-apps/freesurfer#96, test_7_1/test_7_2, "recon-all: not found"). INSTALL_DIR=/opt/ + FS_ROOT=/opt/freesurfer + else + OUTFILE=${OUTFILEBASE}_fs8 + INSTALL_DIR=/usr/local/freesurfer/8.2.0 + FS_ROOT=$INSTALL_DIR + fi + + # 8.2.0 ships only as a .deb (no generic tarball), so neurodocker's + # --freesurfer template (which only knows versions <=7.4.1) can't be used + # for it -- install it by hand the same way the miniconda/nodejs steps + # below already do with --run-bash. apt resolves the .deb's own Depends: + # (xorg/tcsh/bc/etc.), so no need to hand-list them here like the + # tarball-based versions below do. + ARGS=(generate ${TARGET} --base-image ubuntu:jammy --pkg-manager apt) + if [ $VERSION = "8.2.0" ] + then + ARGS+=(--install tcsh bc tar libgomp1 wget curl ca-certificates) + ARGS+=(--run-bash "wget -q -O /tmp/freesurfer_8.2.0.deb https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/8.2.0/freesurfer_ubuntu22-8.2.0_amd64.deb && apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get install -y -q /tmp/freesurfer_8.2.0.deb && rm -f /tmp/freesurfer_8.2.0.deb && rm -rf /var/lib/apt/lists/*") + else + ARGS+=(--install tcsh bc tar libgomp1 perl-modules wget curl libsm-dev libx11-dev libxt-dev libxext-dev libglu1-mesa libpython2.7-stdlib python2) + ARGS+=(--freesurfer version=${VERSION} install_path=$INSTALL_DIR) fi + # run.py no longer calls df.append() (removed in pandas 2.0), so nothing + # needs the old pandas==1.5.3 pin anymore -- and pinning it now actively + # breaks the build: Miniconda's "latest" installer currently ships + # Python 3.14, which pandas 1.5.3 (needs <3.11) can't be solved against. + PANDAS_SPEC="pandas" + + # Hand-written equivalent of neurodocker's own --miniconda template: that + # template (baked into the pinned neurodocker image) predates Anaconda's + # Terms-of-Service gate on the defaults channels, so a fresh build fails + # with CondaToSNonInteractiveError on `conda update -yq -nbase conda` + # regardless of FreeSurfer version -- not an fs8-specific issue, would hit + # a fresh fs6/fs7 build the same way. Same steps as the template's own + # generated RUN block, just with the two `conda tos accept` calls it's + # missing, inserted where the error says to run them (right after the + # installer, before anything else touches those channels). + CONDA_CMD='apt-get update -qq && apt-get install -y -q --no-install-recommends bzip2 ca-certificates curl && rm -rf /var/lib/apt/lists/* && export PATH="/opt/miniconda-latest/bin:$PATH" && echo "Downloading Miniconda installer ..." && conda_installer="/tmp/miniconda.sh" && curl -fsSL -o "$conda_installer" https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh && bash "$conda_installer" -b -p /opt/miniconda-latest && rm -f "$conda_installer" && conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main && conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r && conda update -yq -nbase conda && conda install -yq -nbase conda-libmamba-solver && conda config --set solver libmamba && conda config --system --prepend channels conda-forge && conda config --set channel_priority strict && conda config --system --set auto_update_conda false && conda config --system --set show_channel_urls true && conda init bash && conda install -y --name base '"$PANDAS_SPEC"' && bash -c "source activate base && python -m pip install --no-cache-dir nibabel" && sync && conda clean --all --yes && sync && rm -rf ~/.cache/pip/*' # Generate a dockerfile for building BIDS-Apps Freesurfer container - docker run --rm ${image} generate ${TARGET} \ - --base-image ubuntu:jammy \ - --pkg-manager apt \ - --install tcsh bc tar libgomp1 perl-modules wget curl \ - libsm-dev libx11-dev libxt-dev libxext-dev libglu1-mesa libpython2.7-stdlib python2 \ - --freesurfer version=${VERSION} install_path=$INSTALL_DIR \ - --miniconda version=latest mamba=true conda_install="pandas=1.5.3" pip_install="nibabel" \ + docker run --rm ${image} "${ARGS[@]}" \ + --run-bash "$CONDA_CMD" \ --run-bash 'curl -sL https://deb.nodesource.com/setup_18.x | bash -' \ --install nodejs \ --run-bash 'npm install -g bids-validator@1.12.0' \ --env FSLDIR=/usr/share/fsl/5.0 FSLOUTPUTTYPE=NIFTI_GZ \ FSLMULTIFILEQUIT=TRUE POSSUMDIR=/usr/share/fsl/5.0 LD_LIBRARY_PATH=/usr/lib/fsl/5.0:$LD_LIBRARY_PATH \ FSLTCLSH=/usr/bin/tclsh FSLWISH=/usr/bin/wish FSLOUTPUTTYPE=NIFTI_GZ \ - --env OS=Linux FS_OVERRIDE=0 FIX_VERTEX_AREA= SUBJECTS_DIR=/opt/freesurfer/subjects \ - FSF_OUTPUT_FORMAT=nii.gz MNI_DIR=/opt/freesurfer/mni LOCAL_DIR=/opt/freesurfer/local \ - FREESURFER_HOME=/opt/freesurfer FSFAST_HOME=/opt/freesurfer/fsfast MINC_BIN_DIR=/opt/freesurfer/mni/bin \ - MINC_LIB_DIR=/opt/freesurfer/mni/lib MNI_DATAPATH=/opt/freesurfer/mni/data \ - FMRI_ANALYSIS_DIR=/opt/freesurfer/fsfast PERL5LIB=/opt/freesurfer/mni/share/perl5 \ - MNI_PERL5LIB=/opt/freesurfer/mni/share/perl5/ \ - PATH=/opt/miniconda-latest/bin:/opt/freesurfer/bin:/opt/freesurfer/fsfast/bin:/opt/freesurfer/tktools:/opt/freesurfer/mni/bin:/usr/lib/fsl/5.0:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \ + --env FS_VERSION=${VERSION} \ + --env OS=Linux FS_OVERRIDE=0 FIX_VERTEX_AREA= SUBJECTS_DIR=$FS_ROOT/subjects \ + FSF_OUTPUT_FORMAT=nii.gz MNI_DIR=$FS_ROOT/mni LOCAL_DIR=$FS_ROOT/local \ + FREESURFER_HOME=$FS_ROOT FREESURFER=$FS_ROOT FSFAST_HOME=$FS_ROOT/fsfast MINC_BIN_DIR=$FS_ROOT/mni/bin \ + MINC_LIB_DIR=$FS_ROOT/mni/lib MNI_DATAPATH=$FS_ROOT/mni/data \ + FMRI_ANALYSIS_DIR=$FS_ROOT/fsfast FUNCTIONALS_DIR=$FS_ROOT/sessions PERL5LIB=$FS_ROOT/mni/share/perl5 \ + MNI_PERL5LIB=$FS_ROOT/mni/share/perl5/ \ + PATH=/opt/miniconda-latest/bin:$FS_ROOT/bin:$FS_ROOT/fsfast/bin:$FS_ROOT/tktools:$FS_ROOT/mni/bin:/usr/lib/fsl/5.0:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \ PYTHONPATH="" \ --run 'mkdir root/matlab && touch root/matlab/startup.m' \ --run 'mkdir /scratch' \ diff --git a/run.py b/run.py index 1777afc..8c7eab1 100755 --- a/run.py +++ b/run.py @@ -29,12 +29,8 @@ def run(command, env={}, ignore_errors=False): raise Exception("Non zero return code: %d" % process.returncode) # warn about freesurfer version -with open(os.path.join(os.environ['FREESURFER_HOME'], 'build-stamp.txt'), 'r') as h: - bs = h.read() -if 'x86_64-7.' in bs: - fsversion=7 -else: - fsversion=6 +fsversion = int(os.environ['FS_VERSION'].split('.')[0]) +if fsversion == 6: warn("You are using FreeSurver version 6. " "The FreeSurfer 7 BIDS-App is now available via docker pull bids/freesurfer:v7 . " "FreeSurfer 7 will become the default version in the FreeSurfer BIDS-App begining in 2024. " @@ -528,12 +524,9 @@ def run(command, env={}, ignore_errors=False): raise Exception("No freesurfer subject found for %s in %s" % (s, output_dir)) subjects_str = " ".join(subjects) - # The call to python2 is only required if we're running Freesurfer 6, we'll need to check version - # and modify the calls accordingly. - if fsversion == 7: - cmd_start = '' - else: - cmd_start = 'python2 ' + # FreeSurfer 6's aparcstats2table/asegstats2table need an explicit python2 + # invocation; FreeSurfer 7+ scripts are python3 and run directly. + cmd_start = '' if fsversion >= 7 else 'python2 ' if len(subjects) > 0: # create cortical stats @@ -600,8 +593,8 @@ def extract_euler(logfile): "lh_euler": [lh_euler], "rh_euler": [rh_euler]}, columns=["subject", "lh_euler", "rh_euler"]) - df = df.append(df_subject) - df["mean_euler_bh"] = df[["lh_euler", "rh_euler"]].mean(1) + df = pd.concat([df, df_subject]) + df["mean_euler_bh"] = df[["lh_euler", "rh_euler"]].mean(axis=1) df.sort_values("subject", inplace=True) df.to_csv(euler_out_file, sep="\t", index=False) else: