140 settings.setValue(prefix +
"lh",
lh);
141 settings.setValue(prefix +
"rh",
rh);
142 settings.setValue(prefix +
"bemHead",
bemHead);
145 settings.setValue(prefix +
"sensMeg",
sensMeg);
146 settings.setValue(prefix +
"sensMegGrad",
sensMegGrad);
147 settings.setValue(prefix +
"sensMegMag",
sensMegMag);
149 settings.setValue(prefix +
"sensEeg",
sensEeg);
150 settings.setValue(prefix +
"dig",
dig);
151 settings.setValue(prefix +
"digCardinal",
digCardinal);
152 settings.setValue(prefix +
"digHpi",
digHpi);
153 settings.setValue(prefix +
"digEeg",
digEeg);
154 settings.setValue(prefix +
"digExtra",
digExtra);
155 settings.setValue(prefix +
"megFieldMap",
megFieldMap);
156 settings.setValue(prefix +
"eegFieldMap",
eegFieldMap);
159 settings.setValue(prefix +
"dipoles",
dipoles);
160 settings.setValue(prefix +
"sourceSpace",
sourceSpace);
161 settings.setValue(prefix +
"network",
network);
259 return QQuaternion::fromAxisAndAngle(0, 0, 1, 180);
263 return QQuaternion::fromAxisAndAngle(0, 1, 0, 180)
264 * QQuaternion::fromAxisAndAngle(0, 0, 1, 180)
265 * QQuaternion::fromAxisAndAngle(1, 0, 0, 90)
266 * QQuaternion::fromAxisAndAngle(0, 0, 1, 180);
268 return QQuaternion::fromAxisAndAngle(1, 0, 0, 90)
269 * QQuaternion::fromAxisAndAngle(0, 1, 0, -90);
271 return QQuaternion::fromAxisAndAngle(1, 0, 0, 180)
272 * QQuaternion::fromAxisAndAngle(0, 0, 1, 180);
274 return QQuaternion::fromAxisAndAngle(1, 0, 0, 90);
276 return QQuaternion::fromAxisAndAngle(1, 0, 0, 90)
277 * QQuaternion::fromAxisAndAngle(0, 1, 0, 90);
279 return QQuaternion::fromAxisAndAngle(0, 0, 1, 180);
365 double x = 2.0 * v - 1.0;
366 x = std::clamp(x, -1.0, 1.0);
368 static constexpr int N = 7;
369 static const double pos[N] = { -1.0, -0.90, -0.30, 0.0, 0.30, 0.90, 1.0 };
370 static const double rr[N] = { 0.0, 0.0, 0.5, 0.5, 0.5, 1.0, 1.0 };
371 static const double gg[N] = { 1.0, 0.0, 0.5, 0.5, 0.5, 0.0, 1.0 };
372 static const double bb[N] = { 1.0, 1.0, 0.5, 0.5, 0.5, 0.0, 0.0 };
375 for (
int i = 0; i < N - 1; ++i) {
376 if (x >= pos[i] && x <= pos[i + 1]) {
381 if (x > pos[N - 1]) seg = N - 2;
383 double t = (pos[seg + 1] != pos[seg])
384 ? (x - pos[seg]) / (pos[seg + 1] - pos[seg])
386 t = std::clamp(t, 0.0, 1.0);
388 int r =
static_cast<int>(std::round((rr[seg] + t * (rr[seg + 1] - rr[seg])) * 255.0));
389 int g =
static_cast<int>(std::round((gg[seg] + t * (gg[seg + 1] - gg[seg])) * 255.0));
390 int b =
static_cast<int>(std::round((bb[seg] + t * (bb[seg + 1] - bb[seg])) * 255.0));
392 return qRgb(std::clamp(r, 0, 255), std::clamp(g, 0, 255), std::clamp(b, 0, 255));
400 const QQuaternion &fallbackRotation)
409 zoom = settings.value(prefix +
"zoom",
zoom).toFloat();
411 settings.value(prefix +
"panX",
pan.x()).toFloat(),
412 settings.value(prefix +
"panY",
pan.y()).toFloat());
413 preset = std::clamp(settings.value(prefix +
"preset",
preset).toInt(), 0, 6);
415 const bool hasQuat = settings.contains(prefix +
"perspRotW")
416 && settings.contains(prefix +
"perspRotX")
417 && settings.contains(prefix +
"perspRotY")
418 && settings.contains(prefix +
"perspRotZ");
420 const float w = settings.value(prefix +
"perspRotW", 1.0f).toFloat();
421 const float x = settings.value(prefix +
"perspRotX", 0.0f).toFloat();
422 const float y = settings.value(prefix +
"perspRotY", 0.0f).toFloat();
423 const float z = settings.value(prefix +
"perspRotZ", 0.0f).toFloat();
439 settings.setValue(prefix +
"surfaceType",
surfaceType);
446 settings.setValue(prefix +
"zoom",
zoom);
447 settings.setValue(prefix +
"panX",
pan.x());
448 settings.setValue(prefix +
"panY",
pan.y());
449 settings.setValue(prefix +
"preset",
preset);