v2.0.0
Loading...
Searching...
No Matches
electrodeobject.h
Go to the documentation of this file.
1//=============================================================================================================
27
28#ifndef ELECTRODEOBJECT_H
29#define ELECTRODEOBJECT_H
30
31//=============================================================================================================
32// INCLUDES
33//=============================================================================================================
34
35#include "../disp3D_global.h"
36
37//=============================================================================================================
38// QT INCLUDES
39//=============================================================================================================
40
41#include <QColor>
42#include <QMap>
43#include <QString>
44#include <QVector>
45#include <QVector3D>
46
47#include <memory>
48
49// Forward-declare QRhi types so that this header stays QRhi-free
50class QRhi;
51class QRhiBuffer;
52class QRhiResourceUpdateBatch;
53
54//=============================================================================================================
55// DEFINE NAMESPACE DISP3DLIB
56//=============================================================================================================
57
58namespace DISP3DLIB
59{
60
61//=============================================================================================================
68{
69 QString name;
70 QVector3D position;
71 float radius = 0.5f;
72 QColor color = Qt::yellow;
73 bool selected = false;
74 float value = 0.0f;
75};
76
77//=============================================================================================================
93{
94 Depth = 0,
97};
98
99//=============================================================================================================
111{
112 QString label;
114 int gridRows = 1;
115 int gridCols = 1;
116 QVector<ElectrodeContact> contacts;
117 float shaftRadius = 0.4f;
118 QColor shaftColor = Qt::gray;
119};
120
121//=============================================================================================================
131{
132public:
135
136 //=========================================================================================================
142 void setArrays(const QVector<ElectrodeArray>& arrays);
143
144 //=========================================================================================================
148 const QVector<ElectrodeArray>& arrays() const;
149
150 //=========================================================================================================
154 int totalContactCount() const;
155
156 //=========================================================================================================
164 void setContactValues(const QMap<QString, float>& values,
165 const QColor& minColor = Qt::blue,
166 const QColor& maxColor = Qt::red);
167
168 //=========================================================================================================
174 void selectContact(const QString& name);
175
176 //=========================================================================================================
180 void clearSelection();
181
182 //=========================================================================================================
186 QString selectedContact() const;
187
188 //=========================================================================================================
197 void generateShaftGeometry(QVector<float>& vertices,
198 QVector<unsigned int>& indices,
199 int cylinderSides = 16) const;
200
201 //=========================================================================================================
208 void generateContactInstances(QVector<float>& instanceData) const;
209
210 //=========================================================================================================
214 QVector3D boundingBoxMin() const;
215
216 //=========================================================================================================
220 QVector3D boundingBoxMax() const;
221
222 //=========================================================================================================
229 void updateBuffers(QRhi* rhi, QRhiResourceUpdateBatch* u);
230
231 //=========================================================================================================
235 QRhiBuffer* vertexBuffer() const;
236
237 //=========================================================================================================
241 QRhiBuffer* indexBuffer() const;
242
243 //=========================================================================================================
247 QRhiBuffer* instanceBuffer() const;
248
249 //=========================================================================================================
253 uint32_t shaftIndexCount() const;
254
255 //=========================================================================================================
259 uint32_t contactInstanceCount() const;
260
261private:
262 QVector<ElectrodeArray> m_arrays;
263 QString m_selectedContact;
264 QVector3D m_bbMin;
265 QVector3D m_bbMax;
266
267 //=========================================================================================================
271 void computeBoundingBox();
272
273 //=========================================================================================================
284 static QColor interpolateColor(float value, float minVal, float maxVal,
285 const QColor& minColor, const QColor& maxColor);
286
288 struct GpuBuffers;
289 std::unique_ptr<GpuBuffers> m_gpu;
290};
291
292} // namespace DISP3DLIB
293
294#endif // ELECTRODEOBJECT_H
Library export/import macros and namespace marker for the disp3D library.
#define DISP3DSHARED_EXPORT
3-D brain visualisation using the Qt RHI rendering backend.
ElectrodeLayout
Geometry layout for an electrode array.
Single contact on a depth electrode shaft.
One electrode array — sEEG depth shaft, ECoG strip, or ECoG grid.
QVector< ElectrodeContact > contacts
void generateShaftGeometry(QVector< float > &vertices, QVector< unsigned int > &indices, int cylinderSides=16) const
QRhiBuffer * instanceBuffer() const
void generateContactInstances(QVector< float > &instanceData) const
void setArrays(const QVector< ElectrodeArray > &arrays)
QRhiBuffer * indexBuffer() const
void updateBuffers(QRhi *rhi, QRhiResourceUpdateBatch *u)
QRhiBuffer * vertexBuffer() const
void setContactValues(const QMap< QString, float > &values, const QColor &minColor=Qt::blue, const QColor &maxColor=Qt::red)
const QVector< ElectrodeArray > & arrays() const
void selectContact(const QString &name)
uint32_t contactInstanceCount() const