Explorar el Código

add recipe for cat12.9 with octave7.3.0

Felix Hoffstaedter hace 1 mes
padre
commit
f60f0ccabe
Se han modificado 2 ficheros con 64 adiciones y 64 borrados
  1. 60 60
      Singularity
  2. 4 4
      code/main

+ 60 - 60
Singularity

@@ -1,5 +1,5 @@
 Bootstrap: docker
-From: debian:buster-slim
+From: debian:bookworm-slim
 
 %setup
     mkdir -p ${SINGULARITY_ROOTFS}/batch
@@ -9,64 +9,72 @@ From: debian:buster-slim
     install -m 755 ./code/* ${SINGULARITY_ROOTFS}/code
 
 %post
-    apt-get update
-    apt-get -y install wget unzip libxext6 libxt6 moreutils
-
-    # download software
-    MCRURL="https://ssd.mathworks.com/supportfiles/downloads/R2017b/deployment_files/R2017b/installers/glnxa64/MCR_R2017b_glnxa64_installer.zip"
-    SPMURL="http://www.neuro.uni-jena.de/cat12/CAT12.7_r1743_R2017b_MCR_Linux.zip"
+    apt-get -qq update
+    apt-get --yes --quiet --no-install-recommends install \
+      wget \
+      unzip \
+      libxext6 \
+      libxt6 \
+      moreutils \
+      build-essential \
+      curl \
+      ca-certificates
+    DEBIAN_FRONTEND=noninteractive apt-get --yes --quiet install \
+      octave \
+      liboctave-dev
+    
+    mkdir /opt/spm12
+    curl -fsSL --retry 5 https://github.com/spm/spm12/archive/r7771.tar.gz | tar -xzC /opt/spm12 --strip-components 1 
+    curl -fsSL --retry 5 https://raw.githubusercontent.com/spm/spm-octave/main/spm12_r7771.patch | patch -p0
+    make -C /opt/spm12/src PLATFORM=octave distclean
+    make -C /opt/spm12/src PLATFORM=octave
+    make -C /opt/spm12/src PLATFORM=octave install
+    ln -s /opt/spm12/bin/spm12-octave /usr/local/bin/spm12
+    
+    CATversion="r2560"
 
     cd /downloads
-    wget "${MCRURL}" && unzip -d /downloads/MCR MCR_R2017b_glnxa64_installer.zip
-    wget "${SPMURL}" && unzip -d /code/SPM CAT12.7_r1743_R2017b_MCR_Linux.zip
-    mv /code/SPM/CAT12.7_r1743_R2017b_MCR_Linux /code/SPM/MCR_Linux/
-
-    # install MCR
-    /downloads/MCR/install -mode silent -agreeToLicense yes
-
-    # install SPM
-    /code/SPM/MCR_Linux/run_spm12.sh /usr/local/MATLAB/MATLAB_Runtime/v93 quit
-    cd /code/SPM/MCR_Linux && chmod +rx run_spm12.sh spm12.sh spm12
+    wget http://www.neuro.uni-jena.de/cat12/cat12_${CATversion}.zip && unzip -d /opt/spm12/toolbox/ cat12_${CATversion}.zip
+    rm -fr /downloads
 
     # install CAT standalone interface
-    STANDALONE="/code/SPM/MCR_Linux/spm12_mcr/home/gaser/gaser/spm/spm12/toolbox/cat12/standalone"
+    STANDALONE="/opt/spm12/toolbox/cat12/standalone"
     cd ${STANDALONE} && chmod +rx *.sh
     cd /code && ln -s ${STANDALONE}/*.sh .
-    cd /batch && ln -s ${STANDALONE}/*.txt .
+    cd /batch && ln -s ${STANDALONE}/*.m .
 
     # set permissions
     find /code -type f -print0 | xargs -0 chmod +r
-    find /code/SPM/MCR_Linux/spm12_mcr/home/gaser/gaser/spm/spm12/toolbox/cat12/CAT.glnx86 -type f -print0 | xargs -0 chmod +rx
 
-    rm -fr /downloads
-
-    apt-get clean
-    apt-get autoremove
+    rm -f /opt/spm12/src/*.{mex,o,a}
+    apt-get --yes remove build-essential curl liboctave-dev
+    apt-get --yes autoremove
+    apt-get --yes clean
 
 %environment
-    export SPMROOT=/code/SPM/MCR_Linux
-    export MCRROOT=/usr/local/MATLAB/MATLAB_Runtime/v93
-    export MCR_INHIBIT_CTF_LOCK=1
+    export SPM_HOME=/opt/spm12
 
 %runscript
-    exec /code/main "$@"
+  exec /code/main "$@"
 
 %labels
-    Author Malgorzata Wierzba (m.wierzba@fz-juelich.de)
-    Version 1.0.1
+    Author fil.spm@ucl.ac.uk
+            Malgorzata Wierzba (m.wierzba@fz-juelich.de)
+            Felix Hoffstaedter (f.hoffstaedter@fz-juelich.de)
+    Version v1.1
 
 %help
+    This is a container with SPM12, CAT12 and GNU Octave.
 
-This container allows to run the standalone, compiled version of the
+This container allows to run the standalone version of the
 Computational Anatomy Toolbox (CAT), which is an extension to SPM
-software. Using the container does not require the availability of a
-MATLAB licence.
+software using Octave 7.3.0
 
-The container includes:
+The container runs Debian bookworm-slim and includes:
 
-- MATLAB Compiler Runtime (R2017b, 9.3)
+- Octave (7.3.0)
 - Standalone version of SPM software (SPM12, r7771)
-- Computational Anatomy Toolbox (CAT12.7 r1743)
+- Computational Anatomy Toolbox (CAT12.9 ${CATversion})
 - CAT interface scripts (cat_standalone.sh, cat_parallelize.sh).
 
 For more details on the exact version of the software used in this
@@ -79,8 +87,8 @@ In principle this container allows you to perform the very same types
 of analysis that are possible with the standalone version of CAT. It
 is assumed that the user is familiar with the content of the batch
 files dedicated for the use with the standalone version of CAT
-(cat_standalone_segment.txt, cat_standalone_simple.txt,
-cat_standalone_resample.txt, cat_standalone_smooth.txt) and can modify
+(cat_standalone_segment.m, cat_standalone_simple.m,
+cat_standalone_resample.m, cat_standalone_smooth.m) and can modify
 their content according to his/her needs. For more details, please
 refer to the CAT12 documentation and manual.
 
@@ -94,12 +102,12 @@ singularity run <container> <subcommand> <batch file> <arguments>
 
 To view a batch file, use the 'view' subcommand:
 
-singularity run container.simg view cat_standalone_smooth.txt
+singularity run container.simg view cat_standalone_smooth.m
 
 To copy a batch file to your computer, use the 'copy' subcommand and
 specify destination path as an additional argument:
 
-singularity run container.simg copy cat_standalone_smooth.txt $HOME
+singularity run container.simg copy cat_standalone_smooth.m $HOME
 
 Make sure that the specified path is mounted to the container (more
 information on this can be found below) and that you have write access
@@ -118,12 +126,12 @@ singularity run --cleanenv <container> <batch file> <arguments>
 To use a default batch file, use one of the files included in the
 container ('/batch'):
 singularity run --cleanenv container.simg \
-	-b /batch/cat_standalone_segment.txt \
+	-b /batch/cat_standalone_segment.m \
 	T1.nii
 
 To use your own, customised batch file, simply specify its path:
 singularity run --cleanenv container.simg \
-	-b $HOME/cat_standalone_segment.txt \
+	-b $HOME/cat_standalone_segment.m \
 	T1.nii
 
 
@@ -140,7 +148,7 @@ of the '/data' folder on your computer available in the '/mnt' folder
 inside the container, specify the mount point in the following way:
 
 singularity run --cleanenv --bind /data:/mnt container.simg \
-	-b /batch/cat_standalone_segment.txt \
+	-b /batch/cat_standalone_segment.m \
 	/mnt/T1.nii
 
 
@@ -148,39 +156,33 @@ EXAMPLES:
 
 CAT12 segmentation batch:
 singularity run --cleanenv container.simg \
-	-b cat_standalone_segment.txt \
+	-b cat_standalone_segment.m \
 	T1.nii
 
 CAT12 simple processing batch:
 singularity run --cleanenv container.simg \
-	-b cat_standalone_simple.txt \
+	-b cat_standalone_simple.m \
 	T1.nii
 
 CAT12 resample & smooth batch:
 singularity run --cleanenv container.simg \
-	-b cat_standalone_resample.txt \
+	-b cat_standalone_resample.m \
 	-a1 "12" -a2 "1" \
 	lh.thickness.T1
 
 CAT12 volume smoothing batch:
 singularity run --cleanenv container.simg \
-	-b cat_standalone_smooth.txt \
+	-b cat_standalone_smooth.m \
 	-a1 "[6 6 6]" -a2 "'s6'" \
 	T1.nii
 
 
-Known issues:
-
-- Parallelization with cat_parallelize.sh is not implemented yet.
-- Longitudinal segmentation with cat_standalone_segment_long.txt
-  is not tested yet.
-
 
 Contact information:
 
 Any problems or concerns regarding this container should be reported
-to Malgorzata Wierzba (m.wierzba@fz-juelich.de) or Michael Hanke
-(m.hanke@fz-juelich.de).
+to Felix Hoffstaedter (f.hoffstaedter@fz-juelich.de) and regarding
+CAT12 to Christian Gaser (christian.gaser@uni-jena.de)
 
 
 Acknowledgements:
@@ -194,9 +196,7 @@ Licence.
 The SPM software (https://www.fil.ion.ucl.ac.uk/spm/) is developed by
 the Wellcome Trust Centre for Neuroimaging and is free but copyright
 software, distributed under the terms of the GNU General Public
-Licence.
+Licence (GPL).
 
-MATLAB Compiler Runtime
-(https://uk.mathworks.com/products/compiler/matlab-runtime.html) is
-developed by the The MathWorks, Inc. and is subject to the MATLAB
-Runtime licence.
+GNU Octave is a freely redistributable software under the terms of
+the GPL as published by the Free Software Foundation.

+ 4 - 4
code/main

@@ -11,14 +11,14 @@ fi
 
 # Copy or view batch files
 
-STANDALONE="/code/SPM/MCR_Linux/spm12_mcr/home/gaser/gaser/spm/spm12/toolbox/cat12/standalone"
+STANDALONE="/opt/spm12/toolbox/cat12/standalone"
 
 if [ "$1" = "copy" ]
 then
     if [ "$2" = "all" ]
     then
 	echo "Copying batch files to:"
-	cp -vi ${STANDALONE}/*.txt "$3"
+	cp -vi ${STANDALONE}/*.m "$3"
 	exit 0
     elif [ -f ${STANDALONE}/"$2" ]
     then
@@ -27,7 +27,7 @@ then
 	exit 0
     else
 	echo "ERROR: batch file $2 not found. Available batch files are:"
-	find ${STANDALONE} -name "*.txt" -printf "%f\n"
+	find ${STANDALONE} -name "*.m" -printf "%f\n"
 	exit 1
     fi
 elif [ "$1" = "view" ]
@@ -38,7 +38,7 @@ then
 	exit 0
     else
         echo "ERROR: batch file $2 not found. Available batch files are:"
-        find ${STANDALONE} -name "*.txt" -printf "%f\n"
+        find ${STANDALONE} -name "*.m" -printf "%f\n"
         exit 1
     fi
 fi