webknossos.skeleton.tree
Contains a collection of nodes and edges. Despite the name, trees may contain cycles.
This class inherits from networkx.Graph
.
For further methods, please check the networkx documentation.
See Tree.__init__ for more details.
A small usage example:
tree = skeleton.add_tree("a tree")
node_1 = tree.add_node(position=(0, 0, 0), comment="node 1")
node_2 = tree.add_node(position=(100, 100, 100), comment="node 2")
tree.add_edge(node_1, node_2)
To create a tree, it is recommended to use Skeleton.add_tree
or
Group.add_tree
. That way, the newly created tree is automatically
attached as a child to the object the method was called on.
String identifier of the graph.
This graph attribute appears in the attribute dict G.graph
keyed by the string "name"
. as well as an attribute (technically
a property) G.name
. This is entirely user controlled.
dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)
dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)
Returns an numpy array with the positions of all nodes of this tree.
Adds a node to the tree. Apart from the mandatory position
parameter,
there are several optional parameters which can be used to encode
additional information. For example, the comment will be shown by the
WEBKNOSSOS UI.
Inherited Members
- networkx.classes.graph.Graph
- node_attr_dict_factory
- edge_attr_dict_factory
- graph_attr_dict_factory
- to_directed_class
- to_undirected_class
- graph
- adj
- add_nodes_from
- remove_node
- remove_nodes_from
- nodes
- number_of_nodes
- order
- has_node
- add_edge
- add_edges_from
- add_weighted_edges_from
- remove_edge
- remove_edges_from
- update
- has_edge
- neighbors
- edges
- get_edge_data
- adjacency
- degree
- clear
- clear_edges
- is_multigraph
- is_directed
- copy
- to_directed
- to_undirected
- subgraph
- edge_subgraph
- size
- number_of_edges
- nbunch_iter
Deprecated, please use Tree
instead.
To create a tree, it is recommended to use Skeleton.add_tree
or
Group.add_tree
. That way, the newly created tree is automatically
attached as a child to the object the method was called on.
Inherited Members
- Tree
- name
- group
- color
- node_dict_factory
- adjlist_outer_dict_factory
- adjlist_inner_dict_factory
- id
- get_node_positions
- get_node_by_id
- add_node
- get_max_node_id
- networkx.classes.graph.Graph
- node_attr_dict_factory
- edge_attr_dict_factory
- graph_attr_dict_factory
- to_directed_class
- to_undirected_class
- graph
- adj
- add_nodes_from
- remove_node
- remove_nodes_from
- nodes
- number_of_nodes
- order
- has_node
- add_edge
- add_edges_from
- add_weighted_edges_from
- remove_edge
- remove_edges_from
- update
- has_edge
- neighbors
- edges
- get_edge_data
- adjacency
- degree
- clear
- clear_edges
- is_multigraph
- is_directed
- copy
- to_directed
- to_undirected
- subgraph
- edge_subgraph
- size
- number_of_edges
- nbunch_iter