anchor.diff:      MNI_PERL5LIB="$MINC_LIB_DIR/perl5/5.8.5" \
       PATH="$FREESURFER_HOME/bin:$FSFAST_HOME/bin:$FREESURFER_HOME/tktools:$MINC_BIN_DIR:$PATH"
   
  -# Installing Neurodebian packages (FSL, AFNI, git-annex)
  +# Installing Neurodebian packages
   RUN curl -sSL "http://neuro.debian.net/lists/$( lsb_release -c | cut -f2 ).us-ca.full" >> /etc/apt/sources.list.d/neurodebian.sources.list && \
       apt-key add /usr/local/etc/neurodebian.gpg && \
       (apt-key adv --refresh-keys --keyserver hkp://ha.pool.sks-keyservers.net 0xA5D32F012649A5A9 || true)
   RUN apt-get update && \
       apt-get install -y --no-install-recommends \
  -                    fsl-core=5.0.9-5~nd16.04+1 \
  -                    fsl-mni152-templates=5.0.7-2 \
  -                    afni=16.2.07~dfsg.1-5~nd16.04+1 \
  -                    convert3d \
  -                    connectome-workbench=1.3.2-2~nd16.04+1 \
  -                    git-annex-standalone && \
  +                    connectome-workbench=1.5.0-1~nd20.04+1 \
  +                    git-annex-standalone=8.20210223-1~ndall+1 && \
       apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
   
  -# Setting FSL and AFNI envvars
  -ENV FSLDIR="/usr/share/fsl/5.0" \
  +# FSL 5.0.11 (neurodocker build)
  +RUN apt-get update -qq \
  +    && apt-get install -y -q --no-install-recommends \
  +           bc \
  +           dc \
  +           file \
  +           libfontconfig1 \
  +           libfreetype6 \
  +           libgl1-mesa-dev \
  +           libgl1-mesa-dri \
  +           libglu1-mesa-dev \
  +           libgomp1 \
  +           libice6 \
  +           libxcursor1 \
  +           libxft2 \
  +           libxinerama1 \
  +           libxrandr2 \
  +           libxrender1 \
  +           libxt6 \
  +           sudo \
  +           wget \
  +    && apt-get clean \
  +    && rm -rf /var/lib/apt/lists/* \
  +    && echo "Downloading FSL ..." \
  +    && mkdir -p /opt/fsl-5.0.11 \
  +    && curl -fsSL --retry 5 https://fsl.fmrib.ox.ac.uk/fsldownloads/fsl-5.0.11-centos6_64.tar.gz \
  +    | tar -xz -C /opt/fsl-5.0.11 --strip-components 1 \
  +    && echo "Installing FSL conda environment ..." \
  +    && bash /opt/fsl-5.0.11/etc/fslconf/fslpython_install.sh -f /opt/fsl-5.0.11
  +ENV FSLDIR="/opt/fsl-5.0.11" \
  +    PATH="/opt/fsl-5.0.11/bin:$PATH" \
       FSLOUTPUTTYPE="NIFTI_GZ" \
       FSLMULTIFILEQUIT="TRUE" \
  -    POSSUMDIR="/usr/share/fsl/5.0" \
  -    FSLTCLSH="/usr/bin/tclsh" \
  -    FSLWISH="/usr/bin/wish" \
  -    AFNI_MODELPATH="/usr/lib/afni/models" \
  +    FSLTCLSH="/opt/fsl-5.0.11/bin/fsltclsh" \
  +    FSLWISH="/opt/fsl-5.0.11/bin/fslwish" \
  +    FSLLOCKDIR="" \
  +    FSLMACHINELIST="" \
  +    FSLREMOTECALL="" \
  +    FSLGECUDAQ="cuda.q" \
  +    POSSUMDIR="/opt/fsl-5.0.11" \
  +    LD_LIBRARY_PATH="/opt/fsl-5.0.11:$LD_LIBRARY_PATH"
  +
  +# Convert3D (neurodocker build)
  +RUN echo "Downloading Convert3D ..." \
  +    && mkdir -p /opt/convert3d-1.0.0 \
  +    && curl -fsSL --retry 5 https://sourceforge.net/projects/c3d/files/c3d/1.0.0/c3d-1.0.0-Linux-x86_64.tar.gz/download \
  +    | tar -xz -C /opt/convert3d-1.0.0 --strip-components 1
  +ENV C3DPATH="/opt/convert3d-1.0.0" \
  +    PATH="/opt/convert3d-1.0.0/bin:$PATH"
  +
  +# 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 \
  +           libxm4 \
  +           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.2_amd64.deb \
  +    && dpkg -i /tmp/multiarch.deb \
  +    && rm /tmp/multiarch.deb \
  +    && curl -sSL --retry 5 -o /tmp/libxp6.deb http://mirrors.kernel.org/debian/pool/main/libx/libxp/libxp6_1.0.2-2_amd64.deb \
  +    && dpkg -i /tmp/libxp6.deb \
  +    && rm /tmp/libxp6.deb \
  +    && curl -sSL --retry 5 -o /tmp/libpng.deb http://snapshot.debian.org/archive/debian-security/20160113T213056Z/pool/updates/main/libp/libpng/libpng12-0_1.2.49-1%2Bdeb7u2_amd64.deb \
  +    && dpkg -i /tmp/libpng.deb \
  +    && rm /tmp/libpng.deb \
  +    && apt-get install -f \
  +    && apt-get clean \
  +    && rm -rf /var/lib/apt/lists/* \
  +    && gsl2_path="$(find / -name 'libgsl.so.19' || printf '')" \
  +    && if [ -n "$gsl2_path" ]; then \
  +         ln -sfv "$gsl2_path" "$(dirname $gsl2_path)/libgsl.so.0"; \
  +    fi \
  +    && ldconfig \
  +    && echo "Downloading AFNI ..." \
  +    && mkdir -p /opt/afni-latest \
  +    && curl -fsSL --retry 5 https://afni.nimh.nih.gov/pub/dist/tgz/linux_openmp_64.tgz \
  +    | tar -xz -C /opt/afni-latest --strip-components 1
  +ENV PATH="/opt/afni-latest:$PATH" \
       AFNI_IMSAVE_WARNINGS="NO" \
  -    AFNI_TTATLAS_DATASET="/usr/share/afni/atlases" \
  -    AFNI_PLUGINPATH="/usr/lib/afni/plugins" \
  -    PATH="/usr/lib/fsl/5.0:/usr/lib/afni/bin:$PATH" \
  -    LD_LIBRARY_PATH="/usr/lib/fsl/5.0:$LD_LIBRARY_PATH"
  +    AFNI_PLUGINPATH="/opt/afni-latest"
   
   # Installing ANTs 2.3.4 (NeuroDocker build)
   ENV ANTSPATH="/usr/lib/ants" \
  
positive.code:                     autoconf \
                      libtool \
                      pkg-config \
                      git && \
      curl -sSL https://deb.nodesource.com/setup_10.x | bash - && \
      apt-get install -y --no-install-recommends \
                      nodejs && \
      apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
  
  # Install latest pandoc
  RUN curl -o pandoc-2.2.2.1-1-amd64.deb -sSL "https://github.com/jgm/pandoc/releases/download/2.2.2.1/pandoc-2.2.2.1-1-amd64.deb" && \
      dpkg -i pandoc-2.2.2.1-1-amd64.deb && \
      rm pandoc-2.2.2.1-1-amd64.deb
  
  # Installing freesurfer
  RUN curl -sSL https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/6.0.1/freesurfer-Linux-centos6_x86_64-stable-pub-v6.0.1.tar.gz | tar zxv --no-same-owner -C /opt \
      --exclude='freesurfer/diffusion' \
      --exclude='freesurfer/docs' \
      --exclude='freesurfer/fsfast' \
  
negative.code:     PYTHONNOUSERSITE=1
  
  # Installing precomputed python packages
  RUN conda install -y python=3.8 && \
      conda install -y pip=20.0 && \
      conda install -y mkl=2020.2 && \
      conda install -y mkl-service && \
      conda install -y numpy=1.20 && \
      conda install -y scipy=1.6 && \
      conda install -y scikit-learn=0.24 && \
      conda install -y matplotlib=3.3 && \
      conda install -y pandas=1.2 && \
      conda install -y libxslt=1.1 && \
      conda install -y traits=6.1.0 && \
      conda install -y zlib; sync && \
      chmod -R a+rX /usr/local/miniconda; sync && \
      chmod +x /usr/local/miniconda/bin/*; sync && \
      conda clean -y --all && sync && \
  