spm_defaults.m 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. function spm_defaults
  2. % Set the defaults which are used by SPM
  3. %__________________________________________________________________________
  4. %
  5. % If you want to customise some defaults for your installation, do not
  6. % modify this file directly, but create a file named spm_my_defaults.m
  7. % instead, accessible from MATLAB search path; e.g., it can be saved in
  8. % MATLAB Startup Folder: userhome/Documents/MATLAB.
  9. %
  10. % Example: create the following file to change the image file extension:
  11. % ----------- file /home/karl/Documents/MATLAB/spm_my_defaults.m -----------
  12. % global defaults
  13. % defaults.images.format = 'img';
  14. %--------------------------------------------------------------------------
  15. %
  16. % spm_defaults should not be called directly in any script or function
  17. % (apart from SPM internals).
  18. % To load the defaults, use spm('Defaults',modality).
  19. % To get/set the defaults, use spm_get_defaults.
  20. %
  21. % ** This file should not be edited **
  22. %__________________________________________________________________________
  23. % Copyright (C) 1994-2018 Wellcome Trust Centre for Neuroimaging
  24. % SPM
  25. % $Id: spm_defaults.m 7296 2018-04-18 10:36:49Z guillaume $
  26. global defaults
  27. % Command Line Usage default
  28. %==========================================================================
  29. defaults.cmdline = 0;
  30. % User Interface defaults
  31. %==========================================================================
  32. defaults.ui.monitor = NaN;
  33. defaults.ui.colour = [0.58 0.77 0.57];
  34. defaults.ui.fs = 14; % unused
  35. defaults.ui.print = 'ps';
  36. defaults.renderer = 'opengl';
  37. % File format specific
  38. %==========================================================================
  39. % Note that defaults.analyze.flip is no longer used. Specifying the
  40. % left/right handedness of the voxel indices is now done entirely by
  41. % spm_flip_analyze_images.m
  42. defaults.images.format = 'nii'; % options: 'img', 'nii'
  43. defaults.mat.format = '-v6'; % options: '-mat', '-v6', '-v7.0', '-v7.3'
  44. % Toolboxes defaults
  45. %==========================================================================
  46. defaults.tbx.dir = { fullfile(spm('Dir'),'toolbox') };
  47. % DICOM Import defaults
  48. %==========================================================================
  49. defaults.dicom.root = 'flat'; % Folder hierarchy
  50. % fMRI design defaults
  51. %==========================================================================
  52. defaults.stats.fmri.t = 16;
  53. defaults.stats.fmri.t0 = 8;
  54. defaults.stats.fmri.hpf = 128;
  55. defaults.stats.fmri.cvi = 'AR(1)';
  56. defaults.stats.fmri.hrf = [6 16 1 1 6 0 32];
  57. % Mask defaults
  58. %==========================================================================
  59. defaults.mask.thresh = 0.8;
  60. % Stats defaults
  61. %==========================================================================
  62. defaults.stats.maxmem = 2^29;
  63. defaults.stats.maxres = 64;
  64. defaults.stats.resmem = false;
  65. defaults.stats.fmri.ufp = 0.001; % Upper tail F-probability
  66. defaults.stats.pet.ufp = 0.05;
  67. defaults.stats.eeg.ufp = 0.05;
  68. defaults.stats.topoFDR = 1;
  69. defaults.stats.rft.nonstat = 0;
  70. defaults.stats.results.volume.distmin = 8;
  71. defaults.stats.results.volume.nbmax = 3;
  72. defaults.stats.results.svc.distmin = 4;
  73. defaults.stats.results.svc.nbmax = 16;
  74. defaults.stats.results.mipmat = {fullfile(spm('dir'),'MIP.mat')};
  75. % Filename prefix defaults
  76. %==========================================================================
  77. defaults.slicetiming.prefix = 'a';
  78. defaults.realign.write.prefix = 'r';
  79. defaults.coreg.write.prefix = 'r';
  80. defaults.unwarp.write.prefix = 'u';
  81. defaults.normalise.write.prefix = 'w';
  82. defaults.deformations.modulate.prefix = 'm';
  83. defaults.smooth.prefix = 's';
  84. defaults.imcalc.prefix = 'i';
  85. % Realignment defaults
  86. %==========================================================================
  87. defaults.realign.estimate.quality = 0.9;
  88. defaults.realign.estimate.interp = 2;
  89. defaults.realign.estimate.wrap = [0 0 0];
  90. defaults.realign.estimate.sep = 4;
  91. defaults.realign.estimate.fwhm = 5;
  92. defaults.realign.estimate.rtm = 1;
  93. defaults.realign.write.mask = 1;
  94. defaults.realign.write.interp = 4;
  95. defaults.realign.write.wrap = [0 0 0];
  96. defaults.realign.write.which = [2 1];
  97. % Unwarp defaults
  98. %==========================================================================
  99. defaults.unwarp.estimate.rtm = 0;
  100. defaults.unwarp.estimate.fwhm = 4;
  101. defaults.unwarp.estimate.basfcn = [12 12];
  102. defaults.unwarp.estimate.regorder = 1;
  103. defaults.unwarp.estimate.regwgt = 1e5;
  104. defaults.unwarp.estimate.foe = [4 5];
  105. defaults.unwarp.estimate.soe = [];
  106. defaults.unwarp.estimate.rem = 1;
  107. defaults.unwarp.estimate.jm = 0;
  108. defaults.unwarp.estimate.noi = 5;
  109. defaults.unwarp.estimate.expround = 'Average';
  110. %
  111. % Unwarp uses defaults.realign.write defaults for writing.
  112. %
  113. % Coregistration defaults
  114. %==========================================================================
  115. defaults.coreg.estimate.cost_fun = 'nmi';
  116. defaults.coreg.estimate.sep = [4 2];
  117. defaults.coreg.estimate.tol = [0.02 0.02 0.02 0.001 0.001 0.001 0.01 0.01 0.01 0.001 0.001 0.001];
  118. defaults.coreg.estimate.fwhm = [7 7];
  119. defaults.coreg.write.interp = 4;
  120. defaults.coreg.write.wrap = [0 0 0];
  121. defaults.coreg.write.mask = 0;
  122. % Spatial Normalisation defaults
  123. %==========================================================================
  124. defaults.normalise.write.preserve = 0;
  125. defaults.normalise.write.bb = [[-78 -112 -70];[78 76 85]];
  126. defaults.normalise.write.vox = [2 2 2];
  127. defaults.normalise.write.interp = 4;
  128. % Old Spatial Normalisation defaults
  129. %==========================================================================
  130. defaults.old.normalise.estimate.smosrc = 8;
  131. defaults.old.normalise.estimate.smoref = 0;
  132. defaults.old.normalise.estimate.regtype = 'mni';
  133. defaults.old.normalise.estimate.weight = '';
  134. defaults.old.normalise.estimate.cutoff = 25;
  135. defaults.old.normalise.estimate.nits = 16;
  136. defaults.old.normalise.estimate.reg = 1;
  137. defaults.old.normalise.write.preserve = 0;
  138. defaults.old.normalise.write.bb = [[-78 -112 -70];[78 76 85]];
  139. defaults.old.normalise.write.vox = [2 2 2];
  140. defaults.old.normalise.write.interp = 1;
  141. defaults.old.normalise.write.wrap = [0 0 0];
  142. defaults.old.normalise.write.prefix = 'w';
  143. % VBM Preprocessing defaults
  144. %==========================================================================
  145. defaults.old.preproc.tpm = cellstr(char(...
  146. fullfile(spm('Dir'),'toolbox','OldSeg','grey.nii'),...
  147. fullfile(spm('Dir'),'toolbox','OldSeg','white.nii'),...
  148. fullfile(spm('Dir'),'toolbox','OldSeg','csf.nii'))); % Prior probability maps
  149. defaults.old.preproc.ngaus = [2 2 2 4]'; % Gaussians per class
  150. defaults.old.preproc.warpreg = 1; % Warping Regularisation
  151. defaults.old.preproc.warpco = 25; % Warp Frequency Cutoff
  152. defaults.old.preproc.biasreg = 0.0001; % Bias regularisation
  153. defaults.old.preproc.biasfwhm = 60; % Bias FWHM
  154. defaults.old.preproc.regtype = 'mni'; % Affine Regularisation
  155. defaults.old.preproc.fudge = 5; % Fudge factor, can not be set in batch GUI
  156. defaults.old.preproc.samp = 3; % Sampling distance
  157. defaults.old.preproc.output.GM = [0 0 1];
  158. defaults.old.preproc.output.WM = [0 0 1];
  159. defaults.old.preproc.output.CSF = [0 0 0];
  160. defaults.old.preproc.output.biascor = 1;
  161. defaults.old.preproc.output.cleanup = 0;
  162. % Smooth defaults
  163. %==========================================================================
  164. defaults.smooth.fwhm = [8 8 8];
  165. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  166. %-Prevent users from making direct calls to spm_defaults
  167. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  168. persistent runOnce
  169. try
  170. if ~isdeployed && isempty(runOnce)
  171. d = dbstack;
  172. if isempty(intersect({'spm','spm_get_defaults'},{d.name}))
  173. fprintf(['Direct calls to spm_defauts are deprecated.\n' ...
  174. 'Please use spm(''Defaults'',modality) ' ...
  175. 'or spm_get_defaults instead.\n']);
  176. runOnce = 1;
  177. end
  178. end
  179. end
  180. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  181. %-Execute user-specified defaults files
  182. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  183. def = defaults;
  184. user_defaults = 'spm_my_defaults.m';
  185. if exist(user_defaults,'file')
  186. if isdeployed && exist(fullfile(spm('Dir'),user_defaults),'file')
  187. user_defaults_file = cellstr(fullfile(spm('Dir'),user_defaults));
  188. else
  189. user_defaults_file = cellstr(which(user_defaults,'-ALL'));
  190. end
  191. for i=1:numel(user_defaults_file)
  192. try
  193. spm('run', user_defaults_file{i});
  194. catch
  195. lr = lasterror;
  196. warning(lr.message);
  197. end
  198. end
  199. if spm_check_version('matlab','8.0') >= 0, my_isequaln = @isequaln;
  200. else my_isequaln = @isequalwithequalnans; end
  201. if ~my_isequaln(def,defaults)
  202. fprintf('Defaults settings have been modified by file(s):\n');
  203. for i=1:numel(user_defaults_file)
  204. fprintf(' %s\n',user_defaults_file{i});
  205. end
  206. fn0 = fieldnames(def);
  207. mf = fn0(~cellfun(@(x) my_isequaln(def.(x),defaults.(x)),fn0));
  208. if ~isempty(mf)
  209. fprintf('Modified fields: ');
  210. for i=1:numel(mf)
  211. fprintf('%s ',mf{i});
  212. end
  213. fprintf('\n');
  214. end
  215. end
  216. end