(andreaboscutti, March 2024)
- Updated versions of software: Neurodocker (latest) PALM (latests), FSL (latest), Ubuntu (20.4), Matlab Compiler Runtime (2021b - latest supported by the latest Neurodocker version)
- Added startup.sh as the entrypoint
- Removed
run "sed -i '\$d' \$ND_ENTRYPOINT" --
frombuild_docker.sh
- Note about deleting multiarch package from Dockerfile before building
- Added instruction to build a Singularity image
PALM-Docker allows the use of PALM within a container. This docker image contains PALM and it's dependencies (FSL and MATLAB). Note that PALM can be run with OCTAVE, the free alternative to MATLAB. However, the developers state that MATLAB has faster pemutations, "Octave loads faster but it's a bit slower to run. Matlab loads very slowly, but then runs faster." [1]. Official PALM documentation can be found here
The docker image uses the following software versions:
- PALM = downloaded from latest GitHub repository on 04/11/2024
- FSL = v6.0.7
- Matlab Compiler Runtime (MCR) = v2021b
- Pull docker image from container registry
docker pull andreaboscutti/palm:5.0
- Organize PALM input (images, design matrix, contrast, etc.) into one folder and note the absolute path of this folder (/abs/path/to/palm/input/folder/)
- Execute docker command with the PALM input folder mounted and desired PALM options:
docker run -v /abs/path/to/palm/input/folder/:/input -it andreaboscutti/palm:5.0 <palm options>
- PALM input folder must be mounted to /input in container
- Help on the PALM options can be found by executing the docker command without any PALM options:
docker run -it andreaboscutti/palm:5.0
- For advanced options:
docker run -it andreaboscutti/palm:5.0 -advanced
- Once PALM is finished, output can be found in the PALM input folder
- Install Singularity, follow this tutorial: https://singularity-tutorial.github.io/01-installation/. You may want to get the latest version (https://github.com/sylabs/singularity). Go is required to compile and install (https://go.dev/dl/).
- Build the image
singularity build /path/to/image/palm.simg docker://andreaboscutti/palm:5.0
- Cache can be relatively big (~25GB), so you may want to redirect where the singularity cache is stored
with
export SINGULARITY_CACHEDIR=/path/to/your/new/cachedir
- Organize PALM input (images, design matrix, contrast, etc.) into one folder and note the absolute path of this folder (/abs/path/to/palm/input/folder/)
- Execute singularity command with the PALM input folder mounted and desired PALM options:
singularity run --bind /abs/path/to/palm/input/folder/:/input /path/to/image/palm.simg <palm options>
- PALM input folder must be mounted to /input in container
- Once PALM is finished, output can be found in the PALM input folder
IMPORTANT: Users building this docker image from scratch need MATLAB Compiler Toolbox.
There are two steps in building the docker image from scratch:
- Create MATLAB application of PALM
- Package the MATLAB application of PALM and it's dependencies into a docker image
To build the docker image, the user must first create a MATLAB compiled application of PALM. This requires the MATLAB Compiler Toolbox. The version of MCR inside the docker image must match the user's MATLAB version.
- Download latest version of PALM code from GitHub repository
- Open MATLAB
- Modify your startup.m file to exclude addpath during application deployment:
- Open your startup.m file (locate with the cmd: "which startup")
- Add the following if statement to the startup file:
if ~isdeployed ... <Existing code> ... end
- Within the PALM code, comment out instances of the addpath command:
- palm_checkprogs.m:
addpath(fullfile(fsldir,'etc','matlab'));
andaddpath(fullfile(fshome,'matlab'));
- palm.m:
addpath(fileparts(mfilename('fullpath')));
- palm_checkprogs.m:
- Run the Application Compiler under APPS
- Select palm.m as the main file
- Under the section "Files required for your application to run", add the palm_version.txt file and fileio folder
(located in the downloaded PALM folder), and all of the .m files inside the repository folder 'for_build/mcr/matlab'
- The for_build/mcr/matlab .m files were copied from fsl-6.0.3/etc/matlab
- The .m files may need to be updated as newer versions of FSL are released.
- Ensure that "Runtime downloaded from web" is selected
- Click Package button
- The compiler will return a warning about possibly missing packaged files. This warning can be safely ignored.
- Delete the for_testing and for_redistribution folders to save space
The following steps describe the procedure in constructing the commands within build script, for_build/build_docker.sh:
- Identify the latest version of neurodocker (at the time (ATT): 0.9.5)
- Setup the neurodocker build string:
- Choose a base OS compatible with FSL (chose ubuntu:20.04)
-b ubuntu:20.04 -p apt
- Choose a version of FSL (latest ATT: 6.0.7) (---yes accepts the warning regarding the FSL license without
the need of running the container interactively)
--yes
--fsl version=6.0.7
- Choose the version of Matlab Compiler Runtime that matches the MATLAB version that compiled PALM (v2021b)
--matlabmcr version=2021b
- Modify entrypoint file for easier use of PALM:
- --copy ./startup.sh /opt/startup.sh
- --entrypoint /opt/startup.sh Inside startup.sh:
"[ -d /input ] && cd /input"
- This code forces the container to change the current directory to /input, which will make it easier to write the PALM commands. Without this, PALM options that refer to a file will need to be prepended with /input.
/opt/palm-mcr/palm/for_redistribution_files_only/run_palm.sh /opt/MCR-2021b/v911 $@
- This code sets up the PALM MCR command. The user will no longer need to include the path to the MCR folder inside the container.
- Copy the MATLAB compiled PALM folder into the image
--copy mcr /opt/palm-mcr
- Choose a base OS compatible with FSL (chose ubuntu:20.04)
- Run the neurodocker build command and output to Dockerfile
docker run repronim/neurodocker:0.9.5 generate docker [build string] > Dockerfile
- Remove "multiarch-support" from the packages included in the Dockerfile:
sed -i '/multiarch-support/d' Dockerfile
- Build Docker image from resulting Dockerfile
docker build -t [image_tag] .
- Push Docker image to Dockerhub
docker push [image_tag]
- PALM with MCR has not been thoroughly tested by the FSL community [2]. It is possible that there may be unexpected issues. This docker image needs to be tested with other types of data, such as csv and surface data.