Singularity 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. Bootstrap: docker
  2. From: debian:bookworm-slim
  3. %setup
  4. mkdir -p ${SINGULARITY_ROOTFS}/batch
  5. mkdir -p ${SINGULARITY_ROOTFS}/code
  6. mkdir -p ${SINGULARITY_ROOTFS}/downloads
  7. install -m 755 ./code/* ${SINGULARITY_ROOTFS}/code
  8. %post
  9. apt-get -qq update
  10. apt-get --yes --quiet --no-install-recommends install \
  11. wget \
  12. unzip \
  13. libxext6 \
  14. libxt6 \
  15. moreutils \
  16. build-essential \
  17. curl \
  18. ca-certificates
  19. DEBIAN_FRONTEND=noninteractive apt-get --yes --quiet install \
  20. octave \
  21. liboctave-dev
  22. mkdir /opt/spm12
  23. curl -fsSL --retry 5 https://github.com/spm/spm12/archive/r7771.tar.gz | tar -xzC /opt/spm12 --strip-components 1
  24. curl -fsSL --retry 5 https://raw.githubusercontent.com/spm/spm-octave/main/spm12_r7771.patch | patch -p0
  25. make -C /opt/spm12/src PLATFORM=octave distclean
  26. make -C /opt/spm12/src PLATFORM=octave
  27. make -C /opt/spm12/src PLATFORM=octave install
  28. ln -s /opt/spm12/bin/spm12-octave /usr/local/bin/spm12
  29. CATversion="r2560"
  30. cd /downloads
  31. wget http://www.neuro.uni-jena.de/cat12/cat12_${CATversion}.zip && unzip -d /opt/spm12/toolbox/ cat12_${CATversion}.zip
  32. rm -fr /downloads
  33. # install CAT standalone interface
  34. STANDALONE="/opt/spm12/toolbox/cat12/standalone"
  35. cd ${STANDALONE} && chmod +rx *.sh
  36. cd /code && ln -s ${STANDALONE}/*.sh .
  37. cd /batch && ln -s ${STANDALONE}/*.m .
  38. # set permissions
  39. find /code -type f -print0 | xargs -0 chmod +r
  40. rm -f /opt/spm12/src/*.{mex,o,a}
  41. apt-get --yes remove build-essential curl liboctave-dev
  42. apt-get --yes autoremove
  43. apt-get --yes clean
  44. %environment
  45. export SPM_HOME=/opt/spm12
  46. %runscript
  47. exec /code/main "$@"
  48. %labels
  49. Author fil.spm@ucl.ac.uk
  50. Malgorzata Wierzba (m.wierzba@fz-juelich.de)
  51. Felix Hoffstaedter (f.hoffstaedter@fz-juelich.de)
  52. Version v1.1
  53. %help
  54. This is a container with SPM12, CAT12 and GNU Octave.
  55. This container allows to run the standalone version of the
  56. Computational Anatomy Toolbox (CAT), which is an extension to SPM
  57. software using Octave 7.3.0
  58. The container runs Debian bookworm-slim and includes:
  59. - Octave (7.3.0)
  60. - Standalone version of SPM software (SPM12, r7771)
  61. - Computational Anatomy Toolbox (CAT12.9 ${CATversion})
  62. - CAT interface scripts (cat_standalone.sh, cat_parallelize.sh).
  63. For more details on the exact version of the software used in this
  64. container, please refer to the README file.
  65. HOW TO USE:
  66. In principle this container allows you to perform the very same types
  67. of analysis that are possible with the standalone version of CAT. It
  68. is assumed that the user is familiar with the content of the batch
  69. files dedicated for the use with the standalone version of CAT
  70. (cat_standalone_segment.m, cat_standalone_simple.m,
  71. cat_standalone_resample.m, cat_standalone_smooth.m) and can modify
  72. their content according to his/her needs. For more details, please
  73. refer to the CAT12 documentation and manual.
  74. -- Available batch files --
  75. The content of the batch files can be explored by using the 'view' and
  76. 'copy' subcommands:
  77. singularity run <container> <subcommand> <batch file> <arguments>
  78. To view a batch file, use the 'view' subcommand:
  79. singularity run container.simg view cat_standalone_smooth.m
  80. To copy a batch file to your computer, use the 'copy' subcommand and
  81. specify destination path as an additional argument:
  82. singularity run container.simg copy cat_standalone_smooth.m $HOME
  83. Make sure that the specified path is mounted to the container (more
  84. information on this can be found below) and that you have write access
  85. to this path!
  86. To copy all available batch files, use the 'all' argument:
  87. singularity run container.simg copy all $HOME
  88. -- Running CAT --
  89. Run the CAT analysis with the following command:
  90. singularity run --cleanenv <container> <batch file> <arguments>
  91. To use a default batch file, use one of the files included in the
  92. container ('/batch'):
  93. singularity run --cleanenv container.simg \
  94. -b /batch/cat_standalone_segment.m \
  95. T1.nii
  96. To use your own, customised batch file, simply specify its path:
  97. singularity run --cleanenv container.simg \
  98. -b $HOME/cat_standalone_segment.m \
  99. T1.nii
  100. -- Bind paths --
  101. Please note that most of the host files remain inaccessible from within
  102. the container. By default the following directories are mounted within
  103. the container: '$HOME', '/tmp', '/proc', '/sys', '/dev', and '$PWD'
  104. (see the Singularity documentation for more details).
  105. If you want the container to be able to access other locations,
  106. specify a bind path of your choice. For instance, to make the contents
  107. of the '/data' folder on your computer available in the '/mnt' folder
  108. inside the container, specify the mount point in the following way:
  109. singularity run --cleanenv --bind /data:/mnt container.simg \
  110. -b /batch/cat_standalone_segment.m \
  111. /mnt/T1.nii
  112. EXAMPLES:
  113. CAT12 segmentation batch:
  114. singularity run --cleanenv container.simg \
  115. -b cat_standalone_segment.m \
  116. T1.nii
  117. CAT12 simple processing batch:
  118. singularity run --cleanenv container.simg \
  119. -b cat_standalone_simple.m \
  120. T1.nii
  121. CAT12 resample & smooth batch:
  122. singularity run --cleanenv container.simg \
  123. -b cat_standalone_resample.m \
  124. -a1 "12" -a2 "1" \
  125. lh.thickness.T1
  126. CAT12 volume smoothing batch:
  127. singularity run --cleanenv container.simg \
  128. -b cat_standalone_smooth.m \
  129. -a1 "[6 6 6]" -a2 "'s6'" \
  130. T1.nii
  131. Contact information:
  132. Any problems or concerns regarding this container should be reported
  133. to Felix Hoffstaedter (f.hoffstaedter@fz-juelich.de) and regarding
  134. CAT12 to Christian Gaser (christian.gaser@uni-jena.de)
  135. Acknowledgements:
  136. The CAT toolbox (http://www.neuro.uni-jena.de/cat) is developed by
  137. Christian Gaser and Robert Dahnke (Jena University Hospital,
  138. Departments of Psychiatry and Neurology) and is free but copyright
  139. software, distributed under the terms of the GNU General Public
  140. Licence.
  141. The SPM software (https://www.fil.ion.ucl.ac.uk/spm/) is developed by
  142. the Wellcome Trust Centre for Neuroimaging and is free but copyright
  143. software, distributed under the terms of the GNU General Public
  144. Licence (GPL).
  145. GNU Octave is a freely redistributable software under the terms of
  146. the GPL as published by the Free Software Foundation.