Skip to content

Commit 2960371

Browse files
authored
Merge pull request #108 from Remi-Gau/update_config_FOV
[DOC] Update for a non centered field of view
2 parents ef73748 + 84c6845 commit 2960371

File tree

10 files changed

+100
-18
lines changed

10 files changed

+100
-18
lines changed

cfgMST.m

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,33 @@
1212
% on macs is 0.3
1313
cfg.timing.eventDuration = 0.6; % 0.6 seconds
1414

15+
%% variable FOV info
16+
% in case the field of view is not properly centered or obstructed
17+
%
18+
% see https://github.com/cpp-lln-lab/estimate_visual_FOV.git
19+
%
20+
% set up configuration: ensure that the following fields are the same
21+
% as when you ran the estimate_visual_FOV script
22+
%
23+
% cfg.testingDevice
24+
% cfg.screen.monitorDistance
25+
% cfg.screen.monitorWidth
26+
27+
% fixation cross displacement in degrees of visual angles
28+
% this will also shift the whole FOV relative to the center of the screen
29+
% Note: negative values will move things to the left and up.
30+
cfg.fixation.xDisplacement = 0;
31+
cfg.fixation.yDisplacement = 0;
32+
33+
% determines position of the fixation cross on the right / left
34+
% should be a bit less than the: ( width of FOV ) / 2
35+
cfg.design.xDisplacementFixation = 3;
36+
37+
% determines position of the dots on the left /
38+
% should be a bit less than the: ( width of FOV ) / 2
39+
cfg.design.xDisplacementAperture = 7;
40+
41+
% determines the width of the dot circle
42+
cfg.aperture.width = 7;
43+
1544
end

cfgMT.m

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
cfg.design.localizer = 'MT';
66

7-
cfg.pacedByTriggers.do = true;
7+
cfg.pacedByTriggers.do = false;
88

99
cfg.timing.triggerIBI = 4;
1010

@@ -18,4 +18,23 @@
1818
% in mcas is 0.43
1919
cfg.timing.eventDuration = 0.79; % .86 second
2020

21+
%% variable FOV info
22+
% in case the field of view is not properly centered or obstructed
23+
%
24+
% see https://github.com/cpp-lln-lab/estimate_visual_FOV.git
25+
%
26+
% set up configuration: ensure that the following fields are the same
27+
% as when you ran the estimate_visual_FOV script
28+
%
29+
% cfg.testingDevice
30+
% cfg.screen.monitorDistance
31+
% cfg.screen.monitorWidth
32+
33+
% fixation cross displacement in degrees of visual angles
34+
% this will also shift the whole FOV relative to the center of the screen
35+
% Note: negative values will move things to the left and up.
36+
37+
cfg.fixation.xDisplacement = 0;
38+
cfg.fixation.yDisplacement = 0;
39+
2140
end

lib/CPP_PTB

main.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313

1414
cfg.verbose = 1;
1515

16-
cfg.debug.do = false;
17-
cfg.debug.transpWin = false;
16+
cfg.debug.do = true;
17+
cfg.debug.transpWin = true;
1818
cfg.debug.smallWin = false;
1919

2020
cfg.audio.devIdx = 5;
@@ -24,10 +24,10 @@
2424
cfg.dot.speed = 7.5;
2525

2626
%% Run MT+ localizer
27-
cfg = cfgMT(cfg);
27+
% cfg = cfgMT(cfg);
2828

2929
%% Run MT/MST localizer
30-
% cfg = cfgMST(cfg);
30+
cfg = cfgMST(cfg);
3131

3232
cfg = checkParameters(cfg);
3333

subfun/defaults/checkParameters.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@
177177

178178
fieldsToSet.aperture.type = 'circle';
179179
fieldsToSet.aperture.width = 7; % if left empty it will take the screen height
180-
fieldsToSet.aperture.xPos = fieldsToSet.design.xDisplacementAperture;
180+
fieldsToSet.aperture.xPos = 0;
181181

182182
case 'mt'
183183

subfun/postInitializationSetup.m

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,17 @@
1010

1111
cfg = postInitDots(cfg);
1212

13+
% TODO transfer those if blocks into 'degToPix' (and similarly into pixToDeg)
14+
% TODO this kind of generic post initialization can be done systematically at end of initPTB
15+
if isfield(cfg.fixation, 'xDisplacement')
16+
cfg.fixation = degToPix('xDisplacement', cfg.fixation, cfg);
17+
end
18+
if isfield(cfg.fixation, 'yDisplacement')
19+
cfg.fixation = degToPix('yDisplacement', cfg.fixation, cfg);
20+
end
21+
22+
if isfield(cfg.design, 'xDisplacementAperture')
23+
cfg.design = degToPix('xDisplacementAperture', cfg.design, cfg);
24+
end
25+
1326
end

subfun/preTrialSetup.m

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,26 +34,47 @@
3434

3535
thisEvent.fixationPosition = cfg.design.blockFixationPosition{iBlock};
3636

37+
% This is necessary because where the dot aperture is drawn is set in cfg
38+
% So we "reset" that pixel value from the value in degrees
39+
cfg.aperture.xPos = cfg.design.xDisplacementAperture;
40+
cfg.aperture = degToPix('xPos', cfg.aperture, cfg);
41+
3742
switch thisEvent.fixationPosition
3843

3944
case 'fixation_right'
4045
cfg.aperture.xPosPix = -abs(cfg.aperture.xPosPix);
41-
42-
thisEvent.dotCenterXPosPix = cfg.aperture.xPosPix;
43-
4446
thisFixation.fixation.xDisplacement = cfg.design.xDisplacementFixation;
45-
thisFixation = initFixation(thisFixation);
4647

4748
case 'fixation_left'
4849
cfg.aperture.xPosPix = +abs(cfg.aperture.xPosPix);
50+
thisFixation.fixation.xDisplacement = -cfg.design.xDisplacementFixation;
4951

50-
thisEvent.dotCenterXPosPix = cfg.aperture.xPosPix;
52+
otherwise
5153

52-
thisFixation.fixation.xDisplacement = -cfg.design.xDisplacementFixation;
53-
thisFixation = initFixation(thisFixation);
54+
error('WTF');
55+
56+
end
5457

58+
if isfield(cfg.fixation, 'xDisplacementPix')
59+
cfg.aperture.xPosPix = cfg.aperture.xPosPix + cfg.fixation.xDisplacementPix;
60+
thisFixation.fixation.xDisplacement = thisFixation.fixation.xDisplacement + ...
61+
cfg.fixation.xDisplacement;
5562
end
5663

64+
if isfield(cfg.fixation, 'yDisplacementPix')
65+
cfg.aperture.yPosPix = cfg.fixation.yDisplacementPix;
66+
thisEvent.dotCenterYPosPix = cfg.aperture.yPosPix;
67+
end
68+
69+
thisEvent.dotCenterXPosPix = cfg.aperture.xPosPix;
70+
71+
if isfield(cfg.fixation, 'yDisplacementPix')
72+
end
73+
74+
thisFixation.fixation.allCoords;
75+
76+
thisFixation = initFixation(thisFixation);
77+
5778
end
5879

5980
varargout = {thisEvent, thisFixation, cfg};

tests/data/config_MT.mat

0 Bytes
Binary file not shown.

tests/data/config_MT_MST.mat

-3 Bytes
Binary file not shown.

tests/test_checkParameters.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ function test_checkParameters_MT()
112112
cfg = removeDirFieldForGithubAction(cfg);
113113

114114
% uncomment for update default config .mat
115-
% expected = cfg;
116-
% save(fullfile(fileparts(mfilename('fullpath')), 'data', 'config_MT.mat'), 'expected');
115+
% expected = cfg;
116+
% save(fullfile(fileparts(mfilename('fullpath')), 'data', 'config_MT.mat'), 'expected');
117117
load(fullfile(fileparts(mfilename('fullpath')), 'data', 'config_MT.mat'), 'expected');
118118

119119
% test
@@ -132,8 +132,8 @@ function test_checkParameters_MT_MST()
132132
cfg = removeDirFieldForGithubAction(cfg);
133133

134134
% uncomment for update default config .mat
135-
% expected = cfg;
136-
% save(fullfile(fileparts(mfilename('fullpath')), 'data', 'config_MT_MST.mat'), 'expected');
135+
% expected = cfg;
136+
% save(fullfile(fileparts(mfilename('fullpath')), 'data', 'config_MT_MST.mat'), 'expected');
137137
load(fullfile(fileparts(mfilename('fullpath')), 'data', 'config_MT_MST.mat'), 'expected');
138138

139139
% test

0 commit comments

Comments
 (0)