Scheduled service maintenance on November 22


On Friday, November 22, 2024, between 06:00 CET and 18:00 CET, GIN services will undergo planned maintenance. Extended service interruptions should be expected. We will try to keep downtimes to a minimum, but recommend that users avoid critical tasks, large data uploads, or DOI requests during this time.

We apologize for any inconvenience.

brainageR.def 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. Bootstrap: docker
  2. From: ubuntu:16.04
  3. Stage: spython-base
  4. %files
  5. neurodebian.gpg /root/.neurodebian.gpg
  6. brainageR /opt/tmp/brainageR
  7. %post
  8. # Create a base docker container that can execute the new version 2.1 of brainageR
  9. # https://github.com/james-cole/brainageR
  10. # Authors: Daniela Furlan and Ferran Prados
  11. #
  12. # Example usage:
  13. #
  14. # docker run --rm -it -v ${PWD}/your_data:/data -w /data \
  15. # docker.io/library/brainimage:latest brainageR \
  16. # -f sub-01_T1w_defaced.nii -o subj01_brain_predicted.age.csv
  17. #
  18. # Build the docker:
  19. #
  20. # docker build . -f Dockerfile -t brainimage
  21. #
  22. # Install the needed basic packages
  23. apt-get update
  24. apt-get install -y --fix-missing \
  25. unzip \
  26. git \
  27. wget \
  28. openssl \
  29. libssl-dev \
  30. libxml2 \
  31. libcurl4-openssl-dev
  32. # Install R-package
  33. apt-get update \
  34. && apt-get install -y --no-install-recommends \
  35. software-properties-common \
  36. dirmngr \
  37. ed \
  38. less \
  39. locales \
  40. vim-tiny \
  41. wget \
  42. ca-certificates \
  43. && add-apt-repository --enable-source --yes "ppa:marutter/rrutter4.0" \
  44. && add-apt-repository --enable-source --yes "ppa:c2d4u.team/c2d4u4.0+"
  45. # Configure default locale, see https://github.com/rocker-org/rocker/issues/19
  46. echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen \
  47. && locale-gen en_US.utf8 \
  48. && /usr/sbin/update-locale LANG=en_US.UTF-8
  49. LC_ALL=en_US.UTF-8
  50. LANG=en_US.UTF-8
  51. # This was not needed before but we need it now
  52. DEBIAN_FRONTEND=noninteractive
  53. # Otherwise timedatectl will get called which leads to 'no systemd' inside Docker
  54. TZ=UTC
  55. # Now install R and littler, and create a link for littler in /usr/local/bin
  56. # Default CRAN repo is now set by R itself, and littler knows about it too
  57. # r-cran-docopt is not currently in c2d4u so we install from source
  58. apt-get update \
  59. && apt-get install -y --no-install-recommends \
  60. littler \
  61. r-base \
  62. r-base-dev \
  63. r-recommended \
  64. && ln -s /usr/lib/R/site-library/littler/examples/install.r /usr/local/bin/install.r \
  65. && ln -s /usr/lib/R/site-library/littler/examples/install2.r /usr/local/bin/install2.r \
  66. && ln -s /usr/lib/R/site-library/littler/examples/installGithub.r /usr/local/bin/installGithub.r \
  67. && ln -s /usr/lib/R/site-library/littler/examples/testInstalled.r /usr/local/bin/testInstalled.r \
  68. && install.r docopt \
  69. && rm -rf /tmp/downloaded_packages/ /tmp/*.rds \
  70. && rm -rf /var/lib/apt/lists/*
  71. # Install packages kernlab,RNifti and stringr
  72. R -e "install.packages('kernlab',dependencies=TRUE, repos='http://cran.rstudio.com/')"
  73. R -e "install.packages('RNifti',dependencies=TRUE, repos='http://cran.rstudio.com/')"
  74. R -e "install.packages('stringr',dependencies=TRUE, repos='http://cran.rstudio.com/')"
  75. # Install SMP12 and Octave
  76. apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install \
  77. build-essential \
  78. curl \
  79. octave \
  80. liboctave-dev \
  81. && apt-get clean \
  82. && rm -rf \
  83. /tmp/hsperfdata* \
  84. /var/*/apt/*/partial \
  85. /var/lib/apt/lists/* \
  86. /var/log/apt/term*
  87. mkdir /opt/spm12 \
  88. && curl -SL https://github.com/spm/spm12/archive/refs/tags/r7219.tar.gz \
  89. | tar -xzC /opt/spm12 --strip-components 1 \
  90. && curl -SL https://raw.githubusercontent.com/spm/spm-docker/main/octave/spm12_r7771.patch \
  91. | patch -p0 \
  92. && make -C /opt/spm12/src PLATFORM=octave distclean \
  93. && make -C /opt/spm12/src PLATFORM=octave \
  94. && make -C /opt/spm12/src PLATFORM=octave install \
  95. && ln -s /opt/spm12/bin/spm12-octave /usr/local/bin/spm12
  96. # Install FSL
  97. apt-get update
  98. # setup FSL using debian
  99. NDEB_URL=http://neuro.debian.net/lists/xenial.us-ca.full
  100. apt-get install -y software-properties-common python-software-properties
  101. add-apt-repository universe
  102. apt-get update
  103. \
  104. curl -sSL $NDEB_URL >> /etc/apt/sources.list.d/neurodebian.sources.list && \
  105. apt-key add /root/.neurodebian.gpg && \
  106. (apt-key adv --refresh-keys --keyserver hkp://ha.pool.sks-keyservers.net 0xA5D32F012649A5A9 || true) && \
  107. apt-get update
  108. \
  109. apt-get update && \
  110. apt-get install -y \
  111. fsl-5.0-core \
  112. fsl-mni152-templates=5.0.7-2
  113. # Configure environment
  114. FSLDIR=/usr/share/fsl/5.0
  115. FSLOUTPUTTYPE=NIFTI_GZ
  116. FSLMULTIFILEQUIT=TRUE
  117. POSSUMDIR=/usr/share/fsl/5.0
  118. LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/fsl/5.0
  119. FSLTCLSH=/usr/bin/tclsh
  120. FSLWISH=/usr/bin/wish
  121. PATH=$FSLDIR/bin:$PATH
  122. PATH=.:$PATH
  123. PATH=/opt/brainageR/software:$PATH
  124. \
  125. echo ". $FSLDIR/etc/fslconf/fsl.sh" >> ~/.bashrc && \
  126. echo "export FSLDIR PATH" >> ~/.bashrc
  127. # Install brainageR
  128. # Install brainageR zip v2.1 from github
  129. cd /opt && \
  130. wget https://github.com/james-cole/brainageR/archive/refs/tags/2.1.zip
  131. # BrainageR directory
  132. cd /opt && \
  133. pwd
  134. ls -al
  135. mkdir brainageR
  136. # Unzip 2.1 in brainageR directory
  137. cd /opt && \
  138. unzip 2.1.zip -d /opt/brainageR
  139. # Rename unzipped 2.1 folder (brainageR-2.1)
  140. cd /opt/brainageR &&\
  141. mv brainageR-2.1 software
  142. # Data directory for input and output
  143. mkdir -p /data
  144. # Download PCAs
  145. # pca_center.rds
  146. cd /opt/brainageR/software &&\
  147. wget https://github.com/james-cole/brainageR/releases/download/2.1/pca_center.rds
  148. # pca_rotation.rds
  149. cd /opt/brainageR/software &&\
  150. wget https://github.com/james-cole/brainageR/releases/download/2.1/pca_rotation.rds
  151. # pca_scale.rds
  152. cd /opt/brainageR/software &&\
  153. wget https://github.com/james-cole/brainageR/releases/download/2.1/pca_scale.rds
  154. # Install the needed packages
  155. apt-get update
  156. apt-get install -y --fix-missing \
  157. cmake \
  158. gcc \
  159. g++ \
  160. git \
  161. libeigen3-dev \
  162. zlib1g-dev \
  163. libpng-dev \
  164. openssl* \
  165. doxygen \
  166. xvfb \
  167. curl
  168. # Install NiftyReg and NiftySeg from QNI bitbucket account
  169. cd /opt && \
  170. git clone https://github.com/KCL-BMEIS/niftyreg.git niftyreg && \
  171. cd niftyreg && \
  172. mkdir build-reg && \
  173. cd build-reg && \
  174. cmake \
  175. -D \
  176. CMAKE_BUILD_TYPE=Release \
  177. BUILD_SHARED_LIBS=ON \
  178. BUILD_ALL_DEP=ON \
  179. USE_OPENMP=ON \
  180. /opt/niftyreg && \
  181. make && \
  182. make install && \
  183. cd /opt && \
  184. git clone https://github.com/KCL-BMEIS/niftyseg.git niftyseg && \
  185. cd niftyseg && \
  186. mkdir build-seg && \
  187. cd build-seg && \
  188. cmake \
  189. -D \
  190. CMAKE_BUILD_TYPE=Release \
  191. BUILD_SHARED_LIBS=ON \
  192. USE_OPENMP=ON \
  193. /opt/niftyseg && \
  194. make && \
  195. make install
  196. # Substituting brainageR script by a brainageR script with new software directories·
  197. # Edited variables: brainageR_dir, spm_dir, matlab_path,FSLDIR
  198. mv /opt/tmp/brainageR /opt/brainageR/software/brainageR
  199. chmod +x /opt/brainageR/software/brainageR
  200. %environment
  201. export LC_ALL=en_US.UTF-8
  202. export LANG=en_US.UTF-8
  203. export DEBIAN_FRONTEND=noninteractive
  204. export TZ=UTC
  205. export NDEB_URL=http://neuro.debian.net/lists/xenial.us-ca.full
  206. export FSLDIR=/usr/share/fsl/5.0
  207. export FSLOUTPUTTYPE=NIFTI_GZ
  208. export FSLMULTIFILEQUIT=TRUE
  209. export POSSUMDIR=/usr/share/fsl/5.0
  210. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/fsl/5.0
  211. export FSLTCLSH=/usr/bin/tclsh
  212. export FSLWISH=/usr/bin/wish
  213. export PATH=$FSLDIR/bin:$PATH
  214. export PATH=.:$PATH
  215. export PATH=/opt/brainageR/software:$PATH
  216. %runscript
  217. exec /bin/bash "$@"
  218. %startscript
  219. exec /bin/bash "$@"