-
Notifications
You must be signed in to change notification settings - Fork 0
/
MICe-container.def
354 lines (322 loc) · 10.5 KB
/
MICe-container.def
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
Bootstrap: debootstrap
OSVersion: focal
MirrorURL: http://us.archive.ubuntu.com/ubuntu/
%environment
export ANTSPATH=/usr/local/bin
# remember the system manpath (from /etc/manpath.config) when prepending:
export MANPATH="::"
export MINC_COMPRESS=6
export MINC_FORCE_V2=1
# prevent arbitrary growth in memory use when processing many minc files:
export VOLUME_CACHE_THRESHOLD=-1
# stuff installed by python3 setup.py install rather than pip ends up here:
export PYTHONPATH=/usr/lib/python3.8/site-packages:$PYTHONPATH
export R_LIBS_SITE=/usr/local/R/packratting/packrat/lib/x86_64-pc-linux-gnu/3.6.3 R
%post -c /bin/bash
export BUILD_CORES=8
export MINC_TOOLKIT_COMMIT="b98e4972bdac2b78e3c1e412d75c97e2e7c5f6b9"
export MINC_TOOLKIT_VERSION="1.9.18.2"
export RSTUDIO_VERSION="2022.07.1-554-amd64"
export ANTS_VERSION="aacdc61e35a5ea4a4f93f6ac6b04f71d091d6b6d"
export MINC2_SIMPLE_COMMIT="6382802dd6e3f712d394c7d708281d05b7e9a82b"
export CCTOOLS_VERSION="release/7.4.7"
export PYDPIPER_COMMIT="7277fad53b08157df50c0a3ab502b729854f4c62"
export PYEZMINC_COMMIT="4a1c16f834f1bbe4ebbef2985f42dac1ebd30dd2"
export RMINC_VERSION="1.5.3.0"
export MICE_LAB_COMMIT="78a54d7c34022aed28af05d2c625e1fe0e3b4778"
export F3D_VERSION=1.1.1
export SLICER_VERSION=v4.11.20210226
export DEBIAN_FRONTEND=noninteractive
# according to the Singularity documentation "best practice" is to install system packages
# here rather than via the 'Include' keyword (why?)
cat <<EOF > /etc/apt/sources.list
deb http://ca.archive.ubuntu.com/ubuntu/ focal main restricted
deb http://ca.archive.ubuntu.com/ubuntu/ focal-updates main restricted
deb http://ca.archive.ubuntu.com/ubuntu/ focal universe
deb http://ca.archive.ubuntu.com/ubuntu/ focal-updates universe
deb http://ca.archive.ubuntu.com/ubuntu/ focal multiverse
deb http://ca.archive.ubuntu.com/ubuntu/ focal-updates multiverse
deb http://security.ubuntu.com/ubuntu focal-security main restricted
deb http://security.ubuntu.com/ubuntu focal-security universe
deb http://security.ubuntu.com/ubuntu focal-security multiverse
EOF
apt-get -y update
apt-get install -y ca-certificates gnupg
# NeuroDebian (removed because this repo is down)
apt-get -y update
apt-get install -y \
build-essential \
locales \
autoconf \
automake \
cmake \
libtool \
m4 \
flex \
bison \
gdb \
dpkg-sig \
gdebi-core \
swig \
texinfo \
g++ \
gfortran \
golang-go \
curl \
wget \
git \
lsof \
emacs \
neovim \
blender \
fsl \
gimp \
imagej \
imagemagick \
inkscape \
itksnap \
mencoder \
meshlab \
mplayer \
octave \
octave-openems \
openems \
pandoc \
parallel \
paraview \
python3 \
python3-pip \
r-base-core \
texlive-latex-extra \
texlive-science \
vlc \
freeglut3-dev \
libbz2-dev \
libcurl4-openssl-dev \
libeigen3-dev \
liblzma-dev \
libgl-dev \
libglu-dev \
libopenblas-dev \
libpcre2-dev \
libreadline-dev \
libssl-dev \
libssh-dev \
libsqlite3-dev \
libxml2-dev \
zlib1g-dev \
# update locales
locale-gen en_US.UTF-8 en_US en_CA.UTF-8 en_CA
#dpkg-reconfigure locales
pip3 install --upgrade pip setuptools wheel
# some other Python packages have broken builds,
# and require numpy already present
pip3 install --upgrade numpy cython
pip3 install attrdict # missing wxPython==4.2.0 dep
pip3 install --upgrade \
balsam-flow \
batchgenerators \
bids-validator \
cvxopt \
dask[complete] \
datalad \
dicom2nifti \
dipy \
disptools \
hyppo \
h5py \
imageio \
intensity-normalization \
ipython \
joblib \
jupyter \
matplotlib \
meshio \
mne \
neo \
networkx \
nibabel \
nilearn \
nipy \
nipype \
nitime \
nitransforms \
numexpr \
opencv-python \
openpyxl \
pandas \
pillow \
pybids \
pydicom \
pynrrd \
pyosf \
pytest \
pywavelets \
pyxnat \
scikit-build \
scikit-image \
scikit-learn \
scipy \
SimpleITK \
seaborn \
simpy \
statsmodels \
sympy \
tables \
transforms3d \
#pytorch-lightning \
#pytorch-metric-learning \
#skorch \
#tensorboardx \
#torch \
#torchvision \
#psychopy \ wxPython/wxwidgets install fails
# TODO pysurfer/visbrain/vispy - Mayavi build hangs
# TODO install torch, torchvision according to CPU, CUDA etc.?
# numba # broken due to numpy bounds
# TODO itk - no wheel for 22.04 ?
# TODO vtk - borked
# TODO onnx and/or onnxruntime - borked
# install cctools
(git clone https://github.com/cooperative-computing-lab/cctools.git
pushd cctools
git checkout ${CCTOOLS_VERSION}
./configure --prefix=/usr && make && make install
popd
rm -rf cctools)
# f3d # TODO vtk 9
#(git clone https://github.com/f3d-app/f3d
# cd f3d
# git checkout "v${F3D_VERSION}"
# mkdir build
# cd build
# cmake ..
# make
# make install)
# slicer
#apt-get install -y qt5-default qtmultimedia5-dev qttools5-dev libqt5xmlpatterns5-dev libqt5svg5-dev qtwebengine5-dev qtscript5-dev qtbase5-private-dev libqt5x11extras5-dev libxt-dev
#(git clone https://github.com/Slicer/Slicer.git
# cd Slicer
# git checkout ${SLICER_VERSION}
# ./Utilities/SetupForDevelopment.sh
# mkdir build
# cd build
# cmake -DCMAKE_BUILD_TYPE=Release ..
# make -j${BUILD_CORES}
# (cd Slicer-build
# make package
# #ctest -j4
# )
# ln -s /Slicer/build/Slicer-build/Slicer /usr/bin/Slicer
# )
# install rstudio desktop
gpg --keyserver keys.openpgp.org --recv-keys 3F32EE77E331692F
(wget https://download1.rstudio.org/desktop/bionic/amd64/rstudio-${RSTUDIO_VERSION}.deb
dpkg-sig --verify rstudio-${RSTUDIO_VERSION}.deb
gdebi -n rstudio-${RSTUDIO_VERSION}.deb
rm rstudio-${RSTUDIO_VERSION}.deb)
# to install rstudio-server (needs adaptation for container?):
(wget https://download2.rstudio.org/server/bionic/amd64/rstudio-server-${RSTUDIO_VERSION}.deb
dpkg-sig --verify rstudio-server-${RSTUDIO_VERSION}.deb
gdebi -n rstudio-server-${RSTUDIO_VERSION}.deb
rm rstudio-server-${RSTUDIO_VERSION}.deb)
apt-get autoclean
rm -rf /var/lib/apt/lists/*
# minc-toolkit-v2
(git clone --recursive https://github.com/BIC-MNI/minc-toolkit-v2.git
mkdir minc-toolkit-v2/build
pushd minc-toolkit-v2/build
git checkout ${MINC_TOOLKIT_COMMIT}
git submodule update --recursive
# TODO build updated external c3d and set -DMT_BUILD_C3D=OFF
cmake -DMT_BUILD_SHARED_LIBS=ON -DMT_BUILD_ANTS=OFF -DMT_BUILD_VISUAL_TOOLS=ON -DMT_BUILD_ELASTIX=OFF ..
make -j${BUILD_CORES}
#make test
make install
popd
rm -rf minc-toolkit-v2)
# TODO -DCMAKE_BUILD_TYPE=RelWithDebugInfo
# TODO Elastix - separate build?
export MINC_TOOLKIT_CONFIG=/usr/local/minc-toolkit-config.sh
sed -i '/LD_LIBRARY_PATH/d' ${MINC_TOOLKIT_CONFIG}
. ${MINC_TOOLKIT_CONFIG}
echo "source ${MINC_TOOLKIT_CONFIG}" >> $SINGULARITY_ENVIRONMENT
# install ANTs
(git clone https://github.com/ANTsX/ANTs.git
mkdir ANTs/build
pushd ANTs/build
git checkout ${ANTS_VERSION}
cmake -DITK_BUILD_MINC_SUPPORT=ON -DBUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX=/usr/local ..
make -j${BUILD_CORES}
cd ANTS-build && make install
popd
rm -rf ANTs)
# install minc-stuffs (automatically installs Pyminc)
(git clone --recursive https://github.com/Mouse-Imaging-Centre/minc-stuffs.git
cd minc-stuffs
./autogen.sh
./configure --with-minc2 --with-build-path=/usr/local
make
make install
pip3 install .
cd ..
rm -rf minc-stuffs)
# install pyezminc
(git clone https://github.com/BIC-MNI/pyezminc.git
cd pyezminc
git checkout ${PYEZMINC_COMMIT}
pip3 install .
#python3 setup.py install
cd ..
rm -rf pyezminc)
# install minc2-simple
(git clone https://github.com/NIST-MNI/minc2-simple.git
mkdir minc2-simple/build
pushd minc2-simple/build
pushd build
git checkout ${MINC2_SIMPLE_COMMIT}
cmake ..
make
make install
python3 ../python/setup.py install
#pip3 install .
popd
rm -rf minc2-simple)
# install Pydpiper
(git clone https://github.com/Mouse-Imaging-Centre/pydpiper.git
pushd pydpiper
git checkout ${PYDPIPER_COMMIT}
pip3 install .
popd
rm -rf pydpiper)
# install mice-lab
(git clone https://github.com/Mouse-Imaging-Centre/MICe-lab.git
cd MICe-lab
git checkout ${MICE_LAB_COMMIT}
./autogen.sh
./configure
make
make install
#python3 setup.py install
pip3 install .
cd ..
rm -rf MICe-lab.git)
# TODO install more viewers (openvv, f3d, seg3d, mango/papaya, slicer)
# install RMINC and R packages:
(wget https://github.com/Mouse-Imaging-Centre/RMINC/files/8307296/packratting-2022-03-18.tar.gz
mkdir -p /usr/local/R
Rscript -e 'install.packages("packrat"); library(packrat); packrat::unbundle("packratting-2022-03-18.tar.gz", where="/usr/local/R")'
export R_LIBS_SITE=/usr/local/R/packratting/packrat/lib/x86_64-pc-linux-gnu/3.6.3 R
Rscript -e 'library(devtools); devtools::install_github("Mouse-Imaging-Centre/RMINC@807ffc5886ae8ec407ecbbff81271e5476c08a41", upgrade="never"); devtools::install_github("Mouse-Imaging-Centre/MRIcrotome", upgrade="never")'
rm packratting-2022-03-18.tar.gz)
#(Rscript -e 'update.packages(repos="https://cloud.r-project.org",ask=F)'
# Rscript -e 'install.packages(c("lme4", "lmerTest", "tidyverse", "batchtools", "Rcpp", "rjson", "igraph", "jsonlite", "shiny", "visNetwork", "DT", "testthat", "bigstatsr", "data.table", "data.tree", "gridBase", "plotrix", "rgl", "rstanarm", "brms", "tidymodels", "vtreat", "dagitty", "lenses", "qvalue", "reticulate"), repos="https://cloud.r-project.org", ask=F)'
# wget https://github.com/Mouse-Imaging-Centre/RMINC/archive/v${RMINC_VERSION}.tar.gz
# R CMD INSTALL v${RMINC_VERSION}.tar.gz --configure-args='--with-build-path=/usr/local'
# rm -f RMINC_${RMINC_VERSION}.tar.gz)
%labels
Maintainer Ben Darwin
Author [email protected]
Version 20240726
%help
MICe imaging packages. Loosely based on Vlad's minc-toolkit-containers repository.