Skip to content

Commit 867aba4

Browse files
committed
refactor fixation from retinotopy
1 parent cb32a6f commit 867aba4

File tree

3 files changed

+37
-18
lines changed

3 files changed

+37
-18
lines changed

drawFixation.m

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,35 @@
11
function drawFixation(cfg)
22
% Define the parameters of the fixation cross in `cfg` and `expParameters`
3-
4-
if strcmp(cfg.fixation.type, 'cross')
5-
6-
smooth = 1;
7-
8-
Screen('DrawLines', ...
9-
cfg.screen.win, ...
10-
cfg.fixation.allCoords, ...
11-
cfg.fixation.lineWidthPix, ...
12-
cfg.fixation.color, ...
13-
[cfg.screen.center(1) cfg.screen.center(2)], smooth);
3+
4+
switch cfg.fixation.type
5+
case 'cross'
6+
7+
smooth = 1;
8+
9+
Screen('DrawLines', ...
10+
cfg.screen.win, ...
11+
cfg.fixation.allCoords, ...
12+
cfg.fixation.lineWidthPix, ...
13+
cfg.fixation.color, ...
14+
[cfg.screen.center(1) cfg.screen.center(2)], smooth);
15+
16+
case 'dot'
17+
18+
% Draw gap around fixation of 20% the size
19+
Screen('FillOval', ...
20+
cfg.screen.win, ...
21+
cfg.color.background, ...
22+
CenterRect( ...
23+
[0 0 repmat(1.2 * cfg.fixation.widthPix, 1, 2)], ...
24+
cfg.screen.winRect));
25+
26+
% Draw fixation
27+
Screen('FillOval', ...
28+
cfg.screen.win, ...
29+
cfg.color.foreground, ...
30+
CenterRect( ...
31+
[0 0 repmat(cfg.fixation.widthPix, 1, 2)], ...
32+
cfg.screen.winRect));
1433
end
15-
34+
1635
end

initFixation.m

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
function cfg = initFixation(cfg)
2+
3+
% Convert some values from degrees to pixels
4+
cfg.fixation = degToPix('width', cfg.fixation, cfg);
5+
cfg.fixation = degToPix('xDisplacement', cfg.fixation, cfg);
6+
cfg.fixation = degToPix('yDisplacement', cfg.fixation, cfg);
27

38
if strcmp(cfg.fixation.type, 'cross')
49

5-
% Convert some values from degrees to pixels
6-
cfg.fixation = degToPix('width', cfg.fixation, cfg);
7-
cfg.fixation = degToPix('xDisplacement', cfg.fixation, cfg);
8-
cfg.fixation = degToPix('yDisplacement', cfg.fixation, cfg);
9-
1010
% Prepare fixation cross
1111
cfg.fixation.xCoords = [-cfg.fixation.widthPix cfg.fixation.widthPix 0 0] / 2 + ...
1212
cfg.fixation.xDisplacementPix;

setDefaultsPTB.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
fieldsToSet.fixation.xDisplacement = 0;
3636
fieldsToSet.fixation.yDisplacement = 0;
3737
fieldsToSet.fixation.color = [255 255 255];
38-
fieldsToSet.fixation.width = 1;
38+
fieldsToSet.fixation.width = 1; % degrees of visual angle
3939
fieldsToSet.fixation.lineWidthPix = 5;
4040

4141
% define visual apperture field

0 commit comments

Comments
 (0)