v2.0.0
Loading...
Searching...
No Matches
electrodeobject.h
Go to the documentation of this file.
1//=============================================================================================================
22
23#ifndef ELECTRODEOBJECT_H
24#define ELECTRODEOBJECT_H
25
26//=============================================================================================================
27// INCLUDES
28//=============================================================================================================
29
30#include "../disp3D_global.h"
31#include "../core/rendertypes.h"
32
34
35//=============================================================================================================
36// QT INCLUDES
37//=============================================================================================================
38
39#include <QByteArray>
40#include <QColor>
41#include <QMap>
42#include <QString>
43#include <QVector>
44#include <QVector3D>
45
46//=============================================================================================================
47// DEFINE NAMESPACE DISP3DLIB
48//=============================================================================================================
49
50namespace DISP3DLIB
51{
52
53//=============================================================================================================
60{
61public:
62 // Drawn sizes in metres. Real contacts are about 0.8 mm (depth) and 4 mm (subdural) across;
63 // both are enlarged to stay visible and pickable, keeping their ratio.
64 static constexpr float kDepthContactRadius = 0.0011f;
65 static constexpr float kSubduralContactRadius = 0.0019f;
66 static constexpr float kShaftRadius = 0.00045f;
67 static constexpr float kShaftOvershoot = 0.004f;
68 static constexpr float kTieRadius = 0.00035f;
69 static constexpr float kMaxTieLength = 0.015f;
70
73
78 static QColor leadColor(int index);
79
80 //=========================================================================================================
87
92 {
93 return m_implantation;
94 }
95
99 int totalContactCount() const;
100
101 //=========================================================================================================
109 void setContactValues(const QMap<QString, float>& values, const QString& colormap = QStringLiteral("Hot"));
110
114 void clearContactValues();
115
125 QVector<uint32_t> surfaceColors(const Eigen::MatrixX3f& vertices, double distance = 0.01) const;
126
127 //=========================================================================================================
133 void selectContact(const QString& name);
134
138 void clearSelection();
139
143 QString selectedContact() const;
144
145 //=========================================================================================================
151 void setHoveredContact(int index);
152
156 int hoveredContact() const
157 {
158 return m_hoveredContact;
159 }
160
161 //=========================================================================================================
170 int intersect(const QVector3D& rayOrigin, const QVector3D& rayDir, float& dist) const;
171
176 const IEEGLIB::IeegContact* contactAt(int index) const;
177
182 QString contactLabel(int index) const;
183
184 //=========================================================================================================
188 InstancedStreams contactStreams() const;
189
193 InstancedStreams bodyStreams() const;
194
197 {
198 return m_contactRenderKey;
199 }
200
203 {
204 return m_bodyRenderKey;
205 }
206
207 bool isVisible() const
208 {
209 return m_visible;
210 }
211 void setVisible(bool visible)
212 {
213 m_visible = visible;
214 }
215
216 //=========================================================================================================
220 QVector3D boundingBoxMin() const;
221
225 QVector3D boundingBoxMax() const;
226
227private:
229 struct InstanceData
230 {
231 float model[16];
232 float color[4];
233 float isSelected;
234 };
235
236 void buildBodies();
237 void buildContactInstances();
238 float contactRadius(int contact) const;
239
240 IEEGLIB::IeegImplantation m_implantation;
241 QVector<int> m_leadOfContact;
242 QVector<QColor> m_contactColors;
243 QMap<QString, float> m_contactValues;
244 QString m_colormap;
245 float m_valueMin = 0.0f;
246 float m_valueMax = 0.0f;
247 int m_selectedContact = -1;
248 int m_hoveredContact = -1;
249 QVector3D m_bbMin;
250 QVector3D m_bbMax;
251 bool m_visible = true;
252
253 // Unit sphere and unit cylinder (along +y, centred) shared by all instances
254 QByteArray m_sphereVertices;
255 QByteArray m_sphereIndices;
256 QByteArray m_cylinderVertices;
257 QByteArray m_cylinderIndices;
258 int m_sphereIndexCount = 0;
259 int m_cylinderIndexCount = 0;
260
261 QByteArray m_contactInstances;
262 QByteArray m_bodyInstances;
263 int m_bodyCount = 0;
264 quint64 m_contactGeneration = 0;
265 quint64 m_bodyGeneration = 0;
266 RenderKey m_contactRenderKey;
267 RenderKey m_bodyRenderKey;
268
269 void computeBoundingBox();
270
271 float normalized(float value) const;
272};
273
274} // namespace DISP3DLIB
275
276#endif // ELECTRODEOBJECT_H
Library export/import macros and namespace marker for the disp3D library.
#define DISP3DSHARED_EXPORT
Lightweight render-related enums (ShaderMode, VisualizationMode) shared across disp3D.
sEEG / ECoG implantation: contacts grouped into depth leads, strips and grids.
3-D brain visualisation using the Qt RHI rendering backend.
CPU streams of an instanced mesh: one shape (vertices, indices) drawn once per instance.
Identity of a renderable in the renderer's GPU resource cache.
const RenderKey & contactRenderKey() const
static constexpr float kDepthContactRadius
void setVisible(bool visible)
static constexpr float kTieRadius
static QColor leadColor(int index)
const IEEGLIB::IeegImplantation & implantation() const
static constexpr float kShaftOvershoot
void setImplantation(const IEEGLIB::IeegImplantation &implantation)
static constexpr float kMaxTieLength
const RenderKey & bodyRenderKey() const
static constexpr float kShaftRadius
static constexpr float kSubduralContactRadius
One recording contact.
Contacts of an sEEG / ECoG implantation and the leads they belong to.