Skip to content

webknossos.skeleton.group

#   class Group:
#   Group( name: str, skeleton: webknossos.skeleton.skeleton.Skeleton, enforced_id: Union[int, NoneType] = None )

To create a group, it is recommended to use webknossos.skeleton.skeleton.Skeleton.add_group or Group.add_group. That way, the newly created group is automatically attached as a child to the object the method was called on.

A small usage example:

subgroup = group.add_group("a subgroup")
tree = subgroup.add_tree("a tree")
#   name: str
#   id: int

Read-only property.

#   def add_tree( self, name: str, color: Union[Tuple[float, float, float, float], Tuple[float, float, float], NoneType] = None, _enforced_id: Union[int, NoneType] = None ) -> webknossos.skeleton.tree.Tree:

Adds a tree to the current group with the provided name (and color if specified).

#   def add_graph( self, name: str, color: Union[Tuple[float, float, float, float], Tuple[float, float, float], NoneType] = None, _enforced_id: Union[int, NoneType] = None ) -> webknossos.skeleton.tree.Tree:

Deprecated, please use add_tree.

#   children: collections.abc.Iterator[typing.Union[webknossos.skeleton.group.Group, webknossos.skeleton.tree.Tree]]

Returns all (immediate) children (groups and trees) as an iterator.

Returns all (immediate) tree children as an iterator. Use flattened_trees if you need also need trees within subgroups.

Deprecated, please use trees.

#   groups: collections.abc.Iterator[webknossos.skeleton.group.Group]

Returns all (immediate) group children as an iterator. Use flattened_groups if you need also need groups within subgroups.

#   def add_group( self, name: str, _enforced_id: Union[int, NoneType] = None ) -> webknossos.skeleton.group.Group:

Adds a (sub) group to the current group with the provided name.

#   def get_total_node_count(self) -> int:

Returns the total number of nodes of all trees within this group (and its subgroups).

#   def get_max_tree_id(self) -> int:

Returns the highest tree id of all trees within this group (and its subgroups).

#   def get_max_graph_id(self) -> int:

Deprecated, please use get_max_tree_id.

#   def get_max_node_id(self) -> int:

Returns the highest node id of all nodes of all trees within this group (and its subgroups).

#   def flattened_trees(self) -> Iterator[webknossos.skeleton.tree.Tree]:

Returns an iterator of all trees within this group (and its subgroups).

#   def flattened_graphs(self) -> Iterator[webknossos.skeleton.tree.Tree]:

Deprecated, please use flattened_trees.

#   def flattened_groups(self) -> collections.abc.Iterator[webknossos.skeleton.group.Group]:

Returns an iterator of all groups within this group (and its subgroups).

#   def get_node_by_id(self, node_id: int) -> webknossos.skeleton.node.Node:

Returns the node which has the specified node id.

#   def get_tree_by_id(self, tree_id: int) -> webknossos.skeleton.tree.Tree:

Returns the tree which has the specified tree id.

#   def get_graph_by_id(self, graph_id: int) -> webknossos.skeleton.tree.Tree:

Deprecated, please use get_tree_by_id.

#   def get_group_by_id(self, group_id: int) -> webknossos.skeleton.group.Group:

Returns the group which has the specified group id.

#   def as_nml_group(self) -> webknossos._nml.group.Group:

Returns a named tuple representation of this group.

Back to top