forked from cpp-lln-lab/localizer_visual_motion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setParameters.m
executable file
·252 lines (189 loc) · 7.68 KB
/
setParameters.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
% (C) Copyright 2020 CPP visual motion localizer developpers
function [cfg] = setParameters()
% VISUAL LOCALIZER
% Initialize the general configuration variables structure
cfg = struct();
% by default the data will be stored in an output folder created where the
% setParamters.m file is
% change that if you want the data to be saved somewhere else
cfg.dir.output = fullfile( ...
fileparts(mfilename('fullpath')), 'output');
%% Debug mode settings
cfg.debug.do = true; % To test the script out of the scanner, skip PTB sync
cfg.debug.smallWin = false; % To test on a part of the screen, change to 1
cfg.debug.transpWin = false; % To test with trasparent full size screen
cfg.skipSyncTests = 0;
cfg.verbose = 1;
%% Engine parameters
cfg.testingDevice = 'mri';
cfg.eyeTracker.do = false;
cfg.audio.do = false;
cfg = setMonitor(cfg);
% Keyboards
cfg = setKeyboards(cfg);
% MRI settings
cfg = setMRI(cfg);
% cfg.suffix.acquisition = '';
cfg.pacedByTriggers.do = false;
%% Experiment Design
% switching this on to MT or MT/MST with use:
% - MT: translational motion on the whole screen
% - alternates static and motion (left or right) blocks
% - MST: radial motion centered in a circle aperture that is on the opposite
% side of the screen relative to the fixation
% - alternates fixaton left and fixation right
% cfg.design.localizer = 'MT';
cfg.design.localizer = 'MT_MST';
cfg.design.motionType = 'translation';
cfg.design.motionDirections = [0 0 180 180];
cfg.design.names = {'static'; 'motion'};
% if you have static and motion and `nbRepetions` = 4, this will return 8 blocks (for MT/MST
% localizer && 2 hemifield it is 8 blocks per hemifield), i.e. how many times each condition
% will be repeated
cfg.design.nbRepetitions = 12;
cfg.design.nbEventsPerBlock = 12;
%% Timing
% FOR 7T: if you want to create localizers on the fly, the following must be
% multiples of the scanner sequence TR
%
% IBI
% block length = (cfg.eventDuration + cfg.ISI) * cfg.design.nbEventsPerBlock
cfg.timing.eventDuration = 0.30; % second
% Time between blocs in secs
cfg.timing.IBI = 0;
% Time between events in secs
cfg.timing.ISI = 0;
% Number of seconds before the motion stimuli are presented
cfg.timing.onsetDelay = 0;
% Number of seconds after the end all the stimuli before ending the run
cfg.timing.endDelay = 3.6;
% reexpress those in terms of repetition time
if cfg.pacedByTriggers.do
cfg.pacedByTriggers.quietMode = true;
cfg.pacedByTriggers.nbTriggers = 1;
cfg.timing.eventDuration = cfg.mri.repetitionTime / 2 - 0.04; % second
% Time between blocs in nb of triggers (remember to consider the nb trigger to wait + 1)
cfg.timing.triggerIBI = 4;
% Time between blocks in secs
cfg.timing.IBI = 0;
% Time between events in secs
cfg.timing.ISI = 0;
% Number of seconds before the motion stimuli are presented
cfg.timing.onsetDelay = 0;
% Number of seconds after the end all the stimuli before ending the run
cfg.timing.endDelay = 2;
end
%% Visual Stimulation
% Speed in visual angles / second
cfg.dot.speed = 15;
% Coherence Level (0-1)
cfg.dot.coherence = 1;
% Number of dots per visual angle square.
cfg.dot.density = 1;
% Dot life time in seconds
cfg.dot.lifeTime = 0.4;
% proportion of dots killed per frame
cfg.dot.proportionKilledPerFrame = 0;
% Dot Size (dot width) in visual angles.
cfg.dot.size = .2;
cfg.dot.color = cfg.color.white;
% Static dots should change position at each event or not
cfg.dot.staticReSeed = true;
% Diameter/length of side of aperture in Visual angles
cfg.aperture.type = 'none';
cfg.aperture.width = []; % if left empty it will take the screen height
cfg.aperture.xPos = 0;
%% Task(s)
cfg.task.name = 'visual localizer';
% Instruction
cfg.task.instruction = '1-Detect the RED fixation cross\n \n\n';
% Fixation cross (in pixels)
cfg.fixation.type = 'cross';
cfg.fixation.color = cfg.color.white;
cfg.fixation.width = .25;
cfg.fixation.lineWidthPix = 3;
cfg.fixation.xDisplacement = 0;
cfg.fixation.yDisplacement = 0;
% target
cfg.target.maxNbPerBlock = 1;
cfg.target.duration = 0.1; % In secs
cfg.target.type = 'fixation_cross';
% 'fixation_cross' : the fixation cross changes color
% 'static_repeat' : static dots are in the same position as previous trials
cfg.fixation.colorTarget = cfg.fixation.color;
if strcmp(cfg.target.type, 'fixation_cross')
cfg.fixation.colorTarget = cfg.color.red;
end
cfg.extraColumns = { ...
'direction', ...
'speedDegVA', ...
'target', ...
'event', ...
'block', ...
'keyName', ...
'fixationPosition', ...
'aperturePosition'};
%% orverrireds the relevant fields in case we use the MT / MST localizer
cfg = setParametersMtMst(cfg);
end
function cfg = setKeyboards(cfg)
cfg.keyboard.escapeKey = 'ESCAPE';
cfg.keyboard.responseKey = { ...
'r', 'g', 'y', 'b', ...
'd', 'n', 'z', 'e', ...
't'};
cfg.keyboard.keyboard = [];
cfg.keyboard.responseBox = [];
if strcmpi(cfg.testingDevice, 'mri')
cfg.keyboard.keyboard = [];
cfg.keyboard.responseBox = [];
end
end
function cfg = setMRI(cfg)
% letter sent by the trigger to sync stimulation and volume acquisition
cfg.mri.triggerKey = 't';
cfg.mri.triggerNb = 5;
cfg.mri.repetitionTime = 1.8;
cfg.bids.MRI.Instructions = 'Detect the RED fixation cross';
cfg.bids.MRI.TaskDescription = [];
end
function cfg = setMonitor(cfg)
% Monitor parameters for PTB
cfg.color.white = [255 255 255];
cfg.color.black = [0 0 0];
cfg.color.red = [255 0 0];
cfg.color.grey = mean([cfg.color.black; cfg.color.white]);
cfg.color.background = cfg.color.black;
cfg.text.color = cfg.color.white;
% Monitor parameters
cfg.screen.monitorWidth = 50; % in cm
cfg.screen.monitorDistance = 40; % distance from the screen in cm
if strcmpi(cfg.testingDevice, 'mri')
cfg.screen.monitorWidth = 25;
cfg.screen.monitorDistance = 95;
end
end
function cfg = setParametersMtMst(cfg)
if isfield(cfg.design, 'localizer') && strcmpi(cfg.design.localizer, 'MT_MST')
cfg.task.name = 'mt mst localizer';
cfg.design.motionType = 'radial';
cfg.design.motionDirections = [666 -666];
cfg.design.names = {'motion'};
% cfg.design.names = {'static'; 'motion'};
cfg.design.fixationPosition = {'fixation_left'};
% cfg.design.fixationPosition = {'fixation_right'; 'fixation_left'};
cfg.design.xDisplacementFixation = 7;
cfg.design.xDisplacementAperture = 3;
% inward and outward are presented as separated event
cfg.design.nbEventsPerBlock = cfg.design.nbEventsPerBlock * 2;
cfg.timing.IBI = 4;
cfg.timing.changeFixationPosition = 10;
% reexpress those in terms of repetition time
if cfg.pacedByTriggers.do
cfg.timing.IBI = 2;
end
cfg.aperture.type = 'circle';
cfg.aperture.width = 7; % if left empty it will take the screen height
cfg.aperture.xPos = cfg.design.xDisplacementAperture;
end
end