FSL-Dokerfile编写

通过下载源文件安装FSL(测试成功,但不稳定,取决于网络)

RUN apt update && apt-get install -y \
    libegl1-mesa-dev \ 
    libopenblas-dev

# fsl install  
ENV FSLDIR="/opt/fsl-6.0.3" \
    FSLOUTPUTTYPE=NIFTI_GZ \
    PATH="/opt/fsl-6.0.3/bin:$PATH"
    
RUN echo "Downloading FSL ..." \
      && mkdir -p /opt/fsl-6.0.3 \
      && curl -fsSL --retry 20 https://fsl.fmrib.ox.ac.uk/fsldownloads/fsl-6.0.3-centos6_64.tar.gz \
      | tar -xz -C /opt/fsl-6.0.3 --strip-components 1 \
      --exclude='fsl/doc' \
      --exclude='fsl/data/atlases' \
      --exclude='fsl/data/possum' \
      --exclude='fsl/src' \
      --exclude='fsl/extras/src' \
      --exclude='fsl/bin/fslview*' \
      --exclude='fsl/bin/FSLeyes' \
      && echo "Installing FSL conda environment ..." \
      && sed -i -e "/fsleyes/d" -e "/wxpython/d" \
         ${FSLDIR}/etc/fslconf/fslpython_environment.yml \
      && bash /opt/fsl-6.0.3/etc/fslconf/fslpython_install.sh -f /opt/fsl-6.0.3 \
      && find ${FSLDIR}/fslpython/envs/fslpython/lib/python3.7/site-packages/ -type d -name "tests"  -print0 | xargs -0 rm -r \
      && ${FSLDIR}/fslpython/bin/conda clean --all

通过本地文件安装FSL(不执行fslpython_install.sh 不会影响常用命令,但会影响bianca, FSLeyes等)。 注意:最后一行用于指定eddy_cuda

RUN apt update && apt-get install -y \
    libegl1-mesa-dev \ 
    libopenblas-dev
COPY fsl-6.0.4-centos6_64.tar.gz /opt/
RUN echo "Downloading FSL ..." \
      && mkdir -p /opt/fsl-6.0.4 \
    && tar -xzvf /opt/fsl-6.0.4-centos6_64.tar.gz -C /opt/fsl-6.0.4 --strip-components 1 \
      --exclude='fsl/doc' \
      --exclude='fsl/data/atlases' \
      --exclude='fsl/data/possum' \
      --exclude='fsl/src' \
      --exclude='fsl/extras/src' \
      --exclude='fsl/bin/fslview*' \
      --exclude='fsl/bin/FSLeyes' \
      && rm /opt/fsl-6.0.4-centos6_64.tar.gz \
    && ln -s /opt/fsl-6.0.4/bin/eddy_cuda9.1 /opt/fsl-6.0.4/bin/eddy_cuda 

推荐: 简化安装FSL-6.0.4

# Download minified FSL (6.0.4)
WORKDIR /opt/fsl
RUN curl -fsSL https://osf.io/dv258/download \
    | tar xz --strip-components 1

ENV FSLDIR="/opt/fsl" \
  FSLOUTPUTTYPE=NIFTI_GZ \
  FSLMULTIFILEQUIT="TRUE" \
  FSLTCLSH="/opt/fsl/bin/fsltclsh" \
  FSLWISH="/opt/fsl/bin/fslwish" \
  PATH=$PATH:/opt/fsl/bin \
  LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$FSLDIR
Chenfei Ye
Chenfei Ye
A connectome weaver

The brain’s billions of neurons resemble trees of many species and come in many fantastic shapes. Only the most determined explorers can hope to capture a glimpse of this forest’s interior, and even they see little, and see it poorly.