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//=============================================================================================================
66{
67 QString name;
68 QVector3D position;
69 float radius = 0.5f;
70 QColor color = Qt::yellow;
71 bool selected = false;
72 float value = 0.0f;
73};
74
75//=============================================================================================================
90enum class ElectrodeLayout {
91 Depth = 0,
94};
95
96//=============================================================================================================
106{
107 QString label;
109 int gridRows = 1;
110 int gridCols = 1;
111 QVector<ElectrodeContact> contacts;
112 float shaftRadius = 0.4f;
113 QColor shaftColor = Qt::gray;
114};
115
116//=============================================================================================================
124{
125public:
128
129 //=========================================================================================================
135 void setArrays(const QVector<ElectrodeArray>& arrays);
136
137 //=========================================================================================================
141 const QVector<ElectrodeArray>& arrays() const;
142
143 //=========================================================================================================
147 int totalContactCount() const;
148
149 //=========================================================================================================
157 void setContactValues(const QMap<QString, float>& values,
158 const QColor& minColor = Qt::blue,
159 const QColor& maxColor = Qt::red);
160
161 //=========================================================================================================
167 void selectContact(const QString& name);
168
169 //=========================================================================================================
173 void clearSelection();
174
175 //=========================================================================================================
179 QString selectedContact() const;
180
181 //=========================================================================================================
190 void generateShaftGeometry(QVector<float>& vertices,
191 QVector<unsigned int>& indices,
192 int cylinderSides = 16) const;
193
194 //=========================================================================================================
201 void generateContactInstances(QVector<float>& instanceData) const;
202
203 //=========================================================================================================
207 QVector3D boundingBoxMin() const;
208
209 //=========================================================================================================
213 QVector3D boundingBoxMax() const;
214
215 //=========================================================================================================
222 void updateBuffers(QRhi *rhi, QRhiResourceUpdateBatch *u);
223
224 //=========================================================================================================
228 QRhiBuffer* vertexBuffer() const;
229
230 //=========================================================================================================
234 QRhiBuffer* indexBuffer() const;
235
236 //=========================================================================================================
240 QRhiBuffer* instanceBuffer() const;
241
242 //=========================================================================================================
246 uint32_t shaftIndexCount() const;
247
248 //=========================================================================================================
252 uint32_t contactInstanceCount() const;
253
254private:
255 QVector<ElectrodeArray> m_arrays;
256 QString m_selectedContact;
257 QVector3D m_bbMin;
258 QVector3D m_bbMax;
259
260 //=========================================================================================================
264 void computeBoundingBox();
265
266 //=========================================================================================================
277 static QColor interpolateColor(float value, float minVal, float maxVal,
278 const QColor& minColor, const QColor& maxColor);
279
281 struct GpuBuffers;
282 std::unique_ptr<GpuBuffers> m_gpu;
283};
284
285} // namespace DISP3DLIB
286
287#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