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);
258 return QQuaternion::fromAxisAndAngle(0, 0, 1, 180);
262 return QQuaternion::fromAxisAndAngle(0, 1, 0, 180)
263 * QQuaternion::fromAxisAndAngle(0, 0, 1, 180)
264 * QQuaternion::fromAxisAndAngle(1, 0, 0, 90)
265 * QQuaternion::fromAxisAndAngle(0, 0, 1, 180);
267 return QQuaternion::fromAxisAndAngle(1, 0, 0, 90)
268 * QQuaternion::fromAxisAndAngle(0, 1, 0, -90);
270 return QQuaternion::fromAxisAndAngle(1, 0, 0, 180)
271 * QQuaternion::fromAxisAndAngle(0, 0, 1, 180);
273 return QQuaternion::fromAxisAndAngle(1, 0, 0, 90);
275 return QQuaternion::fromAxisAndAngle(1, 0, 0, 90)
276 * QQuaternion::fromAxisAndAngle(0, 1, 0, 90);
278 return QQuaternion::fromAxisAndAngle(0, 0, 1, 180);
363 double x = 2.0 * v - 1.0;
364 x = std::clamp(x, -1.0, 1.0);
366 static constexpr int N = 7;
367 static const double pos[N] = { -1.0, -0.90, -0.30, 0.0, 0.30, 0.90, 1.0 };
368 static const double rr[N] = { 0.0, 0.0, 0.5, 0.5, 0.5, 1.0, 1.0 };
369 static const double gg[N] = { 1.0, 0.0, 0.5, 0.5, 0.5, 0.0, 1.0 };
370 static const double bb[N] = { 1.0, 1.0, 0.5, 0.5, 0.5, 0.0, 0.0 };
373 for (
int i = 0; i < N - 1; ++i) {
374 if (x >= pos[i] && x <= pos[i + 1]) {
379 if (x > pos[N - 1]) seg = N - 2;
381 double t = (pos[seg + 1] != pos[seg])
382 ? (x - pos[seg]) / (pos[seg + 1] - pos[seg])
384 t = std::clamp(t, 0.0, 1.0);
386 int r =
static_cast<int>(std::round((rr[seg] + t * (rr[seg + 1] - rr[seg])) * 255.0));
387 int g =
static_cast<int>(std::round((gg[seg] + t * (gg[seg + 1] - gg[seg])) * 255.0));
388 int b =
static_cast<int>(std::round((bb[seg] + t * (bb[seg + 1] - bb[seg])) * 255.0));
390 return qRgb(std::clamp(r, 0, 255), std::clamp(g, 0, 255), std::clamp(b, 0, 255));
398 const QQuaternion &fallbackRotation)
407 zoom = settings.value(prefix +
"zoom",
zoom).toFloat();
409 settings.value(prefix +
"panX",
pan.x()).toFloat(),
410 settings.value(prefix +
"panY",
pan.y()).toFloat());
411 preset = std::clamp(settings.value(prefix +
"preset",
preset).toInt(), 0, 6);
413 const bool hasQuat = settings.contains(prefix +
"perspRotW")
414 && settings.contains(prefix +
"perspRotX")
415 && settings.contains(prefix +
"perspRotY")
416 && settings.contains(prefix +
"perspRotZ");
418 const float w = settings.value(prefix +
"perspRotW", 1.0f).toFloat();
419 const float x = settings.value(prefix +
"perspRotX", 0.0f).toFloat();
420 const float y = settings.value(prefix +
"perspRotY", 0.0f).toFloat();
421 const float z = settings.value(prefix +
"perspRotZ", 0.0f).toFloat();
437 settings.setValue(prefix +
"surfaceType",
surfaceType);
444 settings.setValue(prefix +
"zoom",
zoom);
445 settings.setValue(prefix +
"panX",
pan.x());
446 settings.setValue(prefix +
"panY",
pan.y());
447 settings.setValue(prefix +
"preset",
preset);