fmrwhy_settings_template.m 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. % ------------------------
  2. % fmrwhy_settings_template
  3. % ------------------------
  4. % ----------
  5. % Section 01
  6. % ----------
  7. % Main data source: BIDS root folder
  8. options.bids_dir = 'G:\Projects\CBIrep_Imaging';
  9. % ----------
  10. % Section 02
  11. % ----------
  12. % Subjects to run. If all ==> 'all'. If a subset, include the subject identifier as a cell array.
  13. options.subjects_output = 'all'; % e.g.: options.subjects_output = {'001', '003', '021'};
  14. % ----------
  15. % Section 03
  16. % ----------
  17. % Realignment uses the SPM12 2step procedure: realignment to first, followed by realignment to mean
  18. % You can select the level at which realignment occurs. Options:
  19. % per_task:
  20. % - all runs of a task are included (in order) in the realignment procedure
  21. % per_run:
  22. % - a single run is included in the realignment procedure; this is repeated for all runs.
  23. % to_template:
  24. % - a single run is included in the realignment procedure; it is realigned to a template specified below. this is repeated for all runs.
  25. options.realignment_type = 'to_template'; % per_task / per_run / to_template
  26. options.realignment_template_session = '';
  27. options.realignment_template_task = '';
  28. options.realignment_template_run = '';
  29. options.realignment_template_echo = '';
  30. % (if not needed, set to '')
  31. % Set to which reference the coregistration should be done. Options:
  32. % per_task (i.e. multiple coregistrations):
  33. % - coregistration is done to each task
  34. % - the functional template is either specified by options.template_run (mean image)
  35. % or it is taken as the mean image of all runs of the same task (and session)
  36. % per_run (i.e. multiple coregistrations):
  37. % - coregistration is done to each run
  38. % - the functional template is taken as the mean image of the specific run (options.template_run is ignored)
  39. % to_template (i.e. a single coregistration):
  40. options.coreg_type = 'to_template'; % per_task / per_run / to_template
  41. % Set the template for functional data, used for coregistration
  42. options.coreg_template_session = '';
  43. options.coreg_template_task = '';
  44. options.coreg_template_run = '';
  45. options.coreg_template_echo = '';
  46. % (if not needed, set to '')
  47. % Set the T1w image that will be used for anatomical-to-functional registration steps
  48. % Default behaviour is that session-specific T1w images are used for coregistration of functional
  49. % data in the same session (options.anat_template_session = '')
  50. % Custom behaviour is introduced if a template session is selected (e.g. options.anat_template_session = '1')
  51. % In the latter case the template session T1w image is copied to other sessions (and renamed accordingly)
  52. % in order to simplify processing steps and avoid duplication+overwriting of results. This
  53. % is then followed by the same procedure as session-specific coregistration.
  54. % Copying is only done in the derivatives directory, BIDS dataset data are left untouched.
  55. % This has obvious (possible bad) implications for interpreting the preprocessed data,
  56. % but it is deemed fine if we remain aware of this.
  57. options.anat_template_session = '';
  58. options.normalise_to_MNI = false;
  59. % ----------
  60. % Section 04
  61. % ----------
  62. % Define sequence parameters, this should be known to the user.
  63. % fMRwhy does not yet support deriving these parameters from the BIDS json files
  64. options.TR = 2;
  65. options.N_slices = 34;
  66. options.Ndummies = 5; % Specify number of dummies, even if they have already been excluded from the BOLD timeseries images. This is important for the TAPAS PhysIO steps when processing cardiac and respiratory data.
  67. options.Nscans = 210; % The number of scans in the BOLD timeseries images, excluding dummies.
  68. options.TE = [14 28 42]; % The echo times if multi-echo. fMRwhy assumes this is the same for all functional runs. If not multi-echo, set to [].
  69. % ----------
  70. % Section 05 - Settings for anatLocaliser processing
  71. % ----------
  72. % Should the QC pipeline also map ROIs to the subject space. Yes = 1; No = 0. If 0, the rest of this section can be ignored.
  73. options.map_rois = 0;
  74. % Specify directory with roi files, assumed to be in MNI152 space
  75. options.roi_orig_dir = '/Users/jheunis/Desktop/sample-data/NEUFEPME_data_templates';
  76. options.roi = struct;
  77. % Specify the roi filenames, names, descriptions
  78. % IMPORTANT: structure has to be named using the task name as specified in the BIDS data structure: options.roi.(task).orig_fn
  79. options.roi.motor.orig_fn = {fullfile(options.roi_orig_dir, 'Left_Motor_4a_4p.nii')
  80. fullfile(options.roi_orig_dir, 'Right_Motor_4a_4p.nii')}; % Raw ROI filenames
  81. options.roi.motor.name = {'Left Motor', 'Right Motor'}; % For plots and strings
  82. options.roi.motor.desc = {'leftMotor', 'rightMotor'}; % For BIDS file naming (after normalisation to functional space)
  83. options.roi.emotion.orig_fn = {fullfile(options.roi_orig_dir, 'Bilateral_Amygdala_allregions.nii')
  84. fullfile(options.roi_orig_dir, 'Left_Amygdala_allregions.nii')
  85. fullfile(options.roi_orig_dir, 'Right_Amygdala_allregions.nii')}; % Raw ROI filenames
  86. options.roi.emotion.name = {'Bilateral Amygdala', 'Left Amygdala', 'Right Amygdala'}; % For plots and strings
  87. options.roi.emotion.desc = {'bilateralAmygdala', 'leftAmygdala', 'rightAmygdala'}; % For BIDS file naming (after normalisation to functional space)
  88. % options.roi.(task).roi_fn = ROIs in subject space (not resliced)
  89. % options.roi.(task).rroi_fn = resliced ROIs in subject space
  90. % ----------
  91. % Section 06 - Settings for basicFunc processing
  92. % ----------
  93. options.fwhm = 7; % FWHM of the spatial smoothing kernel, typically twice the voxel size, in mm
  94. options.basicfunc_full = false; % if true, preprocessing will include all combinations of slice time correction, realignment and smoothing, useful for later analyses; if false, only include steps necessary for QC
  95. options.include_stc = false; % include slice timing correction?
  96. % Settings for generateMultRegr routine; specifies which regressors to generate for GLM analysis
  97. options.confounds.include_volterra = 1; % to generate the volterra expansion of the 6 realignment parameters ==> 1
  98. options.confounds.include_fd = 1; % to generate framewise displacement ==> 1
  99. options.confounds.include_tissue = 1; % to generate signals from GM, WM, CSF compartments ==> 1
  100. options.confounds.include_physio = 1; % if cardiac and respiration data are available ==> 1
  101. % generateMultRegr: framewise displacement. No need to change these defaults unless for very specific and well-motivated reasons.
  102. options.r = 50; % mm
  103. options.FD_threshold = 0; % set as 0 to calculate with both standard thresholds 0.2 and 0.5 mm.
  104. % ----------
  105. % Section 07 - Settings for physiology processing
  106. % ----------
  107. % Parameters required by TAPAS PhysIO
  108. % For a better understanding of how to set these parameters, read the TAPAS PhysIO documentation
  109. % Parameters to set: sampling_interval, align_scan, onset_slice, cardiac_modality.
  110. options.physio.options.cardiac_fn = '';
  111. options.physio.options.respiration_fn = '';
  112. options.physio.options.vendor = 'BIDS';
  113. options.physio.options.sampling_interval = 0.002; % 500 Hz ==> Philips wired acquisition
  114. options.physio.options.align_scan = 'last';
  115. options.physio.options.Nslices = options.N_slices;
  116. options.physio.options.TR = options.TR; % in seconds
  117. options.physio.options.Ndummies = options.Ndummies; % include, even if these are not included in the fMRI timeseries data exported from the scanner
  118. options.physio.options.Nscans = options.Nscans;
  119. options.physio.options.onset_slice = 1;
  120. options.physio.options.cardiac_modality = 'PPU';
  121. options.physio.options.output_multiple_regressors_fn = 'PhysIO_multiple_regressors.txt'; % text file name
  122. options.physio.options.level = 0; % verbose.level = 0 ==> do not generate figure outputs
  123. options.physio.options.fig_output_file = ''; % unnecessary if verbose.level = 0, but still initialized here
  124. % ----------
  125. % Section 08 - Settings for QC processing and reporting
  126. % ----------
  127. % Settings for QC
  128. % No need to change these defaults unless for very specific and well-motivated reasons.
  129. options.theplot.intensity_scale = [-6 6];
  130. options.qc_overwrite_tissuecontours = true;
  131. options.qc_overwrite_ROIcontours = true;
  132. options.qc_overwrite_theplot = false;
  133. options.qc_overwrite_statsoutput = true;
  134. options.qc_report_runs = {'task-rest_run-1', 'task-fingerTapping', 'task-emotionProcessing', 'task-rest_run-2', 'task-fingerTappingImagined', 'task-emotionProcessingImagined'};
  135. options.qc_dataset_name = 'rt-me-fMRI';
  136. options.qc_anat_res = '1x1x1 mm (100x100x100 voxels)';
  137. options.qc_func_res = '3.5x3.5x3.5 mm (64x64x34 voxels)';
  138. options.qc_func_acq = 'Multi-echo (TE = 14,28,42 ms), SENSE = 2.5';
  139. options.qc_func_runs = 'rest_run-1, fingerTapping, emotionProcessing, rest_run-2, fingerTappingImagined, emotionProcessingImagined';
  140. % ONLY FOR TASK DATA:
  141. % ----------
  142. % Section 09 - Settings for first level analysis
  143. % ----------
  144. % Settings for first level analysis: steps to include/exclude
  145. % No need to change these defaults unless for very specific and well-motivated reasons.
  146. options.firstlevel.tmap_montages = true;
  147. options.firstlevel.anat_func_roi = true;
  148. % Settings for first level analysis: task-motor
  149. options.firstlevel.motor.run1.sess_params.timing_units = 'secs';
  150. options.firstlevel.motor.run1.sess_params.timing_RT = 2;
  151. options.firstlevel.motor.run1.sess_params.cond_names = {'FingerTapping'};
  152. options.firstlevel.motor.run2.sess_params.timing_units = 'secs';
  153. options.firstlevel.motor.run2.sess_params.timing_RT = 2;
  154. options.firstlevel.motor.run2.sess_params.cond_names = {'MentalFingerTapping'};
  155. % Settings for first level analysis: task-emotion
  156. options.firstlevel.emotion.run1.sess_params.timing_units = 'secs';
  157. options.firstlevel.emotion.run1.sess_params.timing_RT = 2;
  158. options.firstlevel.emotion.run1.sess_params.cond_names = {'Faces', 'Shapes'};
  159. options.firstlevel.emotion.run2.sess_params.timing_units = 'secs';
  160. options.firstlevel.emotion.run2.sess_params.timing_RT = 2;
  161. options.firstlevel.emotion.run2.sess_params.cond_names = {'MentalEmotion'};
  162. % Settings for plotting task conditions
  163. onset = [11; 31; 51; 71; 91; 111; 131; 151; 171; 191];
  164. duration = [10; 10; 10; 10; 10; 10; 10; 10; 10; 10];
  165. options.firstlevel.motor.run1.plot_params.cond_onset = onset;
  166. options.firstlevel.motor.run1.plot_params.cond_duration = duration;
  167. options.firstlevel.motor.run2.plot_params.cond_onset = onset;
  168. options.firstlevel.motor.run2.plot_params.cond_duration = duration;
  169. options.firstlevel.emotion.run2.plot_params.cond_onset = onset;
  170. options.firstlevel.emotion.run2.plot_params.cond_duration = duration;
  171. onset = [12; 32; 52; 72; 92; 112; 132; 152; 172; 192];
  172. duration = [9; 9; 9; 9; 9; 9; 9; 9; 9; 9];
  173. options.firstlevel.emotion.run1.plot_params.cond_onset = onset;
  174. options.firstlevel.emotion.run1.plot_params.cond_duration = duration;
  175. % Settings for first level analysis: glm regressors to include
  176. options.firstlevel.glm_regressors.trans_rot = true;
  177. options.firstlevel.glm_regressors.trans_rot_derivative1 = true;
  178. options.firstlevel.glm_regressors.trans_rot_power2 = false;
  179. options.firstlevel.glm_regressors.trans_rot_derivative1_power2 = false;
  180. options.firstlevel.glm_regressors.framewise_displacement_censor02 = false;
  181. options.firstlevel.glm_regressors.framewise_displacement_censor05 = false;
  182. options.firstlevel.glm_regressors.dvars_censor = false; % not yet implemented
  183. options.firstlevel.glm_regressors.std_dvars_censor = false; % not yet implemented
  184. options.firstlevel.glm_regressors.grey_matter = false;
  185. options.firstlevel.glm_regressors.white_matter = false;
  186. options.firstlevel.glm_regressors.csf = true;
  187. options.firstlevel.glm_regressors.global_signal = false;
  188. % Order of included retroicor regressors; if 0 ==> exclude
  189. options.firstlevel.glm_regressors.retroicor_c = 2; % cardiac, max 6
  190. options.firstlevel.glm_regressors.retroicor_r = 2; % respiratory, max 8
  191. options.firstlevel.glm_regressors.retroicor_cxr = 0; % interaction, max 4
  192. options.firstlevel.glm_regressors.hrv = false;
  193. options.firstlevel.glm_regressors.rvt = false;
  194. % Settings for first level analysis: task-motor
  195. options.firstlevel.motor.run1.contrast_params.consess{1}.tcon.name = 'FingerTapping';
  196. options.firstlevel.motor.run1.contrast_params.consess{1}.tcon.weights = [1];
  197. options.firstlevel.motor.run1.contrast_params.consess{1}.tcon.sessrep = 'none';
  198. options.firstlevel.motor.run2.contrast_params.consess{1}.tcon.name = 'MentalFingerTapping';
  199. options.firstlevel.motor.run2.contrast_params.consess{1}.tcon.weights = [1];
  200. options.firstlevel.motor.run2.contrast_params.consess{1}.tcon.sessrep = 'none';
  201. % Settings for first level analysis: task-emotion
  202. options.firstlevel.emotion.run1.contrast_params.consess{1}.tcon.name = 'Faces';
  203. options.firstlevel.emotion.run1.contrast_params.consess{1}.tcon.weights = [1 0];
  204. options.firstlevel.emotion.run1.contrast_params.consess{1}.tcon.sessrep = 'none';
  205. options.firstlevel.emotion.run1.contrast_params.consess{2}.tcon.name = 'Shapes';
  206. options.firstlevel.emotion.run1.contrast_params.consess{2}.tcon.weights = [0 1];
  207. options.firstlevel.emotion.run1.contrast_params.consess{2}.tcon.sessrep = 'none';
  208. options.firstlevel.emotion.run1.contrast_params.consess{3}.tcon.name = 'Faces>Shapes';
  209. options.firstlevel.emotion.run1.contrast_params.consess{3}.tcon.weights = [1 -1];
  210. options.firstlevel.emotion.run1.contrast_params.consess{3}.tcon.sessrep = 'none';
  211. options.firstlevel.emotion.run2.contrast_params.consess{1}.tcon.name = 'MentalEmotion';
  212. options.firstlevel.emotion.run2.contrast_params.consess{1}.tcon.weights = [1];
  213. options.firstlevel.emotion.run2.contrast_params.consess{1}.tcon.sessrep = 'none';
  214. % matlabbatch{1}.spm.stats.con.consess{2}.tcon.name = 'Patients > Control';
  215. % matlabbatch{1}.spm.stats.con.consess{2}.tcon.convec = [-1 1];
  216. % matlabbatch{1}.spm.stats.con.consess{2}.tcon.sessrep = 'none';