neurom.view.dendrogram

Dendrogram helper functions and class.

Functions

get_size(positions)

Get the size of bounding rectangle that embodies positions.

layout_dendrogram(dendrogram, origin)

Lays out dendrogram as an aesthetical pleasing tree.

move_positions(positions, to_origin)

Move positions to a new origin.

Classes

Dendrogram(neurom_section)

Dendrogram.

class neurom.view.dendrogram.Dendrogram(neurom_section)

Dendrogram.

Dendrogram for NeuroM section tree.

Parameters:

neurom_section (Neurite|Morphology|Section) – tree to build dendrogram for.

static get_coords(segment_lengths, segment_radii)

Coordinates of dendrogram as polygon with respect to (0, 0) origin.

Parameters:
  • segment_lengths – lengths of dendrogram segments

  • segment_radii – radii of dendrogram segments

Returns:

(N,2) array of 2D x,y coordinates of Dendrogram polygon. N is the number of vertices.

neurom.view.dendrogram.get_size(positions)

Get the size of bounding rectangle that embodies positions.

Parameters:

positions – dict of Dendrogram: np.array positions xy coordinates of dendrograms

Returns:

Tuple of width and height of bounding rectangle.

neurom.view.dendrogram.layout_dendrogram(dendrogram, origin)

Lays out dendrogram as an aesthetical pleasing tree.

Parameters:
  • dendrogram (Dendrogram) – dendrogram

  • origin – np.array xy coordinates of layout origin

Returns:

Dict of positions per each dendrogram node. When placed in those positions, dendrogram nodes will represent a nice tree structure.

neurom.view.dendrogram.move_positions(positions, to_origin)

Move positions to a new origin.

Parameters:
  • positions – positions (dict of Dendrogram: np.array)

  • to_origin – where to move. np.array of (2,) shape for x,y coordindates.

Returns:

Moved positions.