Skip to content

Commit d8a4de9

Browse files
committed
mh fix
1 parent e33a550 commit d8a4de9

File tree

1 file changed

+54
-54
lines changed

1 file changed

+54
-54
lines changed

src/aperture/apertureTexture.m

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -2,68 +2,68 @@
22
% [cfg, thisEvent] = apertureTexture(action, cfg, thisEvent)
33
%
44
%
5-
5+
66
switch action
7-
7+
88
case 'init'
9-
9+
1010
cfg = apertureInit(cfg);
11-
11+
1212
cfg.aperture.texture = Screen('MakeTexture', cfg.screen.win, ...
1313
cfg.color.background(1) * ones(cfg.screen.winRect([3 3])));
14-
14+
1515
case 'make'
16-
16+
1717
TRANSPARENT = [0, 0, 0, 0];
18-
18+
1919
xCenter = cfg.screen.center(1);
2020
yCenter = cfg.screen.center(2);
21-
21+
2222
switch cfg.aperture.type
23-
23+
2424
case 'none'
25-
25+
2626
Screen('Fillrect', cfg.aperture.texture, TRANSPARENT);
27-
27+
2828
case 'circle'
29-
29+
3030
diameter = cfg.aperture.widthPix;
31-
31+
3232
if isfield(cfg.aperture, 'xPosPix')
3333
xCenter = cfg.screen.center(1) + cfg.aperture.xPosPix;
3434
end
3535
if isfield(cfg.aperture, 'yPosPix')
3636
yCenter = cfg.screen.center(2) + cfg.aperture.yPosPix;
3737
end
38-
38+
3939
Screen('FillOval', cfg.aperture.texture, TRANSPARENT, ...
4040
CenterRectOnPoint([0, 0, repmat(diameter, 1, 2)], ...
4141
xCenter, yCenter));
42-
42+
4343
case 'ring'
44-
44+
4545
% expansion speed is log over eccentricity
4646
[cfg] = eccenLogSpeed(cfg, thisEvent.time);
47-
47+
4848
Screen('Fillrect', cfg.aperture.texture, cfg.color.background);
49-
49+
5050
Screen('FillOval', cfg.aperture.texture, TRANSPARENT, ...
5151
CenterRectOnPoint( ...
5252
[0, 0, repmat(cfg.ring.outerRimPix, 1, 2)], ...
5353
xCenter, yCenter));
54-
54+
5555
Screen('FillOval', cfg.aperture.texture, [cfg.color.background 255], ...
5656
CenterRectOnPoint( ...
5757
[0, 0, repmat(cfg.ring.innerRimPix, 1, 2)], ...
5858
xCenter, yCenter));
59-
59+
6060
case 'wedge'
61-
61+
6262
cycleDuration = cfg.mri.repetitionTime * cfg.volsPerCycle;
63-
63+
6464
% Update angle for rotation of background and for apperture for wedge
6565
switch cfg.direction
66-
66+
6767
case '+'
6868
thisEvent.angle = 90 - ...
6969
cfg.aperture.width / 2 + ...
@@ -72,86 +72,86 @@
7272
thisEvent.angle = 90 - ...
7373
cfg.aperture.width / 2 - ...
7474
(thisEvent.time / cycleDuration) * 360;
75-
75+
7676
end
77-
77+
7878
Screen('Fillrect', cfg.aperture.texture, cfg.color.background);
79-
79+
8080
Screen('FillArc', cfg.aperture.texture, TRANSPARENT, ...
8181
CenterRect( ...
8282
cfg.destinationRect, ...
8383
cfg.screen.winRect), ...
8484
thisEvent.angle, ... % start angle
8585
cfg.aperture.width); % arc angle
86-
86+
8787
case 'bar'
88-
88+
8989
% aperture is the color of the background
9090
Screen('FillRect', cfg.aperture.texture, cfg.color.background);
91-
91+
9292
% We let the stimulus through
9393
Screen('FillOval', cfg.aperture.texture, TRANSPARENT, ...
9494
CenterRect( ...
9595
[0, 0, repmat(cfg.screen.winRect(4), 1, 2)], ...
9696
cfg.screen.winRect));
97-
97+
9898
% Then we add the position of the bar aperture
99-
99+
100100
% which one is the right and which one is the left??
101-
101+
102102
Screen('FillRect', cfg.aperture.texture, cfg.color.background, ...
103103
[0, ...
104104
0, ...
105105
thisEvent.barPosPix - cfg.aperture.barWidthPix / 2, ...
106106
cfg.screen.winRect(4)]);
107-
107+
108108
Screen('FillRect', cfg.aperture.texture, cfg.color.background, ...
109109
[thisEvent.barPosPix + cfg.aperture.barWidthPix / 2, ...
110110
0, ...
111111
cfg.screen.winRect(3), ...
112112
cfg.screen.winRect(4)]);
113-
113+
114114
otherwise
115-
115+
116116
error('unknown aperture type: %s.', cfg.aperture.type);
117-
117+
118118
end
119-
119+
120120
case 'draw'
121-
121+
122122
scalingFactor = 1;
123123
if isfield(cfg, 'scalingFactor') && ~isempty(cfg.scalingFactor)
124124
scalingFactor = cfg.scalingFactor;
125125
end
126-
126+
127127
rotationAngle = [];
128128
if strcmp(cfg.aperture.type, 'bar')
129-
rotationAngle = thisEvent.condition - 90;
129+
rotationAngle = thisEvent.condition - 90;
130130
end
131-
131+
132132
Screen('DrawTexture', cfg.screen.win, cfg.aperture.texture, ...
133133
cfg.screen.winRect, ...
134134
CenterRect(cfg.screen.winRect * scalingFactor, cfg.screen.winRect), ...
135135
rotationAngle);
136-
136+
137137
end
138-
138+
139139
end
140140

141141
function cfg = apertureInit(cfg)
142-
142+
143143
switch cfg.aperture.type
144-
144+
145145
case 'circle'
146146
% we take the screen height as maximum aperture width if not
147147
% specified.
148148
if ~isfield(cfg.aperture, 'width') || isempty(cfg.aperture.width)
149149
cfg.aperture.width = cfg.screen.winRect(4) / cfg.screen.ppd;
150150
end
151151
cfg.aperture = degToPix('width', cfg.aperture, cfg);
152-
152+
153153
case 'ring'
154-
154+
155155
% Set parameters for rings
156156
if strcmp(cfg.aperture.type, 'ring')
157157
% scale of outer ring (exceeding screen until
@@ -168,25 +168,25 @@
168168
log(cfg.ring.maxEcc + exp(1)) - ...
169169
(cfg.ring.maxEcc + exp(1)));
170170
end
171-
171+
172172
case 'bar'
173-
173+
174174
% Set parameters drifting bars
175175
cfg.aperture.barWidthPix = cfg.stimRect(3) / cfg.volsPerCycle;
176-
176+
177177
barPosPix = ...
178178
[0:cfg.aperture.barWidthPix:cfg.stimRect(3) - cfg.aperture.barWidthPix] + ...
179179
(cfg.screen.winRect(3) / 2 - cfg.stimRect(3) / 2) + ...
180180
cfg.aperture.barWidthPix / 2; %#ok<NBRAK>
181-
181+
182182
cfg.aperture.barPosPix = barPosPix;
183-
183+
184184
% Width of bar in degrees of VA (needed for saving)
185185
cfg.aperture.width = cfg.aperture.barWidthPix / cfg.screen.ppd;
186186
cfg.aperture.barPos = ...
187187
(cfg.aperture.barPosPix - cfg.screen.center(1)) / ...
188188
cfg.screen.ppd;
189-
189+
190190
end
191-
191+
192192
end

0 commit comments

Comments
 (0)