v2.0.0
Loading...
Searching...
No Matches
electrodeobject.h
Go to the documentation of this file.
1//=============================================================================================================
34
35#ifndef ELECTRODEOBJECT_H
36#define ELECTRODEOBJECT_H
37
38//=============================================================================================================
39// INCLUDES
40//=============================================================================================================
41
42#include "../disp3D_global.h"
43
44//=============================================================================================================
45// QT INCLUDES
46//=============================================================================================================
47
48#include <QColor>
49#include <QMap>
50#include <QString>
51#include <QVector>
52#include <QVector3D>
53
54#include <memory>
55
56// Forward-declare QRhi types so that this header stays QRhi-free
57class QRhi;
58class QRhiBuffer;
59class QRhiResourceUpdateBatch;
60
61//=============================================================================================================
62// DEFINE NAMESPACE DISP3DLIB
63//=============================================================================================================
64
65namespace DISP3DLIB
66{
67
68//=============================================================================================================
73{
74 QString name;
75 QVector3D position;
76 float radius = 0.5f;
77 QColor color = Qt::yellow;
78 bool selected = false;
79 float value = 0.0f;
80};
81
82//=============================================================================================================
87{
88 QString label;
89 QVector<ElectrodeContact> contacts;
90 float shaftRadius = 0.4f;
91 QColor shaftColor = Qt::gray;
92};
93
94//=============================================================================================================
102{
103public:
106
107 //=========================================================================================================
113 void setShafts(const QVector<ElectrodeShaft>& shafts);
114
115 //=========================================================================================================
119 const QVector<ElectrodeShaft>& shafts() const;
120
121 //=========================================================================================================
125 int totalContactCount() const;
126
127 //=========================================================================================================
135 void setContactValues(const QMap<QString, float>& values,
136 const QColor& minColor = Qt::blue,
137 const QColor& maxColor = Qt::red);
138
139 //=========================================================================================================
145 void selectContact(const QString& name);
146
147 //=========================================================================================================
151 void clearSelection();
152
153 //=========================================================================================================
157 QString selectedContact() const;
158
159 //=========================================================================================================
168 void generateShaftGeometry(QVector<float>& vertices,
169 QVector<unsigned int>& indices,
170 int cylinderSides = 16) const;
171
172 //=========================================================================================================
179 void generateContactInstances(QVector<float>& instanceData) const;
180
181 //=========================================================================================================
185 QVector3D boundingBoxMin() const;
186
187 //=========================================================================================================
191 QVector3D boundingBoxMax() const;
192
193 //=========================================================================================================
200 void updateBuffers(QRhi *rhi, QRhiResourceUpdateBatch *u);
201
202 //=========================================================================================================
206 QRhiBuffer* vertexBuffer() const;
207
208 //=========================================================================================================
212 QRhiBuffer* indexBuffer() const;
213
214 //=========================================================================================================
218 QRhiBuffer* instanceBuffer() const;
219
220 //=========================================================================================================
224 uint32_t shaftIndexCount() const;
225
226 //=========================================================================================================
230 uint32_t contactInstanceCount() const;
231
232private:
233 QVector<ElectrodeShaft> m_shafts;
234 QString m_selectedContact;
235 QVector3D m_bbMin;
236 QVector3D m_bbMax;
237
238 //=========================================================================================================
242 void computeBoundingBox();
243
244 //=========================================================================================================
255 static QColor interpolateColor(float value, float minVal, float maxVal,
256 const QColor& minColor, const QColor& maxColor);
257
259 struct GpuBuffers;
260 std::unique_ptr<GpuBuffers> m_gpu;
261};
262
263} // namespace DISP3DLIB
264
265#endif // ELECTRODEOBJECT_H
disp3D library export/import macros.
#define DISP3DSHARED_EXPORT
3-D brain visualisation using the Qt RHI rendering backend.
Single contact on a depth electrode shaft.
One shaft of a stereotactic depth electrode (sEEG).
QVector< ElectrodeContact > contacts
void generateShaftGeometry(QVector< float > &vertices, QVector< unsigned int > &indices, int cylinderSides=16) const
QRhiBuffer * instanceBuffer() const
void setShafts(const QVector< ElectrodeShaft > &shafts)
void generateContactInstances(QVector< float > &instanceData) const
QRhiBuffer * indexBuffer() const
void updateBuffers(QRhi *rhi, QRhiResourceUpdateBatch *u)
const QVector< ElectrodeShaft > & shafts() const
QRhiBuffer * vertexBuffer() const
void setContactValues(const QMap< QString, float > &values, const QColor &minColor=Qt::blue, const QColor &maxColor=Qt::red)
void selectContact(const QString &name)
uint32_t contactInstanceCount() const