Skip to main content

SceneLayer

Namespace: DISP3DLIB  ·  Library: 3D Display Library

#include <disp3D/multimodalscene.h>

struct DISP3DLIB::SceneLayer

Opaque, type-erased handle to a layer payload.

The payload is owned by the caller (e.g. the plugin that loaded the data) and supplied as a std::shared_ptr<void> so the scene neither owns nor inspects it. The scene only needs the DISP3DLIB::SceneLayer::kind "kind", the id, and the generic visibility / opacity flags to drive draw order; the renderer downcasts the payload by DISP3DLIB::SceneLayer::kind "kind".

This indirection keeps disp3D/scene/ free of QRhi includes and means new renderables (sEEG, ECoG, future fNIRS optodes, …) plug in without touching this header.

src/examples/ex_disp3d_scene/main.cpp
MultimodalScene scene;
scene.registerBoundsFn(SceneLayerKind::Electrode, [](const SceneLayer& layer, QVector3D& bbMin, QVector3D& bbMax) {
const auto* object = static_cast<const ElectrodeObject*>(layer.payload.get());
const Eigen::MatrixX3f positions = object->implantation().positions();
const Eigen::Vector3f lo = positions.colwise().minCoeff().transpose();
const Eigen::Vector3f hi = positions.colwise().maxCoeff().transpose();
bbMin = QVector3D(lo.x(), lo.y(), lo.z());
bbMax = QVector3D(hi.x(), hi.y(), hi.z());
return true;
});
SceneLayer layer;
layer.id = "seeg_LH";
layer.kind = SceneLayerKind::Electrode;
auto payload = std::make_shared<ElectrodeObject>();
payload->setImplantation(electrodes.implantation());
layer.payload = payload;
scene.addLayer(layer);
scene.setOverlayThresholds(2.0f, 4.0f, 8.0f);
QVector3D bbMin;
QVector3D bbMax;
scene.worldBounds(bbMin, bbMax); // union over visible layers with a bounds function

Example​

Used in examples​

ex_disp3d_scene​

Disp3D scene data: sensor-to-surface interpolation, electrodes, MRI slices, video overlay and layers.

src/examples/ex_disp3d_scene/main.cpp, line 176
MultimodalScene scene;
scene.registerBoundsFn(SceneLayerKind::Electrode, [](const SceneLayer& layer, QVector3D& bbMin, QVector3D& bbMax) {
const auto* object = static_cast<const ElectrodeObject*>(layer.payload.get());
const Eigen::MatrixX3f positions = object->implantation().positions();
const Eigen::Vector3f lo = positions.colwise().minCoeff().transpose();
const Eigen::Vector3f hi = positions.colwise().maxCoeff().transpose();
bbMin = QVector3D(lo.x(), lo.y(), lo.z());
bbMax = QVector3D(hi.x(), hi.y(), hi.z());
return true;
});
SceneLayer layer;
layer.id = "seeg_LH";
layer.kind = SceneLayerKind::Electrode;
auto payload = std::make_shared<ElectrodeObject>();

Authors of this file​