cat_standalone_segment_enigma_subdir_rp_MSA.m 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. % Batch file of CAT12 segmentation for SPM12 standalone installation
  2. % modified parameters for ENIGMA
  3. %
  4. %_______________________________________________________________________
  5. % $Id: cat_standalone_segment_enigma.m 1842 2021-06-01 14:41:58Z gaser $
  6. % first undefined data field, that will be dynamically replaced by cat_standalone.sh
  7. matlabbatch{1}.spm.tools.cat.estwrite.data = '<UNDEFINED>';
  8. % Entry for choosing TPM
  9. % Remove comments and edit entry if you would like to change the parameter.
  10. % Otherwise the default value from cat_defaults.m is used.
  11. % Or use 1st parameter field, that will be dynamically replaced by cat_standalone.sh
  12. %matlabbatch{1}.spm.tools.cat.estwrite.opts.tpm = '<UNDEFINED>';
  13. % Entry for choosing shooting template
  14. % Remove comments and edit entry if you would like to change the parameter.
  15. % Otherwise the default value from cat_defaults.m is used.
  16. % Or use 2nd parameter field, that will be dynamically replaced by cat_standalone.sh
  17. %matlabbatch{1}.spm.tools.cat.estwrite.extopts.registration.regmethod.shooting.shootingtpm = '<UNDEFINED>';
  18. % Strength of Shooting registration: 0 - Dartel, eps (fast), 0.5 (default) to 1 (accurate) optimized Shooting, 4 - default Shooting; default 0.5
  19. %matlabbatch{1}.spm.tools.cat.estwrite.extopts.registration.regmethod.shooting.regstr = 0.5;
  20. % voxel size for normalized data (EXPERIMENTAL: inf - use Tempate values)
  21. matlabbatch{1}.spm.tools.cat.estwrite.extopts.registration.vox = 1.5;
  22. % additional bounding box
  23. matlabbatch{1}.spm.tools.cat.estwrite.extopts.registration.bb = 12;
  24. % Affine regularisation (SPM12 default = mni) - '';'mni';'eastern';'subj';'none';'rigid'
  25. matlabbatch{1}.spm.tools.cat.estwrite.opts.affreg = 'mni';
  26. % Strength of the bias correction that controls the biasreg and biasfwhm parameter (CAT only!)
  27. % 0 - use SPM parameter; eps - ultralight, 0.25 - light, 0.5 - medium, 0.75 - strong, and 1 - heavy corrections
  28. % job.opts.biasreg = min( 10 , max( 0 , 10^-(job.opts.biasstr*2 + 2) ));
  29. % job.opts.biasfwhm = min( inf , max( 30 , 30 + 60*job.opts.biasstr ));
  30. matlabbatch{1}.spm.tools.cat.estwrite.opts.biasstr = 0.5;
  31. % Affine PreProcessing (APP) with rough bias correction and brain extraction for special anatomies (nonhuman/neonates)
  32. % 0 - none; 1070 - default; [1 - light; 2 - full; 1144 - update of 1070, 5 - animal (no affreg)]
  33. matlabbatch{1}.spm.tools.cat.estwrite.extopts.segmentation.APP = 1070;
  34. % Strength of the local adaptation: 0 to 1; default 0.5
  35. matlabbatch{1}.spm.tools.cat.estwrite.extopts.segmentation.LASstr = 0.5;
  36. % Strength of the noise correction: 0 to 1; 0 - no filter, -Inf - auto, 1 - full, 2 - ISARNLM (else SANLM), default -Inf
  37. matlabbatch{1}.spm.tools.cat.estwrite.extopts.segmentation.NCstr = -Inf;
  38. % Strength of skull-stripping: 0 - SPM approach; eps to 1 - gcut; 2 - new APRG approach; -1 - no skull-stripping (already skull-stripped); default = 2
  39. matlabbatch{1}.spm.tools.cat.estwrite.extopts.segmentation.gcutstr = 2;
  40. % Strength of the cleanup process: 0 to 1; default 0.5
  41. matlabbatch{1}.spm.tools.cat.estwrite.extopts.segmentation.cleanupstr = 0.5;
  42. % resolution handling: 'native','fixed','best', 'optimal'
  43. matlabbatch{1}.spm.tools.cat.estwrite.extopts.segmentation.restypes.optimal = [1 0.3];
  44. % use center-of-mass approach for estimating origin
  45. matlabbatch{1}.spm.tools.cat.estwrite.extopts.segmentation.setCOM = 1;
  46. % modify affine scaling
  47. matlabbatch{1}.spm.tools.cat.estwrite.extopts.segmentation.affmod = 0;
  48. % use k-means AMAP approach or SPM segmentation for initial segmentation
  49. matlabbatch{1}.spm.tools.cat.estwrite.extopts.segmentation.spm_kamap = 0;
  50. % Correction of WM hyperintensities: 0 - no correction, 1 - only for Dartel/Shooting
  51. % 2 - also correct segmentation (to WM), 3 - handle as separate class; default 1
  52. matlabbatch{1}.spm.tools.cat.estwrite.extopts.segmentation.WMHC = 2;
  53. % Stroke lesion correction (SLC): 0 - no correction, 1 - handling of manual lesion that have to be set to zero!
  54. % 2 - automatic lesion detection (in development)
  55. matlabbatch{1}.spm.tools.cat.estwrite.extopts.segmentation.SLC = 0;
  56. % surface options
  57. matlabbatch{1}.spm.tools.cat.estwrite.extopts.surface.pbtres = 0.5;
  58. matlabbatch{1}.spm.tools.cat.estwrite.extopts.surface.pbtmethod = 'pbt2x';
  59. matlabbatch{1}.spm.tools.cat.estwrite.extopts.surface.reduce_mesh = 1;
  60. matlabbatch{1}.spm.tools.cat.estwrite.extopts.surface.scale_cortex = 0.7;
  61. matlabbatch{1}.spm.tools.cat.estwrite.extopts.surface.add_parahipp = 0.1;
  62. matlabbatch{1}.spm.tools.cat.estwrite.extopts.surface.close_parahipp = 0;
  63. matlabbatch{1}.spm.tools.cat.estwrite.extopts.surface.SRP = 22;
  64. % set this to 1 for skipping preprocessing if already processed data exist
  65. matlabbatch{1}.spm.tools.cat.estwrite.extopts.admin.lazy = 0;
  66. % catch errors: 0 - stop with error (default); 1 - catch preprocessing errors (requires MATLAB 2008 or higher);
  67. matlabbatch{1}.spm.tools.cat.estwrite.extopts.admin.ignoreErrors = 1;
  68. % verbose output: 1 - default; 2 - details; 3 - write debugging files
  69. matlabbatch{1}.spm.tools.cat.estwrite.extopts.admin.verb = 2;
  70. % display and print out pdf-file of results: 0 - off, 2 - volume only, 2 - volume and surface (default)
  71. matlabbatch{1}.spm.tools.cat.estwrite.extopts.admin.print = 2;
  72. % surface and thickness creation: 0 - no (default), 1 - lh+rh, 2 - lh+rh+cerebellum,
  73. % 3 - lh, 4 - rh, 5 - lh+rh (fast, no registration, only for quick quality check and not for analysis),
  74. % 6 - lh+rh+cerebellum (fast, no registration, only for quick quality check and not for analysis)
  75. % 9 - thickness only (for ROI analysis, experimental!)
  76. % +10 to estimate WM and CSF width/depth/thickness (experimental!)
  77. matlabbatch{1}.spm.tools.cat.estwrite.output.surface = 1;
  78. % BIDS output
  79. matlabbatch{1}.spm.tools.cat.estwrite.output.BIDS.BIDSno = 1;
  80. % define here volume atlases
  81. matlabbatch{1}.spm.tools.cat.estwrite.output.ROImenu.atlases.neuromorphometrics = 1;
  82. matlabbatch{1}.spm.tools.cat.estwrite.output.ROImenu.atlases.lpba40 = 1;
  83. matlabbatch{1}.spm.tools.cat.estwrite.output.ROImenu.atlases.cobra = 1;
  84. matlabbatch{1}.spm.tools.cat.estwrite.output.ROImenu.atlases.hammers = 1;
  85. matlabbatch{1}.spm.tools.cat.estwrite.output.ROImenu.atlases.ibsr = 1;
  86. matlabbatch{1}.spm.tools.cat.estwrite.output.ROImenu.atlases.aal3 = 1;
  87. matlabbatch{1}.spm.tools.cat.estwrite.output.ROImenu.atlases.mori = 1;
  88. matlabbatch{1}.spm.tools.cat.estwrite.output.ROImenu.atlases.thalamus = 1;
  89. matlabbatch{1}.spm.tools.cat.estwrite.output.ROImenu.atlases.anatomy3 = 1;
  90. matlabbatch{1}.spm.tools.cat.estwrite.output.ROImenu.atlases.julichbrain = 1;
  91. matlabbatch{1}.spm.tools.cat.estwrite.output.ROImenu.atlases.Schaefer2018_100Parcels_17Networks_order = 1;
  92. matlabbatch{1}.spm.tools.cat.estwrite.output.ROImenu.atlases.Schaefer2018_200Parcels_17Networks_order = 1;
  93. matlabbatch{1}.spm.tools.cat.estwrite.output.ROImenu.atlases.Schaefer2018_400Parcels_17Networks_order = 1;
  94. matlabbatch{1}.spm.tools.cat.estwrite.output.ROImenu.atlases.Schaefer2018_600Parcels_17Networks_order = 1;
  95. matlabbatch{1}.spm.tools.cat.estwrite.output.ROImenu.atlases.ownatlas = {'code/Tian_Subcortex_S2_7T.nii'};
  96. % Writing options (see cat_defaults for the description of parameters)
  97. % native 0/1 (none/yes)
  98. % warped 0/1 (none/yes)
  99. % mod 0/1/2/3 (none/affine+nonlinear/nonlinear only/both)
  100. % dartel 0/1/2/3 (none/rigid/affine/both)
  101. % GM/WM/CSF/WMH
  102. matlabbatch{1}.spm.tools.cat.estwrite.output.GM.native = 1;
  103. matlabbatch{1}.spm.tools.cat.estwrite.output.GM.warped = 1;
  104. matlabbatch{1}.spm.tools.cat.estwrite.output.GM.mod = 3;
  105. matlabbatch{1}.spm.tools.cat.estwrite.output.GM.dartel = 2;
  106. matlabbatch{1}.spm.tools.cat.estwrite.output.WM.native = 1;
  107. matlabbatch{1}.spm.tools.cat.estwrite.output.WM.warped = 1;
  108. matlabbatch{1}.spm.tools.cat.estwrite.output.WM.mod = 3;
  109. matlabbatch{1}.spm.tools.cat.estwrite.output.WM.dartel = 2;
  110. matlabbatch{1}.spm.tools.cat.estwrite.output.CSF.native = 1;
  111. matlabbatch{1}.spm.tools.cat.estwrite.output.CSF.warped = 1;
  112. matlabbatch{1}.spm.tools.cat.estwrite.output.CSF.mod = 3;
  113. matlabbatch{1}.spm.tools.cat.estwrite.output.CSF.dartel = 2;
  114. matlabbatch{1}.spm.tools.cat.estwrite.output.WMH.native = 0;
  115. matlabbatch{1}.spm.tools.cat.estwrite.output.WMH.warped = 0;
  116. matlabbatch{1}.spm.tools.cat.estwrite.output.WMH.mod = 0;
  117. matlabbatch{1}.spm.tools.cat.estwrite.output.WMH.dartel = 0;
  118. % stroke lesion tissue maps (only for opt.extopts.SLC>0) - in development
  119. matlabbatch{1}.spm.tools.cat.estwrite.output.SL.native = 0;
  120. matlabbatch{1}.spm.tools.cat.estwrite.output.SL.warped = 0;
  121. matlabbatch{1}.spm.tools.cat.estwrite.output.SL.mod = 0;
  122. matlabbatch{1}.spm.tools.cat.estwrite.output.SL.dartel = 0;
  123. % Tissue classes 4-6 to create own TPMs
  124. matlabbatch{1}.spm.tools.cat.estwrite.output.TPMC.native = 0;
  125. matlabbatch{1}.spm.tools.cat.estwrite.output.TPMC.warped = 0;
  126. matlabbatch{1}.spm.tools.cat.estwrite.output.TPMC.mod = 0;
  127. matlabbatch{1}.spm.tools.cat.estwrite.output.TPMC.dartel = 0;
  128. % atlas maps (for evaluation)
  129. matlabbatch{1}.spm.tools.cat.estwrite.output.atlas.native = 1;
  130. % label
  131. % background=0, CSF=1, GM=2, WM=3, WMH=4 (if opt.extopts.WMHC==3), SL=1.5 (if opt.extopts.SLC>0)
  132. matlabbatch{1}.spm.tools.cat.estwrite.output.label.native = 1;
  133. matlabbatch{1}.spm.tools.cat.estwrite.output.label.warped = 1;
  134. matlabbatch{1}.spm.tools.cat.estwrite.output.label.dartel = 0;
  135. % bias and noise corrected, global intensity normalized
  136. matlabbatch{1}.spm.tools.cat.estwrite.output.bias.native = 1;
  137. matlabbatch{1}.spm.tools.cat.estwrite.output.bias.warped = 1;
  138. matlabbatch{1}.spm.tools.cat.estwrite.output.bias.dartel = 0;
  139. % bias and noise corrected, (locally - if LAS>0) intensity normalized
  140. matlabbatch{1}.spm.tools.cat.estwrite.output.las.native = 1;
  141. matlabbatch{1}.spm.tools.cat.estwrite.output.las.warped = 1;
  142. matlabbatch{1}.spm.tools.cat.estwrite.output.las.dartel = 0;
  143. % jacobian determinant 0/1 (none/yes)
  144. matlabbatch{1}.spm.tools.cat.estwrite.output.jacobianwarped = 1;
  145. % deformations, order is [forward inverse]
  146. matlabbatch{1}.spm.tools.cat.estwrite.output.warps = [1 1];
  147. % registration matrix
  148. matlabbatch{1}.spm.tools.cat.estwrite.output.rmat = 1;
  149. % deface native intensity normalized images in native space
  150. matlabbatch{2}.spm.util.deface.images(1) = cfg_dep('CAT12: Segmentation: Native Bias Corr. Image', substruct('.','val', '{}',{1}, '.','val', '{}',{1}, '.','val', '{}',{1}, '.','val', '{}',{1}), substruct('()',{1}, '.','biascorr', '()',{':'}));
  151. matlabbatch{2}.spm.util.deface.images(2) = cfg_dep('CAT12: Segmentation: Native LAS Bias Corr. Image', substruct('.','val', '{}',{1}, '.','val', '{}',{1}, '.','val', '{}',{1}, '.','val', '{}',{1}), substruct('()',{1}, '.','ibiascorr', '()',{':'}));
  152. % and remove images that are not defaced
  153. matlabbatch{3}.cfg_basicio.file_dir.file_ops.file_move.files(1) = cfg_dep('CAT12: Segmentation: Native Bias Corr. Image', substruct('.','val', '{}',{1}, '.','val', '{}',{1}, '.','val', '{}',{1}, '.','val', '{}',{1}), substruct('()',{1}, '.','biascorr', '()',{':'}));
  154. matlabbatch{3}.cfg_basicio.file_dir.file_ops.file_move.files(2) = cfg_dep('CAT12: Segmentation: Native LAS Bias Corr. Image', substruct('.','val', '{}',{1}, '.','val', '{}',{1}, '.','val', '{}',{1}, '.','val', '{}',{1}), substruct('()',{1}, '.','ibiascorr', '()',{':'}));
  155. matlabbatch{3}.cfg_basicio.file_dir.file_ops.file_move.action.delete = false;