Skip to main content

NetworkObject

Namespace: DISP3DLIB  ·  Library: 3D Display Library

#include <disp3D/networkobject.h>

class DISP3DLIB::NetworkObject

NetworkObject renders connectivity network nodes (instanced spheres) and edges (instanced cylinders) using the same instanced rendering pipeline as DipoleObject.

Renderable connectivity network visualization.

src/examples/ex_disp3d_scene/main.cpp
Network graph("coherence");
for (int i = 0; i < 3; ++i) {
graph.append(NetworkNode::SPtr(new NetworkNode(i, RowVectorXf::Constant(3, 0.01f * static_cast<float>(i)))));
}
const QList<QPair<int, int>> links = {{0, 1}, {1, 2}};
const QList<double> strengths = {0.9, 0.3};
for (int k = 0; k < links.size(); ++k) {
NetworkEdge::SPtr edge(new NetworkEdge(links[k].first, links[k].second, MatrixXd::Constant(1, 1, strengths[k])));
graph.getNodeAt(links[k].first)->append(edge);
graph.getNodeAt(links[k].second)->append(edge);
graph.append(edge);
}
NetworkObject networkGlyphs;
networkGlyphs.load(graph, "Viridis"); // spheres for nodes, cylinders for edges
const int edgesAll = networkGlyphs.edgeInstanceCount();
networkGlyphs.setThreshold(0.5); // keep only the strong 0-1 link

Public Methods​

NetworkObject()​

Default constructor.


~NetworkObject()​

Destructor.


load(network, sColormap)​

Load network data and generate node/edge instances.

Parameters:

  • network : const Network & The connectivity network to visualize.

  • sColormap : const QString & Colormap name for weight-based coloring (e.g. "Viridis", "Hot").


setThreshold(dThreshold)​

Update the threshold and regenerate visible edges/nodes.

Parameters:

  • dThreshold : double New threshold value (0.0 – 1.0).

setColormap(sColormap)​

Set the colormap used for edge/node coloring.

Parameters:

  • sColormap : const QString & Colormap name (e.g. "Hot", "Viridis", "Jet").

nodeStreams()​

Returns:

  • InstancedStreams — CPU streams of the node sphere and of one instance per node.

edgeStreams()​

Returns:

  • InstancedStreams — CPU streams of the edge cylinder and of one instance per edge.

nodeInstanceCount()​

Returns:

  • int — Number of nodes drawn, i.e. those touching an edge above the threshold.

edgeInstanceCount()​

Returns:

  • int — Number of edges drawn above the threshold.

nodeRenderKey()​

Returns:

  • const RenderKey & — Identities of the node and edge meshes in the renderer's GPU cache.

edgeRenderKey()​


isVisible()​


setVisible(visible)​


hasData()​


Example​

Used in examples​

ex_disp3d_scene​

Disp3D scene data: sensor-to-surface interpolation, electrodes, MRI slices, video overlay and layers.

src/examples/ex_disp3d_scene/main.cpp, line 285
NetworkObject networkGlyphs;
networkGlyphs.load(graph, "Viridis"); // spheres for nodes, cylinders for edges
const int edgesAll = networkGlyphs.edgeInstanceCount();
networkGlyphs.setThreshold(0.5); // keep only the strong 0-1 link
ok &= expect(edgesAll == 2 && networkGlyphs.edgeInstanceCount() == 1 && networkGlyphs.nodeInstanceCount() == 2,
"NetworkObject: thresholding at 0.5 leaves one edge and its two nodes");

Authors of this file​