Debian Codegraph @

EEG/ERPWindow.cpp

raw symbols SCIP
1 /* ERPWindow.cpp
2 *
3 * Copyright (C) 2012-2022 Paul Boersma
4 *
5 * This code is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or (at
8 * your option) any later version.
9 *
10 * This code is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this work. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 #include "ERPWindow.h"cxx . . $ `<file>/EEG/ERPWindow.h`/
20 #include "EditorM.h"cxx . . $ `<file>/sys/EditorM.h`/
21 #include "Preferences.h"cxx . . $ `<file>/sys/Preferences.h`/
22
23 Thing_implementcxx . . $ `sys/Thing.h:65:9`! (ERPWindow, FunctionEditor, 0);
24
25 #include "Prefs_define.h"cxx . . $ `<file>/sys/Prefs_define.h`/
26 #include "ERPWindow_prefs.h"cxx . . $ `<file>/EEG/ERPWindow_prefs.h`/
27 #include "Prefs_install.h"cxx . . $ `<file>/sys/Prefs_install.h`/
28 #include "ERPWindow_prefs.h"cxx . . $ `<file>/EEG/ERPWindow_prefs.h`/
29 #include "Prefs_copyToInstance.h"cxx . . $ `<file>/sys/Prefs_copyToInstance.h`/
30 #include "ERPWindow_prefs.h"cxx . . $ `<file>/EEG/ERPWindow_prefs.h`/
31
32 typedef structcxx . . $ $anonymous_type_5480f23b432bd984_0# { int inclinationcxx . . $ $anonymous_type_5480f23b432bd984_0#inclination., azimuthcxx . . $ $anonymous_type_5480f23b432bd984_0#azimuth.; double topXcxx . . $ $anonymous_type_5480f23b432bd984_0#topX., topYcxx . . $ $anonymous_type_5480f23b432bd984_0#topY.; } BiosemiLocationDatacxx . . $ BiosemiLocationData#;
33
34 static BiosemiLocationDatacxx . . $ BiosemiLocationData# biosemiCapCoordinates64cxx . . $ biosemiCapCoordinates64. [1+64] =
35 {
36 /*
37 * BioSemi says:
38 * "Spherical coordinates in degrees,
39 * by inclination (from Cz, pos is right hemisphere, neg is left hemisphere),
40 * and azimuth (from T7 for left hemisphere, and from T8 for the right hemisphere, pos is anti-clockwise, neg is clockwise)"
41 */
42 {0,0,0.0,0.0},
43 { -92, -72, 0.0, 0.0 }, // 1 Fp1
44 { -92, -54, 0.0, 0.0 }, // 2 AF7
45 { -74, -65, 0.0, 0.0 }, // 3 AF3
46 { -50, -68, 0.0, 0.0 }, // 4 F1
47 { -60, -51, 0.0, 0.0 }, // 5 F3
48 { -75, -41, 0.0, 0.0 }, // 6 F5
49 { -92, -36, 0.0, 0.0 }, // 7 F7
50 { -92, -18, 0.0, 0.0 }, // 8 FT7
51 { -72, -21, 0.0, 0.0 }, // 9 FC5
52 { -50, -28, 0.0, 0.0 }, // 10 FC3
53 { -32, -45, 0.0, 0.0 }, // 11 FC1
54 { -23, 0, 0.0, 0.0 }, // 12 C1
55 { -46, 0, 0.0, 0.0 }, // 13 C3
56 { -69, 0, 0.0, 0.0 }, // 14 C5
57 { -92, 0, 0.0, 0.0 }, // 15 T7
58 { -92, 18, 0.0, 0.0 }, // 16 TP7
59 { -72, 21, 0.0, 0.0 }, // 17 CP5
60 { -50, 28, 0.0, 0.0 }, // 18 CP3
61 { -32, 45, 0.0, 0.0 }, // 19 CP1
62 { -50, 68, 0.0, 0.0 }, // 20 P1
63 { -60, 51, 0.0, 0.0 }, // 21 P3
64 { -75, 41, 0.0, 0.0 }, // 22 P5
65 { -92, 36, 0.0, 0.0 }, // 23 P7
66 {-115, 40, 0.0, 0.0 }, // 24 P9
67 { -92, 54, 0.0, 0.0 }, // 25 PO7
68 { -74, 65, 0.0, 0.0 }, // 26 PO3
69 { -92, 72, 0.0, 0.0 }, // 27 O1
70 { 115, -90, 0.0, 0.0 }, // 28 Iz
71 { 92, -90, 0.0, 0.0 }, // 29 Oz
72 { 69, -90, 0.0, 0.0 }, // 30 POz
73 { 46, -90, 0.0, 0.0 }, // 31 Pz
74 { 23, -90, 0.0, 0.0 }, // 32 CPz
75 { 92, 90, 0.0, 0.0 }, // 33 Fpz
76 { 92, 72, 0.0, 0.0 }, // 34 Fp2
77 { 92, 54, 0.0, 0.0 }, // 35 AF8
78 { 74, 65, 0.0, 0.0 }, // 36 AF4
79 { 69, 90, 0.0, 0.0 }, // 37 AFz
80 { 46, 90, 0.0, 0.0 }, // 38 Fz
81 { 50, 68, 0.0, 0.0 }, // 39 F2
82 { 60, 51, 0.0, 0.0 }, // 40 F4
83 { 75, 41, 0.0, 0.0 }, // 41 F6
84 { 92, 36, 0.0, 0.0 }, // 42 F8
85 { 92, 18, 0.0, 0.0 }, // 43 FT8
86 { 72, 21, 0.0, 0.0 }, // 44 FC6
87 { 50, 28, 0.0, 0.0 }, // 45 FC4
88 { 32, 45, 0.0, 0.0 }, // 46 FC2
89 { 23, 90, 0.0, 0.0 }, // 47 FCz
90 { 0, 0, 0.0, 0.0 }, // 48 Cz
91 { 23, 0, 0.0, 0.0 }, // 49 C2
92 { 46, 0, 0.0, 0.0 }, // 50 C4
93 { 69, 0, 0.0, 0.0 }, // 51 C6
94 { 92, 0, 0.0, 0.0 }, // 52 T8
95 { 92, -18, 0.0, 0.0 }, // 53 TP8
96 { 72, -21, 0.0, 0.0 }, // 54 CP6
97 { 50, -28, 0.0, 0.0 }, // 55 CP4
98 { 32, -45, 0.0, 0.0 }, // 56 CP2
99 { 50, -68, 0.0, 0.0 }, // 57 P2
100 { 60, -51, 0.0, 0.0 }, // 58 P4
101 { 75, -41, 0.0, 0.0 }, // 59 P6
102 { 92, -36, 0.0, 0.0 }, // 60 P8
103 { 115, -40, 0.0, 0.0 }, // 61 P10
104 { 92, -54, 0.0, 0.0 }, // 62 PO8
105 { 74, -65, 0.0, 0.0 }, // 63 PO4
106 { 92, -72, 0.0, 0.0 } // 64 O2
107 };
108
109 static BiosemiLocationDatacxx . . $ BiosemiLocationData# biosemiCapCoordinates32cxx . . $ biosemiCapCoordinates32. [1+32] =
110 {
111 /*
112 * BioSemi says:
113 * "Spherical coordinates in degrees,
114 * by inclination (from Cz, pos is right hemisphere, neg is left hemisphere),
115 * and azimuth (from T7 for left hemisphere, and from T8 for the right hemisphere, pos is anti-clockwise, neg is clockwise)"
116 */
117 {0,0,0.0,0.0},
118 { -92, -72, 0.0, 0.0 }, // 1 Fp1
119 { -74, -65, 0.0, 0.0 }, // 2 AF3
120 { -92, -36, 0.0, 0.0 }, // 3 F7
121 { -60, -51, 0.0, 0.0 }, // 4 F3
122 { -32, -45, 0.0, 0.0 }, // 5 FC1
123 { -72, -21, 0.0, 0.0 }, // 6 FC5
124 { -92, 0, 0.0, 0.0 }, // 7 T7
125 { -46, 0, 0.0, 0.0 }, // 8 C3
126 { -32, 45, 0.0, 0.0 }, // 9 CP1
127 { -72, 21, 0.0, 0.0 }, // 10 CP5
128 { -92, 36, 0.0, 0.0 }, // 11 P7
129 { -60, 51, 0.0, 0.0 }, // 12 P3
130 { 46, -90, 0.0, 0.0 }, // 13 Pz
131 { -74, 65, 0.0, 0.0 }, // 14 PO3
132 { -92, 72, 0.0, 0.0 }, // 15 O1
133 { 92, -90, 0.0, 0.0 }, // 16 Oz
134 { 92, -72, 0.0, 0.0 }, // 17 O2
135 { 74, -65, 0.0, 0.0 }, // 18 PO4
136 { 60, -51, 0.0, 0.0 }, // 19 P4
137 { 92, -36, 0.0, 0.0 }, // 20 P8
138 { 72, -21, 0.0, 0.0 }, // 21 CP6
139 { 32, -45, 0.0, 0.0 }, // 22 CP2
140 { 46, 0, 0.0, 0.0 }, // 23 C4
141 { 92, 0, 0.0, 0.0 }, // 24 T8
142 { 72, 21, 0.0, 0.0 }, // 25 FC6
143 { 32, 45, 0.0, 0.0 }, // 26 FC2
144 { 60, 51, 0.0, 0.0 }, // 27 F4
145 { 92, 36, 0.0, 0.0 }, // 28 F8
146 { 74, 65, 0.0, 0.0 }, // 29 AF4
147 { 92, 72, 0.0, 0.0 }, // 30 Fp2
148 { 46, 90, 0.0, 0.0 }, // 31 Fz
149 { 0, 0, 0.0, 0.0 }, // 32 Cz
150 };
151
152 void ERP_drawScalp_garnishcxx . . $ ERP_drawScalp_garnish(1c37556699496b9f). (Graphicscxx . . $ Graphics# graphics, double vmin, double vmax, enum kGraphics_colourScalecxx . . $ kGraphics_colourScale# colourScale) {
153 const integercxx . . $ integer# n = 201;
154 autoMATcxx . . $ autoMAT# legend = raw_MATcxx . . $ raw_MAT(3d09731056d2b97d). (n, 2);
155 for (integercxx . . $ integer# irow = 1; irow <= n; irow ++)
156 for (integercxx . . $ integer# icol = 1; icol <= 2; icol ++)
157 legend [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).irow] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).icol] = (irow - 1) / (n - 1.0);
158 Graphics_setColourScalecxx . . $ Graphics_setColourScale(9313785b08f1876c). (graphics, colourScale);
159 Graphics_imagecxx . . $ Graphics_image(a5d48eb8683d0521). (graphics, legendcxx . . $ constmatrixview#constmatrixview(c98a2930b9469e58)..allcxx . . $ automatrix#all(2114117ba8ed4224).(), 0.85, 0.98, -0.8, +0.8, 0.0, 1.0);
160 Graphics_setColourScalecxx . . $ Graphics_setColourScale(9313785b08f1876c). (graphics, kGraphics_colourScalecxx . . $ kGraphics_colourScale#::GREYcxx . . $ kGraphics_colourScale#GREY.);
161 Graphics_rectanglecxx . . $ Graphics_rectangle(72bdb7937dbb13da). (graphics, 0.85, 0.98, -0.8, +0.8);
162 Graphics_setTextAlignmentcxx . . $ Graphics_setTextAlignment(a697afee548943ae). (graphics, Graphics_RIGHTcxx . . $ `sys/Graphics.h:251:9`!, Graphics_TOPcxx . . $ `sys/Graphics.h:254:9`!);
163 Graphics_textcxx . . $ Graphics_text(bd267f534253e388). (graphics, 1.0, -0.8, vmin * 1e6, U" μV");
164 Graphics_setTextAlignmentcxx . . $ Graphics_setTextAlignment(a697afee548943ae). (graphics, Graphics_RIGHTcxx . . $ `sys/Graphics.h:251:9`!, Graphics_BOTTOMcxx . . $ `sys/Graphics.h:252:9`!);
165 Graphics_textcxx . . $ Graphics_text(bd267f534253e388). (graphics, 1.0, +0.8, vmax * 1e6, U" μV");
166 }
167
168 void ERP_drawScalpcxx . . $ ERP_drawScalp(ae719b9c6d91648c). (ERPcxx . . $ ERP# me, Graphicscxx . . $ Graphics# graphics, double tmin, double tmax, double vmin, double vmax, enum kGraphics_colourScalecxx . . $ kGraphics_colourScale# colourScale, bool garnish) {
169 Graphics_setInnercxx . . $ Graphics_setInner(2d838ed765120c5d). (graphics);
170 Graphics_setWindowcxx . . $ Graphics_setWindow(72bdb7937dbb13da). (graphics, -1.0, 1.0, -1.0, 1.0);
171 //Graphics_setGrey (graphics, 1.0);
172 //Graphics_fillRectangle (graphics, -1.1, 1.1, -1.01, 1.19);
173 //Graphics_setColour (graphics, Melder_BLACK);
174 const integercxx . . $ integer# numberOfDrawableChannels =
175 mycxx . . $ `melder/melder.h:44:9`! nycxx . . $ structSampledXY#ny. >= 64 && Melder_equcxx . . $ `melder/melder_str32.h:124:9`! (mycxx . . $ `melder/melder.h:44:9`! channelNamescxx . . $ structERP#channelNames. [cxx . . $ _autostringautovector#`operator[]`(f191be2b65019068).64].getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), U"O2") ? 64 :
176 mycxx . . $ `melder/melder.h:44:9`! nycxx . . $ structSampledXY#ny. >= 32 && Melder_equcxx . . $ `melder/melder_str32.h:124:9`! (mycxx . . $ `melder/melder.h:44:9`! channelNamescxx . . $ structERP#channelNames. [cxx . . $ _autostringautovector#`operator[]`(f191be2b65019068).32].getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), U"Cz") ? 32 :
177 0;
178 BiosemiLocationDatacxx . . $ BiosemiLocationData# *biosemiLocationData = numberOfDrawableChannels == 64 ? biosemiCapCoordinates64cxx . . $ biosemiCapCoordinates64. : numberOfDrawableChannels == 32 ? biosemiCapCoordinates32cxx . . $ biosemiCapCoordinates32. : 0;
179 for (integercxx . . $ integer# ichan = 1; ichan <= numberOfDrawableChannels; ichan ++) {
180 const double inclination = (double) biosemiLocationData [ichan]. inclinationcxx . . $ $anonymous_type_5480f23b432bd984_0#inclination.;
181 const double azimuth = (double) biosemiLocationData [ichan]. azimuthcxx . . $ $anonymous_type_5480f23b432bd984_0#azimuth.;
182 const bool rightHemisphere = ( inclination >= 0.0 );
183 const double r = fabscxx . . $ fabs(fee4f1d22bc8e617). (inclination / 115.0);
184 const double theta = rightHemisphere ? azimuth * (NUMpicxx . . $ NUMpi. / 180.0) : (azimuth + 180.0) * (NUMpicxx . . $ NUMpi. / 180.0);
185 biosemiLocationData [ichan]. topXcxx . . $ $anonymous_type_5480f23b432bd984_0#topX. = r * coscxx . . $ cos(fee4f1d22bc8e617). (theta);
186 biosemiLocationData [ichan]. topYcxx . . $ $anonymous_type_5480f23b432bd984_0#topY. = r * sincxx . . $ sin(fee4f1d22bc8e617). (theta);
187 }
188 const integercxx . . $ integer# n = 201;
189 const double d = 2.0 / (n - 1);
190 autoVECcxx . . $ autoVEC# mean = raw_VECcxx . . $ raw_VEC(e4395f764b859b1e). (numberOfDrawableChannels);
191 for (integercxx . . $ integer# ichan = 1; ichan <= numberOfDrawableChannels; ichan ++)
192 mean [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).ichan] = ( tmin == tmax ? Sampled_getValueAtXcxx . . $ Sampled_getValueAtX(a51129e8ab7e98e9). (me, tmin, ichan, 0, true) : Vector_getMeancxx . . $ Vector_getMean(8ea9441cb87dc78e). (me, tmin, tmax, ichan) );
193 autoMATcxx . . $ autoMAT# image = raw_MATcxx . . $ raw_MAT(3d09731056d2b97d). (n, n);
194 for (integercxx . . $ integer# irow = 1; irow <= n; irow ++) {
195 const double y = -1.0 + (irow - 1) * d;
196 for (integercxx . . $ integer# icol = 1; icol <= n; icol ++) {
197 const double x = -1.0 + (icol - 1) * d;
198 if (x * x + y * y <= 1.0) {
199 double value = undefinedcxx . . $ undefined.;
200 longdoublecxx . . $ longdouble# sum = 0.0, weight = 0.0;
201 for (integercxx . . $ integer# ichan = 1; ichan <= numberOfDrawableChannels; ichan ++) {
202 const double dx = x - biosemiLocationData [ichan]. topXcxx . . $ $anonymous_type_5480f23b432bd984_0#topX.;
203 const double dy = y - biosemiLocationData [ichan]. topYcxx . . $ $anonymous_type_5480f23b432bd984_0#topY.;
204 double distance = hypotcxx . . $ hypot(b71928d39fde4295). (dx, dy);
205 if (distance < 1e-12) {
206 value = mean [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).ichan];
207 break;
208 }
209 distance = distance * distance * distance * distance * distance * distance;
210 sum += mean [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).ichan] / distance;
211 weight += 1.0 / distance;
212 }
213 if (isundefcxx . . $ isundef(f8197d536af80c96). (value))
214 value = ( sum == 0.0 ? 0.0 : double (sum / weight) );
215 image [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).irow] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).icol] = value;
216 }
217 }
218 }
219 const double whiteValue = ( colourScale == kGraphics_colourScalecxx . . $ kGraphics_colourScale#::BLUE_TO_REDcxx . . $ kGraphics_colourScale#BLUE_TO_RED. ? 0.5 * (vmin + vmax) : vmin );
220 Graphics_setColourScalecxx . . $ Graphics_setColourScale(9313785b08f1876c). (graphics, colourScale);
221 for (integercxx . . $ integer# irow = 1; irow <= n; irow ++) {
222 const double y = -1.0 + (irow - 1) * d;
223 for (integercxx . . $ integer# icol = 1; icol <= n; icol ++) {
224 const double x = -1.0 + (icol - 1) * d;
225 if (x * x + y * y > 1.0)
226 image [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).irow] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).icol] = whiteValue;
227 }
228 }
229 Graphics_imagecxx . . $ Graphics_image(a5d48eb8683d0521). (graphics, imagecxx . . $ constmatrixview#constmatrixview(c98a2930b9469e58)..allcxx . . $ automatrix#all(2114117ba8ed4224).(), -1.0-0.5/n, 1.0+0.5/n, -1.0-0.5/n, 1.0+0.5/n, vmin, vmax);
230 Graphics_setColourScalecxx . . $ Graphics_setColourScale(9313785b08f1876c). (graphics, kGraphics_colourScalecxx . . $ kGraphics_colourScale#::GREYcxx . . $ kGraphics_colourScale#GREY.);
231 Graphics_setLineWidthcxx . . $ Graphics_setLineWidth(2514a1c07b6be5e2). (graphics, 2.0);
232 /*
233 Nose.
234 */
235 Graphics_setGreycxx . . $ Graphics_setGrey(2514a1c07b6be5e2). (graphics, colourScale == kGraphics_colourScalecxx . . $ kGraphics_colourScale#::BLUE_TO_REDcxx . . $ kGraphics_colourScale#BLUE_TO_RED. ? 1.0 : 0.5);
236 {// scope
237 const double x [3] = { -0.08, 0.0, 0.08 }, y [3] = { 0.99, 1.18, 0.99 };
238 Graphics_fillAreacxx . . $ Graphics_fillArea(23a712ce109b96e0). (graphics, 3, x, y);
239 }
240 Graphics_setColourcxx . . $ Graphics_setColour(eb47b9513d3f4721). (graphics, Melder_BLACKcxx . . $ Melder_BLACK.);
241 Graphics_linecxx . . $ Graphics_line(72bdb7937dbb13da). (graphics, -0.08, 0.99, 0.0, 1.18);
242 Graphics_linecxx . . $ Graphics_line(72bdb7937dbb13da). (graphics, 0.08, 0.99, 0.0, 1.18);
243 /*
244 Ears.
245 */
246 Graphics_setGreycxx . . $ Graphics_setGrey(2514a1c07b6be5e2). (graphics, colourScale == kGraphics_colourScalecxx . . $ kGraphics_colourScale#::BLUE_TO_REDcxx . . $ kGraphics_colourScale#BLUE_TO_RED. ? 1.0 : 0.5);
247 Graphics_fillRectanglecxx . . $ Graphics_fillRectangle(72bdb7937dbb13da). (graphics, -1.09, -1.00, -0.08, 0.08);
248 Graphics_fillRectanglecxx . . $ Graphics_fillRectangle(72bdb7937dbb13da). (graphics, 1.09, 1.00, -0.08, 0.08);
249 Graphics_setColourcxx . . $ Graphics_setColour(eb47b9513d3f4721). (graphics, Melder_BLACKcxx . . $ Melder_BLACK.);
250 Graphics_linecxx . . $ Graphics_line(72bdb7937dbb13da). (graphics, -0.99, 0.08, -1.09, 0.08);
251 Graphics_linecxx . . $ Graphics_line(72bdb7937dbb13da). (graphics, -1.09, 0.08, -1.09, -0.08);
252 Graphics_linecxx . . $ Graphics_line(72bdb7937dbb13da). (graphics, -1.09, -0.08, -0.99, -0.08);
253 Graphics_linecxx . . $ Graphics_line(72bdb7937dbb13da). (graphics, 0.99, 0.08, 1.09, 0.08);
254 Graphics_linecxx . . $ Graphics_line(72bdb7937dbb13da). (graphics, 1.09, 0.08, 1.09, -0.08);
255 Graphics_linecxx . . $ Graphics_line(72bdb7937dbb13da). (graphics, 1.09, -0.08, 0.99, -0.08);
256 /*
257 Scalp.
258 */
259 Graphics_ellipsecxx . . $ Graphics_ellipse(72bdb7937dbb13da). (graphics, -1.0, 1.0, -1.0, 1.0);
260 Graphics_setLineWidthcxx . . $ Graphics_setLineWidth(2514a1c07b6be5e2). (graphics, 1.0);
261 Graphics_unsetInnercxx . . $ Graphics_unsetInner(2d838ed765120c5d). (graphics);
262 if (garnish)
263 ERP_drawScalp_garnishcxx . . $ ERP_drawScalp_garnish(1c37556699496b9f). (graphics, vmin, vmax, colourScale);
264 }
265
266 void structERPWindowcxx . . $ structERPWindow# :: v_drawSelectionViewercxx . . $ structERPWindow#v_drawSelectionViewer(49f6e7a06ebc5aa8). () {
267 Graphics_setWindowcxx . . $ Graphics_setWindow(72bdb7937dbb13da). (ourcxx . . $ `melder/melder.h:42:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), -1.1, 1.1, -1.01, 1.19);
268 Graphics_setColourcxx . . $ Graphics_setColour(eb47b9513d3f4721). (ourcxx . . $ `melder/melder.h:42:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), DataGuiColour_WINDOW_BACKGROUNDcxx . . $ DataGuiColour_WINDOW_BACKGROUND.);
269 Graphics_fillRectanglecxx . . $ Graphics_fillRectangle(72bdb7937dbb13da). (ourcxx . . $ `melder/melder.h:42:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), -1.1, 1.1, -1.01, 1.19);
270 Graphics_setColourcxx . . $ Graphics_setColour(eb47b9513d3f4721). (ourcxx . . $ `melder/melder.h:42:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), Melder_BLACKcxx . . $ Melder_BLACK.);
271 const integercxx . . $ integer# numberOfDrawableChannels =
272 ourcxx . . $ `melder/melder.h:42:9`! erpAreacxx . . $ structERPWindow#erpArea(d424a740f0a6ece4).() ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). erpcxx . . $ structERPArea#erp(9afc7055f457e078).() -> nycxx . . $ structSampledXY#ny. >= 64 && Melder_equcxx . . $ `melder/melder_str32.h:124:9`! (ourcxx . . $ `melder/melder.h:42:9`! erpAreacxx . . $ structERPWindow#erpArea(d424a740f0a6ece4).() ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). erpcxx . . $ structERPArea#erp(9afc7055f457e078).() -> channelNamescxx . . $ structERP#channelNames. [cxx . . $ _autostringautovector#`operator[]`(f191be2b65019068).64].getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), U"O2") ? 64 :
273 ourcxx . . $ `melder/melder.h:42:9`! erpAreacxx . . $ structERPWindow#erpArea(d424a740f0a6ece4).() ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). erpcxx . . $ structERPArea#erp(9afc7055f457e078).() -> nycxx . . $ structSampledXY#ny. >= 32 && Melder_equcxx . . $ `melder/melder_str32.h:124:9`! (ourcxx . . $ `melder/melder.h:42:9`! erpAreacxx . . $ structERPWindow#erpArea(d424a740f0a6ece4).() ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). erpcxx . . $ structERPArea#erp(9afc7055f457e078).() -> channelNamescxx . . $ structERP#channelNames. [cxx . . $ _autostringautovector#`operator[]`(f191be2b65019068).32].getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), U"Cz") ? 32 :
274 0;
275 BiosemiLocationDatacxx . . $ BiosemiLocationData# *biosemiLocationData = numberOfDrawableChannels == 64 ? biosemiCapCoordinates64cxx . . $ biosemiCapCoordinates64. : numberOfDrawableChannels == 32 ? biosemiCapCoordinates32cxx . . $ biosemiCapCoordinates32. : 0;
276 for (integercxx . . $ integer# ichan = 1; ichan <= numberOfDrawableChannels; ichan ++) {
277 const double inclination = (double) biosemiLocationData [ichan]. inclinationcxx . . $ $anonymous_type_5480f23b432bd984_0#inclination.;
278 const double azimuth = (double) biosemiLocationData [ichan]. azimuthcxx . . $ $anonymous_type_5480f23b432bd984_0#azimuth.;
279 const bool rightHemisphere = inclination >= 0.0;
280 const double r = fabscxx . . $ fabs(fee4f1d22bc8e617). (inclination / 115.0);
281 const double theta = rightHemisphere ? azimuth * (NUMpicxx . . $ NUMpi. / 180.0) : (azimuth + 180.0) * (NUMpicxx . . $ NUMpi. / 180.0);
282 biosemiLocationData [ichan]. topXcxx . . $ $anonymous_type_5480f23b432bd984_0#topX. = r * coscxx . . $ cos(fee4f1d22bc8e617). (theta);
283 biosemiLocationData [ichan]. topYcxx . . $ $anonymous_type_5480f23b432bd984_0#topY. = r * sincxx . . $ sin(fee4f1d22bc8e617). (theta);
284 }
285 const integercxx . . $ integer# n = 201;
286 const double d = 2.0 / (n - 1);
287 autoVECcxx . . $ autoVEC# means = raw_VECcxx . . $ raw_VEC(e4395f764b859b1e). (numberOfDrawableChannels);
288 for (integercxx . . $ integer# ichan = 1; ichan <= numberOfDrawableChannels; ichan ++)
289 means [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).ichan] =
290 ourcxx . . $ `melder/melder.h:42:9`! startSelectioncxx . . $ structFunctionEditor#startSelection. == ourcxx . . $ `melder/melder.h:42:9`! endSelectioncxx . . $ structFunctionEditor#endSelection. ?
291 Sampled_getValueAtXcxx . . $ Sampled_getValueAtX(a51129e8ab7e98e9). (ourcxx . . $ `melder/melder.h:42:9`! erpAreacxx . . $ structERPWindow#erpArea(d424a740f0a6ece4).() ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). erpcxx . . $ structERPArea#erp(9afc7055f457e078).(), ourcxx . . $ `melder/melder.h:42:9`! startSelectioncxx . . $ structFunctionEditor#startSelection., ichan, 0, true) :
292 Vector_getMeancxx . . $ Vector_getMean(8ea9441cb87dc78e). (ourcxx . . $ `melder/melder.h:42:9`! erpAreacxx . . $ structERPWindow#erpArea(d424a740f0a6ece4).() ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). erpcxx . . $ structERPArea#erp(9afc7055f457e078).(), ourcxx . . $ `melder/melder.h:42:9`! startSelectioncxx . . $ structFunctionEditor#startSelection., ourcxx . . $ `melder/melder.h:42:9`! endSelectioncxx . . $ structFunctionEditor#endSelection., ichan);
293 autoMATcxx . . $ autoMAT# image = zero_MATcxx . . $ zero_MAT(3d09731056d2b97d). (n, n);
294 for (integercxx . . $ integer# irow = 1; irow <= n; irow ++) {
295 const double y = -1.0 + (irow - 1) * d;
296 for (integercxx . . $ integer# icol = 1; icol <= n; icol ++) {
297 const double x = -1.0 + (icol - 1) * d;
298 if (x * x + y * y <= 1.0) {
299 double value = undefinedcxx . . $ undefined.;
300 longdoublecxx . . $ longdouble# sum = 0.0, weight = 0.0;
301 for (integercxx . . $ integer# ichan = 1; ichan <= numberOfDrawableChannels; ichan ++) {
302 const double dx = x - biosemiLocationData [ichan]. topXcxx . . $ $anonymous_type_5480f23b432bd984_0#topX.;
303 const double dy = y - biosemiLocationData [ichan]. topYcxx . . $ $anonymous_type_5480f23b432bd984_0#topY.;
304 double distance = sqrtcxx . . $ sqrt(fee4f1d22bc8e617). (dx * dx + dy * dy);
305 if (distance < 1e-12) {
306 value = means [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).ichan];
307 break;
308 }
309 distance = distance * distance * distance * distance * distance * distance;
310 sum += means [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).ichan] / distance;
311 weight += 1.0 / distance;
312 }
313 if (isundefcxx . . $ isundef(f8197d536af80c96). (value))
314 value = ( sum == 0.0 ? 0.0 : double (sum / weight) );
315 image [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).irow] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).icol] = value;
316 }
317 }
318 }
319 double minimum = 0.0, maximum = 0.0;
320 for (integercxx . . $ integer# irow = 1; irow <= n; irow ++) {
321 for (integercxx . . $ integer# icol = 1; icol <= n; icol ++) {
322 const double value = image [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).irow] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).icol];
323 if (value < minimum) minimum = value;
324 else if (value > maximum) maximum = value;
325 }
326 }
327 const double absoluteExtremum = stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a). (- minimum, maximum);
328 if (ourcxx . . $ `melder/melder.h:42:9`! erpAreacxx . . $ structERPWindow#erpArea(d424a740f0a6ece4).() ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). instancePref_scalingStrategycxx . . $ structSoundArea#instancePref_scalingStrategy(f3f743233d8ac2b4).() == kSoundArea_scalingStrategycxx . . $ kSoundArea_scalingStrategy#::FIXED_RANGEcxx . . $ kSoundArea_scalingStrategy#FIXED_RANGE.) {
329 minimum = ourcxx . . $ `melder/melder.h:42:9`! erpAreacxx . . $ structERPWindow#erpArea(d424a740f0a6ece4).() ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). instancePref_scaling_minimumcxx . . $ structSoundArea#instancePref_scaling_minimum(21b6c25e127938e2).();
330 maximum = ourcxx . . $ `melder/melder.h:42:9`! erpAreacxx . . $ structERPWindow#erpArea(d424a740f0a6ece4).() ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). instancePref_scaling_maximumcxx . . $ structSoundArea#instancePref_scaling_maximum(21b6c25e127938e2).();
331 } else if (ourcxx . . $ `melder/melder.h:42:9`! erpAreacxx . . $ structERPWindow#erpArea(d424a740f0a6ece4).() ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). instancePref_scalingStrategycxx . . $ structSoundArea#instancePref_scalingStrategy(f3f743233d8ac2b4).() == kSoundArea_scalingStrategycxx . . $ kSoundArea_scalingStrategy#::FIXED_HEIGHTcxx . . $ kSoundArea_scalingStrategy#FIXED_HEIGHT.) {
332 const double mean = 0.5 * (minimum + maximum);
333 minimum = mean - 0.5 * ourcxx . . $ `melder/melder.h:42:9`! erpAreacxx . . $ structERPWindow#erpArea(d424a740f0a6ece4).() ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). instancePref_scaling_heightcxx . . $ structSoundArea#instancePref_scaling_height(21b6c25e127938e2).();
334 maximum = mean + 0.5 * ourcxx . . $ `melder/melder.h:42:9`! erpAreacxx . . $ structERPWindow#erpArea(d424a740f0a6ece4).() ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). instancePref_scaling_heightcxx . . $ structSoundArea#instancePref_scaling_height(21b6c25e127938e2).();
335 } else {
336 minimum = - absoluteExtremum;
337 maximum = absoluteExtremum;
338 }
339 for (integercxx . . $ integer# irow = 1; irow <= n; irow ++) {
340 const double y = -1.0 + (irow - 1) * d;
341 for (integercxx . . $ integer# icol = 1; icol <= n; icol ++) {
342 const double x = -1.0 + (icol - 1) * d;
343 if (x * x + y * y > 1.0) {
344 image [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).irow] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).icol] = minimum +
345 ( ourcxx . . $ `melder/melder.h:42:9`! instancePref_scalp_colourScalecxx . . $ structERPWindow#instancePref_scalp_colourScale(ec346a6e5daf36b8).() == kGraphics_colourScalecxx . . $ kGraphics_colourScale#::BLUE_TO_REDcxx . . $ kGraphics_colourScale#BLUE_TO_RED. ? 0.46 : 0.1875 ) * (maximum - minimum);
346 // -0.625 * absoluteExtremum;
347 }
348 }
349 }
350 Graphics_setColourScalecxx . . $ Graphics_setColourScale(9313785b08f1876c). (ourcxx . . $ `melder/melder.h:42:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), ourcxx . . $ `melder/melder.h:42:9`! instancePref_scalp_colourScalecxx . . $ structERPWindow#instancePref_scalp_colourScale(ec346a6e5daf36b8).());
351 Graphics_imagecxx . . $ Graphics_image(a5d48eb8683d0521). (ourcxx . . $ `melder/melder.h:42:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), imagecxx . . $ constmatrixview#constmatrixview(c98a2930b9469e58)..allcxx . . $ automatrix#all(2114117ba8ed4224).(), -1.0-0.5/n, 1.0+0.5/n, -1.0-0.5/n, 1.0+0.5/n, minimum, maximum);
352 Graphics_setColourScalecxx . . $ Graphics_setColourScale(9313785b08f1876c). (ourcxx . . $ `melder/melder.h:42:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), kGraphics_colourScalecxx . . $ kGraphics_colourScale#::GREYcxx . . $ kGraphics_colourScale#GREY.);
353 Graphics_setLineWidthcxx . . $ Graphics_setLineWidth(2514a1c07b6be5e2). (ourcxx . . $ `melder/melder.h:42:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), 2.0);
354 /*
355 Nose.
356 */
357 Graphics_setGreycxx . . $ Graphics_setGrey(2514a1c07b6be5e2). (ourcxx . . $ `melder/melder.h:42:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), ourcxx . . $ `melder/melder.h:42:9`! instancePref_scalp_colourScalecxx . . $ structERPWindow#instancePref_scalp_colourScale(ec346a6e5daf36b8).() == kGraphics_colourScalecxx . . $ kGraphics_colourScale#::BLUE_TO_REDcxx . . $ kGraphics_colourScale#BLUE_TO_RED. ? 1.0 : 0.5);
358 {// scope
359 const double x [3] = { -0.08, 0.0, 0.08 }, y [3] = { 0.99, 1.18, 0.99 };
360 Graphics_fillAreacxx . . $ Graphics_fillArea(23a712ce109b96e0). (ourcxx . . $ `melder/melder.h:42:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), 3, x, y);
361 }
362 Graphics_setColourcxx . . $ Graphics_setColour(eb47b9513d3f4721). (ourcxx . . $ `melder/melder.h:42:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), Melder_BLACKcxx . . $ Melder_BLACK.);
363 Graphics_linecxx . . $ Graphics_line(72bdb7937dbb13da). (ourcxx . . $ `melder/melder.h:42:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), -0.08, 0.99, 0.0, 1.18);
364 Graphics_linecxx . . $ Graphics_line(72bdb7937dbb13da). (ourcxx . . $ `melder/melder.h:42:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), 0.08, 0.99, 0.0, 1.18);
365 /*
366 Ears.
367 */
368 Graphics_setGreycxx . . $ Graphics_setGrey(2514a1c07b6be5e2). (ourcxx . . $ `melder/melder.h:42:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), ourcxx . . $ `melder/melder.h:42:9`! instancePref_scalp_colourScalecxx . . $ structERPWindow#instancePref_scalp_colourScale(ec346a6e5daf36b8).() == kGraphics_colourScalecxx . . $ kGraphics_colourScale#::BLUE_TO_REDcxx . . $ kGraphics_colourScale#BLUE_TO_RED. ? 1.0 : 0.5);
369 Graphics_fillRectanglecxx . . $ Graphics_fillRectangle(72bdb7937dbb13da). (ourcxx . . $ `melder/melder.h:42:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), -1.09, -1.00, -0.08, 0.08);
370 Graphics_fillRectanglecxx . . $ Graphics_fillRectangle(72bdb7937dbb13da). (ourcxx . . $ `melder/melder.h:42:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), 1.09, 1.00, -0.08, 0.08);
371 Graphics_setColourcxx . . $ Graphics_setColour(eb47b9513d3f4721). (ourcxx . . $ `melder/melder.h:42:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), Melder_BLACKcxx . . $ Melder_BLACK.);
372 Graphics_linecxx . . $ Graphics_line(72bdb7937dbb13da). (ourcxx . . $ `melder/melder.h:42:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), -0.99, 0.08, -1.09, 0.08);
373 Graphics_linecxx . . $ Graphics_line(72bdb7937dbb13da). (ourcxx . . $ `melder/melder.h:42:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), -1.09, 0.08, -1.09, -0.08);
374 Graphics_linecxx . . $ Graphics_line(72bdb7937dbb13da). (ourcxx . . $ `melder/melder.h:42:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), -1.09, -0.08, -0.99, -0.08);
375 Graphics_linecxx . . $ Graphics_line(72bdb7937dbb13da). (ourcxx . . $ `melder/melder.h:42:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), 0.99, 0.08, 1.09, 0.08);
376 Graphics_linecxx . . $ Graphics_line(72bdb7937dbb13da). (ourcxx . . $ `melder/melder.h:42:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), 1.09, 0.08, 1.09, -0.08);
377 Graphics_linecxx . . $ Graphics_line(72bdb7937dbb13da). (ourcxx . . $ `melder/melder.h:42:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), 1.09, -0.08, 0.99, -0.08);
378 /*
379 Scalp.
380 */
381 Graphics_ellipsecxx . . $ Graphics_ellipse(72bdb7937dbb13da). (ourcxx . . $ `melder/melder.h:42:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), -1.0, 1.0, -1.0, 1.0);
382 Graphics_setLineWidthcxx . . $ Graphics_setLineWidth(2514a1c07b6be5e2). (ourcxx . . $ `melder/melder.h:42:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), 1.0);
383 }
384
385 OPTIONMENU_ENUM_VARIABLEcxx . . $ `sys/EditorM.h:411:9`! (kGraphics_colourScale, v_prefs__scalpColourSpace)
386 void structERPWindowcxx . . $ structERPWindow# :: v_prefs_addFieldscxx . . $ structERPWindow#v_prefs_addFields(2b98fae8e13abb61). (EditorCommandcxx . . $ EditorCommand# cmd) {
387 OPTIONMENU_ENUM_FIELDcxx . . $ `sys/EditorM.h:414:9`! (kGraphics_colourScale, v_prefs__scalpColourSpace,
388 U"Scalp colour space", kGraphics_colourScale::BLUE_TO_RED)
389 }
390 void structERPWindowcxx . . $ structERPWindow# :: v_prefs_setValuescxx . . $ structERPWindow#v_prefs_setValues(2b98fae8e13abb61). (EditorCommandcxx . . $ EditorCommand# cmd) {
391 SET_ENUMcxx . . $ `sys/EditorM.h:480:9`! (v_prefs__scalpColourSpace, kGraphics_colourScale, instancePref_scalp_colourScale())
392 }
393 void structERPWindowcxx . . $ structERPWindow# :: v_prefs_getValuescxx . . $ structERPWindow#v_prefs_getValues(2b98fae8e13abb61). (EditorCommandcxx . . $ EditorCommand# /* cmd */) {
394 setInstancePref_scalp_colourScalecxx . . $ structERPWindow#setInstancePref_scalp_colourScale(a34fae3877e9d632). (v_prefs__scalpColourSpacecxx . . $ v_prefs__scalpColourSpace.);
395 }
396
397 autoERPWindowcxx . . $ autoERPWindow# ERPWindow_createcxx . . $ ERPWindow_create(f164d1809ae14a04). (conststring32cxx . . $ conststring32# title, ERPcxx . . $ ERP# erp) {
398 Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (erp);
399 try {
400 autoERPWindowcxx . . $ autoERPWindow# me = Thing_newcxx . . $ `sys/Thing.h:514:9`! (ERPWindow);
401 mycxx . . $ `melder/melder.h:44:9`! erpAreacxx . . $ structERPWindow#erpArea(d424a740f0a6ece4).() =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). ERPArea_createcxx . . $ ERPArea_create(3c76345f7c0fe46). (true, nullptr, me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).());
402 FunctionEditor_initcxx . . $ FunctionEditor_init(719bc58b4917372e). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), title, erp);
403 return mecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).;
404 } catch (MelderErrorcxx . . $ MelderError#) {
405 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"ERP window not created.");
406 }
407 }
408
409 /* End of file ERPWindow.cpp */