Singularity 6.2 KB

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