-
Notifications
You must be signed in to change notification settings - Fork 0
/
Singularity
69 lines (47 loc) · 1.8 KB
/
Singularity
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
Bootstrap: docker
From: ubuntu:20.04
%help
Registration of PET images. Info and usage:
/opt/petreg/README.md
%setup
mkdir -p ${SINGULARITY_ROOTFS}/opt/petreg
%files
src /opt/petreg
README.md /opt/petreg
%labels
Maintainer [email protected]
%post
apt-get update > /dev/null 2>&1
apt-get install -y wget unzip zip xvfb ghostscript imagemagick bc > /dev/null 2>&1 # Misc tools
apt-get install -y libopenblas-base language-pack-en > /dev/null 2>&1 # FSL
# Fix imagemagick policy to allow PDF output and text read. See https://usn.ubuntu.com/3785-1/
sed -i 's/rights="none" pattern="PDF"/rights="read | write" pattern="PDF"/' \
/etc/ImageMagick-6/policy.xml
sed -i 's/rights="none" pattern="@\*"/rights="read" pattern="@*"/' \
/etc/ImageMagick-6/policy.xml
# Install python3 with pip and use by default
# https://stackoverflow.com/a/61878185
apt install -y python3 python3-pip python-is-python3
pip3 install pandas nilearn
# FSL. See https://fsl.fmrib.ox.ac.uk/fsldownloads/manifest.csv
# The centos7 version suits for Ubuntu 14-20.
fslver=6.0.4
cd /usr/local
wget -nv https://fsl.fmrib.ox.ac.uk/fsldownloads/fsl-${fslver}-centos7_64.tar.gz
tar -zxf fsl-${fslver}-centos7_64.tar.gz
rm fsl-${fslver}-centos7_64.tar.gz
# FSL setup
export FSLDIR=/usr/local/fsl
. ${FSLDIR}/etc/fslconf/fsl.sh
export PATH=${FSLDIR}/bin:${PATH}
# Run the FSL python installer. A clue that we forgot this is an imglob error at runtime
${FSLDIR}/etc/fslconf/fslpython_install.sh
# Create input/output directories for binding
mkdir /INPUTS && mkdir /OUTPUTS && mkdir /wkdir
%environment
# FSL
export FSLDIR=/usr/local/fsl
# Path
export PATH=/opt/petreg/src:${PATH}
%runscript
xwrapper.sh "$@"