tmd.Tree.Tree#

TMD class : Tree.

Classes

Tree(x, y, z, d, t, p)

Tree class.

class tmd.Tree.Tree.Tree(x, y, z, d, t, p)#

Bases: object

Tree class.

Parameters:
  • x (list[float]) – The x-coordinates of the tree segments.

  • y (list[float]) – The y-coordinates of the tree segments.

  • z (list[float]) – The z-coordinate of the tree segments.

  • d (list[float]) – The diameters of the tree segments.

  • t (list[int]) – The types (basal_dendrite, apical_dendrite, axon) of the tree segments.

  • p (list[int]) – The index of the parent of the tree segments.

copy_tree()#

Returns a deep copy of the Tree.

extract_simplified()#

Returns a simplified tree that corresponds to the start - end of the sections points.

get_bif_term()#

Return number of children per point.

get_bifurcations()#

Return bifurcations.

get_bounding_box()#

Get the bounding box of the neurites.

Parameters:

self – A TMD tree.

Returns:

np.array

([xmin,ymin,zmin], [xmax,ymax,zmax])

Return type:

bounding_box

get_direction_between(start_id=0, end_id=1)#

Return direction of a branch.

The direction is defined as end point - start point normalized as a unit vector.

get_multifurcations()#

Return bifurcations.

get_pca(plane='xy', component=0)#

Return the i-th principal component of PCA of the tree points in the selected plane.

get_point_path_distances()#

Tree method to get path distances from the root.

get_point_projection(vect=(0, 1, 0), point=None)#

Projects each point in the tree (x,y,z) - input_point to a selected vector.

This gives the orientation of each section according to a vector in space, if normalized, otherwise it return the relative length of the section.

get_point_radial_distances(point=None, dim='xyz')#

Tree method to get radial distances from a point.

If point is None, the soma surface -defined by the initial point of the tree- will be used as a reference point.

get_point_radial_distances_time(point=None, dim='xyz', zero_time=0, time=1)#

Tree method to get radial distances from a point.

If point is None, the soma surface -defined by the initial point of the tree- will be used as a reference point.

get_point_section_branch_orders()#

Tree method to get section lengths.

get_point_section_lengths()#

Tree method to get section lengths.

get_point_weighted_radial_distances(point=None, dim='xyz', w=(1, 1, 1), normed=False)#

Tree method to get radial distances from a point.

If point is None, the soma surface -defined by the initial point of the tree- will be used as a reference point.

get_sections_2()#

Get indices of the parents of the first sections’ points and of their last points.

get_sections_only_points()#

Tree method to get the sections’ beginning and ending indices.

get_segments(seg_ids=None)#

Return segment coordinates.

Parameters:
  • self – A TMD tree.

  • seg_ids – segment numbers to consider

Returns:

np.array

(child[x,y,z], parent[x,y,z])

Return type:

seg_list

get_terminations()#

Return terminations.

get_trunk_length()#

Tree method to get the trunk (first section length).

get_type()#

Return type of tree.

is_equal(tree)#

Tests if all tree lists are the same.

move_to_point(point=(0, 0, 0))#

Moves the tree in the x-y-z plane so that it starts from the selected point.

parents_children#

Returns the parents and children nodes of each section.

Returns:

Each key corresponds to a section id

and the respective values to the parent section ids

children (dict): Each key corresponds to a section id

and the respective values to the children section ids

Return type:

parents (dict)

Notes

If 0 exists in starting nodes, the parent from tree is assigned

rotate_xy(angle)#

Rotates the tree in the x-y plane by the defined angle.

sections#

Get the sections of the current tree.

Returns:

section_beg_point_ids (np.ndarray):

The starting point ids of sections

section_end_point_ids (np.ndarray)

The ending point ids of actions

Return type:

tuple