graph

Author: Chris Dijkstra Date: 13/12/2024

Functions for creating and analyzing graphs from skeletonized binary images.

class lettuceSee.graph.SkeletonNetwork(skel_im)

Class used to create network representations of skeletonized images

Parameters:

skel_im (ndarray[int, ...]) – A skeletonized image (for example output from skimage.morphology.skeletonize)

skel_im: ndarray[int, ...]

Attribute: Skeleton image with nodes as 2, edges as 1 and background as 0

labelled_edges: ndarray[int, ...]

Attribute: Skeleton image with all edges labelled sequentially

label_edge_dict: dict[int, tuple[int, int]]

Attribute: LUT for edge labels in labelled_edges and the corresponding edge

network: Graph

Attribute: the network representation of the skeleton image

construct_network()

Method: Takes defined nodes and edges and adds them to self.network

Return type:

Graph

Returns:

networkx.Graph object, contains the edges and nodes as defined in self.edges and self.nodes

node_dict()

Method: Outputs a dictionary of nodes with coordinates

Return type:

dict[int, tuple[int, int]]

Returns:

dict, keys are sequential integers for the nodes, values are tuples in the form of (x, y) with x and y being ints.