1
0

Singularity 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. Bootstrap: docker
  2. From: debian:buster-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 update
  10. apt-get -y install wget unzip libxext6 libxt6 moreutils
  11. # download software
  12. MCRURL="https://ssd.mathworks.com/supportfiles/downloads/R2017b/deployment_files/R2017b/installers/glnxa64/MCR_R2017b_glnxa64_installer.zip"
  13. SPMURL="http://www.neuro.uni-jena.de/cat12/CAT12.7_r1743_R2017b_MCR_Linux.zip"
  14. cd /downloads
  15. wget "${MCRURL}" && unzip -d /downloads/MCR MCR_R2017b_glnxa64_installer.zip
  16. wget "${SPMURL}" && unzip -d /code/SPM CAT12.7_r1743_R2017b_MCR_Linux.zip
  17. mv /code/SPM/CAT12.7_r1743_R2017b_MCR_Linux /code/SPM/MCR_Linux/
  18. # install MCR
  19. /downloads/MCR/install -mode silent -agreeToLicense yes
  20. # install SPM
  21. /code/SPM/MCR_Linux/run_spm12.sh /usr/local/MATLAB/MATLAB_Runtime/v93 quit
  22. cd /code/SPM/MCR_Linux && chmod +rx run_spm12.sh spm12.sh spm12
  23. # install CAT standalone interface
  24. STANDALONE="/code/SPM/MCR_Linux/spm12_mcr/home/gaser/gaser/spm/spm12/toolbox/cat12/standalone"
  25. cd ${STANDALONE} && chmod +rx *.sh
  26. cd /code && ln -s ${STANDALONE}/*.sh .
  27. cd /batch && ln -s ${STANDALONE}/*.txt .
  28. # set permissions
  29. find /code -type f -print0 | xargs -0 chmod +r
  30. find /code/SPM/MCR_Linux/spm12_mcr/home/gaser/gaser/spm/spm12/toolbox/cat12/CAT.glnx86 -type f -print0 | xargs -0 chmod +rx
  31. rm -fr /downloads
  32. apt-get clean
  33. apt-get autoremove
  34. %environment
  35. export SPMROOT=/code/SPM/MCR_Linux
  36. export MCRROOT=/usr/local/MATLAB/MATLAB_Runtime/v93
  37. export MCR_INHIBIT_CTF_LOCK=1
  38. %runscript
  39. exec /code/main "$@"
  40. %labels
  41. Author Malgorzata Wierzba (m.wierzba@fz-juelich.de)
  42. Version 1.0.1
  43. %help
  44. This container allows to run the standalone, compiled version of the
  45. Computational Anatomy Toolbox (CAT), which is an extension to SPM
  46. software. Using the container does not require the availability of a
  47. MATLAB licence.
  48. The container includes:
  49. - MATLAB Compiler Runtime (R2017b, 9.3)
  50. - Standalone version of SPM software (SPM12, r7771)
  51. - Computational Anatomy Toolbox (CAT12.7 r1743)
  52. - CAT interface scripts (cat_standalone.sh, cat_parallelize.sh).
  53. For more details on the exact version of the software used in this
  54. container, please refer to the README file.
  55. HOW TO USE:
  56. In principle this container allows you to perform the very same types
  57. of analysis that are possible with the standalone version of CAT. It
  58. is assumed that the user is familiar with the content of the batch
  59. files dedicated for the use with the standalone version of CAT
  60. (cat_standalone_segment.txt, cat_standalone_simple.txt,
  61. cat_standalone_resample.txt, cat_standalone_smooth.txt) and can modify
  62. their content according to his/her needs. For more details, please
  63. refer to the CAT12 documentation and manual.
  64. -- Available batch files --
  65. The content of the batch files can be explored by using the 'view' and
  66. 'copy' subcommands:
  67. singularity run <container> <subcommand> <batch file> <arguments>
  68. To view a batch file, use the 'view' subcommand:
  69. singularity run container.simg view cat_standalone_smooth.txt
  70. To copy a batch file to your computer, use the 'copy' subcommand and
  71. specify destination path as an additional argument:
  72. singularity run container.simg copy cat_standalone_smooth.txt $HOME
  73. Make sure that the specified path is mounted to the container (more
  74. information on this can be found below) and that you have write access
  75. to this path!
  76. To copy all available batch files, use the 'all' argument:
  77. singularity run container.simg copy all $HOME
  78. -- Running CAT --
  79. Run the CAT analysis with the following command:
  80. singularity run --cleanenv <container> <batch file> <arguments>
  81. To use a default batch file, use one of the files included in the
  82. container ('/batch'):
  83. singularity run --cleanenv container.simg \
  84. -b /batch/cat_standalone_segment.txt \
  85. T1.nii
  86. To use your own, customised batch file, simply specify its path:
  87. singularity run --cleanenv container.simg \
  88. -b $HOME/cat_standalone_segment.txt \
  89. T1.nii
  90. -- Bind paths --
  91. Please note that most of the host files remain inaccessible from within
  92. the container. By default the following directories are mounted within
  93. the container: '$HOME', '/tmp', '/proc', '/sys', '/dev', and '$PWD'
  94. (see the Singularity documentation for more details).
  95. If you want the container to be able to access other locations,
  96. specify a bind path of your choice. For instance, to make the contents
  97. of the '/data' folder on your computer available in the '/mnt' folder
  98. inside the container, specify the mount point in the following way:
  99. singularity run --cleanenv --bind /data:/mnt container.simg \
  100. -b /batch/cat_standalone_segment.txt \
  101. /mnt/T1.nii
  102. EXAMPLES:
  103. CAT12 segmentation batch:
  104. singularity run --cleanenv container.simg \
  105. -b cat_standalone_segment.txt \
  106. T1.nii
  107. CAT12 simple processing batch:
  108. singularity run --cleanenv container.simg \
  109. -b cat_standalone_simple.txt \
  110. T1.nii
  111. CAT12 resample & smooth batch:
  112. singularity run --cleanenv container.simg \
  113. -b cat_standalone_resample.txt \
  114. -a1 "12" -a2 "1" \
  115. lh.thickness.T1
  116. CAT12 volume smoothing batch:
  117. singularity run --cleanenv container.simg \
  118. -b cat_standalone_smooth.txt \
  119. -a1 "[6 6 6]" -a2 "'s6'" \
  120. T1.nii
  121. Known issues:
  122. - Parallelization with cat_parallelize.sh is not implemented yet.
  123. - Longitudinal segmentation with cat_standalone_segment_long.txt
  124. is not tested yet.
  125. Contact information:
  126. Any problems or concerns regarding this container should be reported
  127. to Malgorzata Wierzba (m.wierzba@fz-juelich.de) or Michael Hanke
  128. (m.hanke@fz-juelich.de).
  129. Acknowledgements:
  130. The CAT toolbox (http://www.neuro.uni-jena.de/cat) is developed by
  131. Christian Gaser and Robert Dahnke (Jena University Hospital,
  132. Departments of Psychiatry and Neurology) and is free but copyright
  133. software, distributed under the terms of the GNU General Public
  134. Licence.
  135. The SPM software (https://www.fil.ion.ucl.ac.uk/spm/) is developed by
  136. the Wellcome Trust Centre for Neuroimaging and is free but copyright
  137. software, distributed under the terms of the GNU General Public
  138. Licence.
  139. MATLAB Compiler Runtime
  140. (https://uk.mathworks.com/products/compiler/matlab-runtime.html) is
  141. developed by the The MathWorks, Inc. and is subject to the MATLAB
  142. Runtime licence.