v2.0.0
Loading...
Searching...
No Matches
networkobject.h
Go to the documentation of this file.
1//=============================================================================================================
24
25#ifndef NETWORKOBJECT_H
26#define NETWORKOBJECT_H
27
28//=============================================================================================================
29// INCLUDES
30//=============================================================================================================
31
32#include "../disp3D_global.h"
33
34#include <QMatrix4x4>
35#include <QVector3D>
36#include <QColor>
37#include <vector>
38#include <memory>
39
41
42// Forward-declare QRhi types so that this header stays QRhi-free
43class QRhi;
44class QRhiBuffer;
45class QRhiResourceUpdateBatch;
46
47namespace DISP3DLIB
48{
49
50//=============================================================================================================
60{
61public:
62 //=========================================================================================================
67
68 //=========================================================================================================
73
74 //=========================================================================================================
81 void load(const CONNECTIVITYLIB::Network& network, const QString& sColormap = "Viridis");
82
83 //=========================================================================================================
89 void setThreshold(double dThreshold);
90
91 //=========================================================================================================
97 void setColormap(const QString& sColormap);
98
99 //=========================================================================================================
106 void updateNodeBuffers(QRhi* rhi, QRhiResourceUpdateBatch* u);
107
108 //=========================================================================================================
115 void updateEdgeBuffers(QRhi* rhi, QRhiResourceUpdateBatch* u);
116
117 // ── Node accessors ──────────────────────────────────────────────────
118 QRhiBuffer* nodeVertexBuffer() const;
119 QRhiBuffer* nodeIndexBuffer() const;
120 QRhiBuffer* nodeInstanceBuffer() const;
121 int nodeIndexCount() const
122 {
123 return m_nodeIndexCount;
124 }
126 {
127 return m_nodeInstanceCount;
128 }
129
130 // ── Edge accessors ──────────────────────────────────────────────────
131 QRhiBuffer* edgeVertexBuffer() const;
132 QRhiBuffer* edgeIndexBuffer() const;
133 QRhiBuffer* edgeInstanceBuffer() const;
134 int edgeIndexCount() const
135 {
136 return m_edgeIndexCount;
137 }
139 {
140 return m_edgeInstanceCount;
141 }
142
143 // ── Visibility ──────────────────────────────────────────────────────
144 bool isVisible() const
145 {
146 return m_visible;
147 }
148 void setVisible(bool visible)
149 {
150 m_visible = visible;
151 }
152
153 bool hasData() const
154 {
155 return !m_network.isEmpty();
156 }
157
158private:
162 // Instance data: identical layout to DipoleObject for shader compatibility
163 // Model Matrix (4x4) + Color (vec4) + isSelected (float)
164 struct InstanceData
165 {
166 float model[16];
167 float color[4];
168 float isSelected; // Always 0.0 for networks
169 };
170
174 struct VertexData
175 {
176 float x, y, z;
177 float nx, ny, nz;
178 };
179
180 void createNodeGeometry();
181 void createEdgeGeometry();
182 void buildNodeInstances();
183 void buildEdgeInstances();
184
185 // ── Network data ────────────────────────────────────────────────────
186 CONNECTIVITYLIB::Network m_network;
187 QString m_colormap = "Viridis";
188
189 // ── Node GPU resources ──────────────────────────────────────────────
191 struct GpuBuffers;
192 std::unique_ptr<GpuBuffers> m_gpu;
193
194 QByteArray m_nodeVertexData;
195 QByteArray m_nodeIndexData;
196 QByteArray m_nodeInstanceData;
197 int m_nodeIndexCount = 0;
198 int m_nodeInstanceCount = 0;
199 bool m_nodeGeometryDirty = false;
200 bool m_nodeInstancesDirty = false;
201
202 // ── Edge GPU resources ──────────────────────────────────────────────
203 QByteArray m_edgeVertexData;
204 QByteArray m_edgeIndexData;
205 QByteArray m_edgeInstanceData;
206 int m_edgeIndexCount = 0;
207 int m_edgeInstanceCount = 0;
208 bool m_edgeGeometryDirty = false;
209 bool m_edgeInstancesDirty = false;
210
211 bool m_visible = true;
212};
213
214} // namespace DISP3DLIB
215
216#endif // NETWORKOBJECT_H
Library export/import macros and namespace marker for the disp3D library.
#define DISP3DSHARED_EXPORT
Graph container that stores the result of one functional-connectivity metric as nodes (sources/sensor...
3-D brain visualisation using the Qt RHI rendering backend.
Graph container for one connectivity metric; nodes + weighted edges + threshold/visualisation state.
Definition network.h:106
QRhiBuffer * nodeInstanceBuffer() const
void load(const CONNECTIVITYLIB::Network &network, const QString &sColormap="Viridis")
QRhiBuffer * nodeIndexBuffer() const
void setThreshold(double dThreshold)
void setColormap(const QString &sColormap)
void updateEdgeBuffers(QRhi *rhi, QRhiResourceUpdateBatch *u)
void setVisible(bool visible)
void updateNodeBuffers(QRhi *rhi, QRhiResourceUpdateBatch *u)
QRhiBuffer * nodeVertexBuffer() const