neuror.axon

The axon repair module

Functions

_downstream_pathlength

The sum of this section and its descendents's pathlengths.

_similar_section

Use the "mirror" technique of BlueRepairSDK to find out the similar section.

_sort_intact_sections_by_score

Returns an array of sections sorted by their score.

_tree_distance

Returns the number of sections between the 2 sections.

repair

Axonal repair.

neuror.axon._downstream_pathlength(section)[source]

The sum of this section and its descendents’s pathlengths.

Note

This is a re-implementation of the C++ function “children_length”: https://bbpgitlab.epfl.ch/nse/morphologyrepair/BlueRepairSDK/-/blob/main/BlueRepairSDK/src/morphstats.cpp#L112

neuror.axon._similar_section(intact_axons, section)[source]

Use the “mirror” technique of BlueRepairSDK to find out the similar section.

Warning

I have absolutely no clue why sorting by this metric

neuror.axon._tree_distance(sec1, sec2)[source]

Returns the number of sections between the 2 sections.

Parameters:
  • sec1 (Section) – the first section

  • sec2 (Section) – the second section

Returns:

The number of sections

Return type:

int

Raises:

NeuroRError – if both sections are not part of the same neurite.

Note

I think the implementation of tree distance is True to the original but I would expect the tree distance of 2 children with the same parent to be 2 and not 1 Because in the current case, (root, child1) and (child1, child2) have the same tree distance and it should probably not be the case

neuror.axon.repair(morphology, section, intact_sections, axon_branches, used_axon_branches, y_extent)[source]

Axonal repair.

  1. Find the most similar section in INTACT_SECTIONS list to SECTION

  2. Sort AXON_BRANCHES according to a similarity score to the section found at step 1

  3. Loop through the sorted AXON_BRANCHES to find a section with same strahler orders and that, when appended, does not extend further than Y_EXTENT

  4. Append the first section that meets the conditions of step 3)

  5. Mark this section as used and do not re-use it

Parameters:
  • morphology (Morphology) – the morphology to repair

  • section (neurom.core.morphology.Section) – the section to repair

  • intact_sections (List[Section]) – a list of all sections from this morphology that are part of an intact subtree. Note: these section won’t be grafted.

  • axon_branches (List[neurom.core.morphology.Section]) – a list a intact sections coming from donor morphologies. These are the sections that will be appended

Note

This is a re-implementation of: https://bbpgitlab.epfl.ch/nse/morphologyrepair/BlueRepairSDK/-/blob/main/BlueRepairSDK/src/repair.cpp#L727

The original code used to have more parameters. In the context of the bbp-morphology-workflow it seems that some of the parameters were always used with the same value. This re-implementation assumes the following BlueRepairSDK options:

  • --overlap=true

  • --incremental=false

  • --restrict=true

  • --distmethod=mirror