brain_deer.surface.connectome

Connectome scenes: region-centroid nodes + matrix-derived edges.

Given node coordinates (mm) and an N×N connectivity matrix, build a scene of node spheres (optionally sized/coloured by a per-node value) and edge tubes for the supra-threshold connections. Thresholds accept an absolute number or a percentile string like '95%' applied to the (absolute) edge weights.

Headless (numpy only); rendering is done by the Surface Studio viewer.

Functions

compute_edges(→ tuple[numpy.ndarray, numpy.ndarray])

Return (edges (E,2) int, weights (E,)) for supra-threshold connections.

centroids_from_label_volume(→ numpy.ndarray)

Compute RAS+ mm centroids for the given labels in a label volume.

build_connectome_scene(, colorbar)

Build a connectome scene (nodes + thresholded edges).

Module Contents

brain_deer.surface.connectome.compute_edges(matrix: numpy.ndarray, *, threshold: float | str | None = None, absolute: bool = True, symmetric: bool = True) → tuple[numpy.ndarray, numpy.ndarray]

Return (edges (E,2) int, weights (E,)) for supra-threshold connections.

For a symmetric matrix only the upper triangle (i<j) is used. Diagonal is always ignored. threshold may be a number or percentile string (‘95%’).

brain_deer.surface.connectome.centroids_from_label_volume(label_volume_img, labels: Sequence[int]) → numpy.ndarray

Compute RAS+ mm centroids for the given labels in a label volume.

brain_deer.surface.connectome.build_connectome_scene(nodes_xyz: numpy.ndarray, matrix: numpy.ndarray, *, node_values: numpy.ndarray | None = None, node_size: float = 3.0, node_size_by_value: bool = False, node_cmap: str = 'hot', edge_threshold: float | str | None = None, edge_cmap: str = 'jet', edge_radius: float = 0.6, absolute: bool = True, symmetric: bool = True, views: Sequence[str] | None = None, background: tuple[float, float, float] = (1.0, 1.0, 1.0), colorbar: bool = True) → brain_deer.surface.scene_model.SceneModel

Build a connectome scene (nodes + thresholded edges).