Skip to content

Commit 8acb1f9

Browse files
committed
Expand installation options
1 parent 89a971f commit 8acb1f9

File tree

6 files changed

+1002
-55
lines changed

6 files changed

+1002
-55
lines changed
85 KB
Loading

docs/installation/containers.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# SPM and Containers
2+
3+
## Docker
4+
5+
Docker is a container technology, performing operating-system-level
6+
virtualisation.
7+
8+
[`https://www.docker.com/`](https://www.docker.com/)
9+
10+
## Singularity
11+
12+
Singularity is another container technology that performs
13+
operating-system-level virtualization. One of the main uses of
14+
Singularity is to bring containers and reproducibility to scientific
15+
computing and HPC.
16+
17+
[`https://sylabs.io/singularity/`](https://sylabs.io/singularity/)
18+
[`https://apptainer.org/`](https://apptainer.org/)
19+
20+
## SPM Containers
21+
22+
Official SPM12 `Dockerfile` and `singularity.def` (using the [Standalone
23+
SPM](standalone.md)):
24+
25+
[`https://github.com/spm/spm-docker`](https://github.com/spm/spm-docker)
26+
27+
[`https://github.com/spm/spm-docker/pkgs/container/spm-docker`](https://github.com/spm/spm-docker/pkgs/container/spm-docker)
28+
[`https://hub.docker.com/r/spmcentral/spm/`](https://hub.docker.com/r/spmcentral/spm/)
29+
30+
For example, to start SPM with its graphical user interface:
31+
```
32+
xhost +local:docker
33+
docker run -ti --rm -e DISPLAY=$DISPLAY -v /tmp:/tmp -v /tmp/.X11-unix:/tmp/.X11-unix spmcentral/spm fmri
34+
```
35+
36+
If the container\'s root filesystem is mounted as read only
37+
(*\--read-only* flag), you need to bind mount an extra volume:
38+
```
39+
-v /tmp/.matlab:/root/.matlab
40+
```
41+
42+
## See also
43+
44+
### Neurodesk
45+
46+
[`https://www.neurodesk.org/`](https://www.neurodesk.org/)
47+
48+
### Neurodocker
49+
50+
[`https://github.com/ReproNim/neurodocker`](https://github.com/ReproNim/neurodocker)
51+
[`https://hub.docker.com/r/kaczmarj/neurodocker/`](https://hub.docker.com/r/kaczmarj/neurodocker/)
52+
53+
### SPM BIDS-App
54+
55+
[`https://github.com/BIDS-Apps/SPM`](https://github.com/BIDS-Apps/SPM)
56+
[`https://hub.docker.com/r/bids/spm/`](https://hub.docker.com/r/bids/spm/)
57+
58+
### MATLAB Dockerfile
59+
60+
[`https://github.com/mathworks-ref-arch/matlab-dockerfile`](https://github.com/mathworks-ref-arch/matlab-dockerfile)
61+
62+
### Singularity
63+
64+
[SingularityCE User Guide](https://sylabs.io/guides/3.8/user-guide/)
65+
66+
```
67+
sudo singularity build spm12.sif spm12-octave.def
68+
singularity exec spm12.sif
69+
./spm12.sif --help
70+
```
71+
72+
([how to install singularity on
73+
Ubuntu](https://github.com/hpcng/singularity/issues/5390#issuecomment-899111181))
Lines changed: 53 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,53 @@
1-
# Installation
1+
# SPM Installation with MATLAB
22

33
!!! info "Prerequisites"
44
The SPM software is a collection of [MATLAB](https://www.mathworks.com/products/matlab.html) functions and thus requires the MATLAB software to be installed on your computer in order to run. SPM requires only core MATLAB to run (no special toolboxes are required - unless stated otherwise).
55

66
Each SPM version was written for a particular MATLAB version and will not work with earlier versions. MATLAB versions released after SPM can have some peculiarities but SPM developers try to provide compatibility fixes in the updates.
77

8-
=== "Windows"
8+
## Installation
99

10-
## Installation
10+
=== "Windows"
1111

1212
1. Download `spm12.zip` from the [SPM website](https://www.fil.ion.ucl.ac.uk/spm/software/download/).
13-
2. Unzip spm12.zip in a folder of your choice, such as `C:\Users\login\Documents\MATLAB\spm12`.
14-
3. Start MATLAB and add SPM into your path, either using:
13+
14+
2. Unzip `spm12.zip` in a folder of your choice, such as `C:\Users\login\Documents\MATLAB\spm12`.
15+
16+
3. Start MATLAB and add SPM to your path, either using:
1517

1618
`Home` :material-arrow-right-bold: `Set Path` :material-arrow-right-bold: `Add Folder...`: select the directory containing your SPM installation then click on `Save` and `Close`.
1719

1820
or type the following at the MATLAB prompt:
1921

2022
```matlab
2123
addpath('C:\Users\login\Documents\MATLAB\spm12')
24+
savepath % if you want to save the current MATLAB path
2225
```
2326

24-
!!! danger
25-
If using the graphical interface, make sure to use the `Add Folder...` button and not `Add with Subfolders...`. SPM will automatically add the appropriate subfolders to the MATLAB path.
26-
27-
You can then launch SPM by typing `spm` at the MATLAB prompt.
28-
29-
## Update
30-
31-
If you have just downloaded the `spm12.zip` archive, it already contains the latest set of updates. To update SPM when a new version is released:
27+
If you are using MATLAB without its desktop, you can open the Set Path dialog box by typing `pathtool` at the MATLAB prompt.
3228

33-
1. [Download `spm12_updates_rxxxx.zip`](https://www.fil.ion.ucl.ac.uk/spm/software/download/).
34-
2. Uncompress `spm12_updates_rxxxx.zip` on top of the folder containing your SPM installation so that newer files overwrite existing files.
35-
36-
Alternatively, you can use the `spm_update.m` function:
37-
38-
```
39-
spm_update
40-
```
41-
42-
If a new version is available, it can be applied to your local installation by typing:
43-
44-
```
45-
spm_update update
46-
```
47-
48-
=== "Mac"
49-
## Installation
29+
!!! danger
30+
If using the graphical interface, make sure to use the `Add Folder...` button and not `Add with Subfolders...`. SPM will automatically add the appropriate subfolders to the MATLAB path at runtime.
5031

51-
Mac Intel with 64bit MATLAB is a supported SPM platform. Precompiled MEX files (`*.mexmaci64`) are included in the SPM distribution.
32+
=== "macOS"
5233

53-
1. [Download `spm12.zip`](https://www.fil.ion.ucl.ac.uk/spm/software/download/) in your home directory.
34+
1. [Download `spm12.zip` from the [SPM website](https://www.fil.ion.ucl.ac.uk/spm/software/download/) in your home directory.
5435

55-
2. Uncompress the archive by typing the following in a terminal:
56-
```
57-
cd /Users/login
36+
2. Uncompress the archive by typing the following in a Terminal:
37+
```bash
38+
cd /Users/<login>
5839
unzip spm12.zip
5940
```
6041

6142
3. Start MATLAB and add SPM to your path, either using:
6243
`File` :material-arrow-right-bold: `Set Path` :material-arrow-right-bold: `Add Folder...`
6344
64-
or typing:
45+
or typing the following at the MATLAB prompt:
6546

66-
```
47+
```matlab
6748
addpath /Users/login/spm12
68-
savepath
49+
savepath % if you want to save the current MATLAB path
6950
```
70-
71-
in MATLAB's workspace.
7251

7352
??? failure "Troubleshooting"
7453
**macOS Catalina**
@@ -83,7 +62,7 @@
8362
8463
Open a terminal, `cd` to the SPM directory and type:
8564
86-
```
65+
```bash
8766
find . -name "*.mexmaci64" -exec xattr -d com.apple.quarantine {} \;
8867
```
8968
@@ -99,7 +78,7 @@
9978
10079
Open a terminal, and type the following whilst replacing `SPM_PATH` with the path of your spm installation:
10180

102-
```
81+
```bash
10382
sudo xattr -r -d com.apple.quarantine SPM_PATH
10483
sudo find SPM_PATH -name "*.mexmaci64" -exec spctl --add {} \;
10584
```
@@ -112,35 +91,33 @@
11291

11392
If you get an error message such as:
11493

115-
```
94+
```bash
11695
mex -O -c spm_vol_utils.c -DSPM_UNSIGNED_CHAR
117-
mex: unrecognized option `-O'
118-
mex: unrecognized option `-c'
96+
mex: unrecognized option '-O'
97+
mex: unrecognized option '-c'
11998
This is pdfTeX, Version 3.1415926-2.3-1.40.12 (TeX Live 2011)
12099
restricted \write18 enabled.
121100
entering extended mode
122101
(./spm_vol_utils.c
123102
This is MeX Version 1.05 18 XII 1993 (B. Jackowski & M. Ry\'cko)
124-
! You can't use `macro parameter character #' in vertical mode.
103+
! You can't use 'macro parameter character #' in vertical mode.
125104
```
126105
127106
This is due to a conflict between MATLAB mex and a LaTeX command with the same name. Edit `src/Makefile.var` and mention the full path when referring to MEXBIN.
128107
129-
```
108+
```bash
130109
MEXBIN = /Applications/MATLAB_R2012a.app/bin/mex
131110
```
132111
133112
or change PATH accordingly.
134113

135114
=== "Linux"
136115

137-
## Installation
138-
139-
1. [Download `spm12.zip`](https://www.fil.ion.ucl.ac.uk/spm/software/download/) in your home directory.
116+
1. Download `spm12.zip` from the [SPM website](https://www.fil.ion.ucl.ac.uk/spm/software/download/) in your home directory.
140117

141118
2. Uncompress the archive by typing the following in a terminal:
142119

143-
```
120+
```bash
144121
cd /home/login
145122
unzip spm12.zip
146123
```
@@ -149,10 +126,32 @@
149126

150127
`File` :material-arrow-right-bold: `Set Path` :material-arrow-right-bold: `Add Folder...`
151128
152-
or typing:
129+
or typing the following at the MATLAB prompt:
153130

154-
```
131+
```matlab
155132
addpath /home/login/spm12
133+
savepath % if you want to save the current MATLAB path
156134
```
157135

158-
in MATLAB's workspace.
136+
![](../../../assets/figures/matlab_setpath.png)
137+
138+
You can then launch SPM by typing `spm` at the MATLAB prompt.
139+
140+
## Update
141+
142+
If you have just downloaded the `spm12.zip` archive, it already contains the latest set of updates. To update SPM when a new version is released:
143+
144+
1. [Download `spm12_updates_rxxxx.zip`](https://www.fil.ion.ucl.ac.uk/spm/download/spm12_updates/).
145+
2. Uncompress `spm12_updates_rxxxx.zip` on top of the folder containing your SPM installation so that newer files overwrite existing files.
146+
147+
Alternatively, you can use the `spm_update.m` function:
148+
149+
```matlab
150+
spm_update
151+
```
152+
153+
If a new version is available, it can be applied to your local installation by typing:
154+
155+
```matlab
156+
spm_update update
157+
```

0 commit comments

Comments
 (0)