The graph extraction backend was extracted from graph_skel_v1_backend.py
in the author's OCTA skeleton/graph workflow. The original source snapshot has
SHA-256 c06a8850fa3757e97a593e704e996f69dbede30ee807b9145c2958f3c7734771.
This release adds a path-independent public interface, explicit input checks, support for node-only outputs, a synthetic example, and executable geometric tests. Internal historical comparisons and experiment-specific QC-panel generation are outside this package. No experimental data or learned models are included.
- Count neighbours in the supplied skeleton using 26-connectivity.
- Label connected branch-voxel regions, endpoints, and isolated voxels as nodes.
- Give a pure closed component an anchor node so its loop remains explicit.
- Order the remaining path voxels and attach their ends to node regions.
- Preserve each edge in a NetworkX multigraph, including self-loops and multiple paths between the same pair of nodes.
- Compute geometry from the ordered polylines and the user-supplied spacing.
- Export tables, label volumes, and a structural validation report.
Junction representatives are selected from the junction's own voxels. Each edge meets the corresponding node region; its endpoint need not equal the region's representative point. Node-region extent is retained in the tables.
The uint16 QC volume can contain several flags at the same voxel:
| Bit value | Flag |
|---|---|
| 1 | Compact junction region |
| 2 | Short edge |
| 4 | Cycle or self-loop |
| 8 | Boundary contact |
| 16 | Complex junction |
| 32 | Possible axial bridge |
These flags identify structures to inspect. A cycle can be a valid property of a vascular network. Edge direction is storage order; physical flow direction requires separate measurements.
The example creates a deterministic branching tree with one centerline voxel
per row along each curved branch. The mask is a 3 µm distance-transform dilation
of the centerlines, with voxel spacing [1, 1, 1.5] µm. Eight branches form
three junctions and six endpoints. The two images read the exported tables
and depict this same volume.
The overview uses depth projections at a common physical scale. The 3D view uses local XYZ coordinates and colours each polyline by its own measured length. The network panel uses a seeded layout to show connectivity; its layout distances have no physical interpretation.
The demo can be regenerated with python -m graphskel demo --output outputs/demo.
Its checked summary and node/edge tables are under docs/assets/.