openalea.phenomenal.segmentation.graph.graph_from_voxel_grid#
- openalea.phenomenal.segmentation.graph.graph_from_voxel_grid(voxel_grid, connect_all_point=True)[source]#
Return a weighted networkx graph built from a voxel_grid object where each node of the graph is the tuple position of the voxels center. Each node is edged, if present, to the nodes depict their 26-neighbors in the voxel_grid. The weight of each edge is the distance between their voxel center position.
If connect_all_point is False, then the graph returned is the subgraph with the biggest connected components. If connect_all_point is True, the subgraph of connected components are edged via the closest neighbors between the subgraph with a weight equal to the distance between their position.