170 settings.setValue(prefix +
"lh",
lh);
171 settings.setValue(prefix +
"rh",
rh);
172 settings.setValue(prefix +
"bemHead",
bemHead);
175 settings.setValue(prefix +
"sensMeg",
sensMeg);
176 settings.setValue(prefix +
"sensMegGrad",
sensMegGrad);
177 settings.setValue(prefix +
"sensMegMag",
sensMegMag);
179 settings.setValue(prefix +
"sensEeg",
sensEeg);
180 settings.setValue(prefix +
"dig",
dig);
181 settings.setValue(prefix +
"digCardinal",
digCardinal);
182 settings.setValue(prefix +
"digHpi",
digHpi);
183 settings.setValue(prefix +
"digEeg",
digEeg);
184 settings.setValue(prefix +
"digExtra",
digExtra);
185 settings.setValue(prefix +
"megFieldMap",
megFieldMap);
186 settings.setValue(prefix +
"eegFieldMap",
eegFieldMap);
189 settings.setValue(prefix +
"dipoles",
dipoles);
190 settings.setValue(prefix +
"sourceSpace",
sourceSpace);
191 settings.setValue(prefix +
"network",
network);
193 settings.setValue(prefix +
"mriSlices",
mriSlices);
329 return QQuaternion::fromAxisAndAngle(0, 0, 1, 180);
333 return QQuaternion::fromAxisAndAngle(0, 1, 0, 180) * QQuaternion::fromAxisAndAngle(0, 0, 1, 180) * QQuaternion::fromAxisAndAngle(1, 0, 0, 90) * QQuaternion::fromAxisAndAngle(0, 0, 1, 180);
335 return QQuaternion::fromAxisAndAngle(1, 0, 0, 90) * QQuaternion::fromAxisAndAngle(0, 1, 0, -90);
337 return QQuaternion::fromAxisAndAngle(1, 0, 0, 180) * QQuaternion::fromAxisAndAngle(0, 0, 1, 180);
339 return QQuaternion::fromAxisAndAngle(1, 0, 0, 90);
341 return QQuaternion::fromAxisAndAngle(1, 0, 0, 90) * QQuaternion::fromAxisAndAngle(0, 1, 0, 90);
343 return QQuaternion::fromAxisAndAngle(0, 0, 1, 180);
440 double x = 2.0 * v - 1.0;
441 x = std::clamp(x, -1.0, 1.0);
443 static constexpr int N = 7;
444 static const double pos[N] = {-1.0, -0.90, -0.30, 0.0, 0.30, 0.90, 1.0};
445 static const double rr[N] = {0.0, 0.0, 0.5, 0.5, 0.5, 1.0, 1.0};
446 static const double gg[N] = {1.0, 0.0, 0.5, 0.5, 0.5, 0.0, 1.0};
447 static const double bb[N] = {1.0, 1.0, 0.5, 0.5, 0.5, 0.0, 0.0};
450 for (
int i = 0; i < N - 1; ++i) {
451 if (x >= pos[i] && x <= pos[i + 1]) {
459 double t = (pos[seg + 1] != pos[seg])
460 ? (x - pos[seg]) / (pos[seg + 1] - pos[seg])
462 t = std::clamp(t, 0.0, 1.0);
464 int r =
static_cast<int>(std::round((rr[seg] + t * (rr[seg + 1] - rr[seg])) * 255.0));
465 int g =
static_cast<int>(std::round((gg[seg] + t * (gg[seg + 1] - gg[seg])) * 255.0));
466 int b =
static_cast<int>(std::round((bb[seg] + t * (bb[seg + 1] - bb[seg])) * 255.0));
468 return qRgb(std::clamp(r, 0, 255), std::clamp(g, 0, 255), std::clamp(b, 0, 255));
476 const QQuaternion& fallbackRotation)
485 zoom = settings.value(prefix +
"zoom",
zoom).toFloat();
487 settings.value(prefix +
"panX",
pan.x()).toFloat(),
488 settings.value(prefix +
"panY",
pan.y()).toFloat());
489 preset = std::clamp(settings.value(prefix +
"preset",
preset).toInt(), 0, 6);
491 const bool hasQuat = settings.contains(prefix +
"perspRotW") && settings.contains(prefix +
"perspRotX") && settings.contains(prefix +
"perspRotY") && settings.contains(prefix +
"perspRotZ");
493 const float w = settings.value(prefix +
"perspRotW", 1.0f).toFloat();
494 const float x = settings.value(prefix +
"perspRotX", 0.0f).toFloat();
495 const float y = settings.value(prefix +
"perspRotY", 0.0f).toFloat();
496 const float z = settings.value(prefix +
"perspRotZ", 0.0f).toFloat();
512 settings.setValue(prefix +
"surfaceType",
surfaceType);
519 settings.setValue(prefix +
"zoom",
zoom);
520 settings.setValue(prefix +
"panX",
pan.x());
521 settings.setValue(prefix +
"panY",
pan.y());
522 settings.setValue(prefix +
"preset",
preset);