neuror.main¶
Dendritic repair module
It is based on the BlueRepairSDK’s implementation
Functions
|
Return a list of 2-tuples. |
|
Continue growing the section. |
|
Returns this section sholl layer. |
Return the probabilities of bifurcation, termination and bifurcation in a dictionnary for the given sholl layer and branch order. |
|
|
Grow until reaching next sholl layer. |
|
Returns the vector formed by the last 2 points of the section |
|
Return the maximum distance of dendritic section ends and the origin in the XZ plane. |
|
Returns the distance from the last section point to the origin in the XZ plane. |
Does the branch have leaves belonging to the cut plane? |
|
Return true if the section is close from the cut plane. |
|
The repair function. |
Classes
To bifurcate or not to bifurcate? |
|
Repair the input morphology. |
- class neuror.main.Repair(inputfile: Path, axons: Path | None = None, seed: int | None = 0, cut_leaves_coordinates: ndarray | None = None, legacy_detection: bool = False, repair_flags: Dict[RepairType, bool] | None = None, apical_point: ndarray | None = None, params: Dict | None = None, validate_params=False)[source]¶
Bases:
object
Repair the input morphology.
The repair algorithm uses sholl analysis of intact branches to grow new branches from cut leaves. The algorithm is fairly complex, but can be controled via a few parameters in the
params
dictionary. By default, they are:_PARAMS = { 'seg_length': 5.0, # lenghts of new segments 'sholl_layer_size': 10, # resolution of the sholl profile 'noise_continuation': 0.5, # together with seg_length, this controls the tortuosity 'soma_repulsion': 0.2, # if 0, previous section direction, if 1, radial direction 'bifurcation_angle': 20, # noise amplitude in degree around mean bif angle on the cell 'path_length_ratio': 0.5, # a smaller value will make a strornger taper rate 'children_diameter_ratio': 0.8, # 1: child diam = parent diam, 0: child diam = tip diam 'tip_percentile': 25, # percentile of tip radius distributions to use as tip radius }
- Parameters:
inputfile – the input neuron to repair
axons – donor axons whose section will be used to repair this axon
seed – the numpy seed
cut_leaves_coordinates – List of 3D coordinates from which to start the repair
legacy_detection – if True, use the legacy cut plane detection (see
neuror.cut_plane.legacy_detection
)repair_flags – a dict of flags where key is a
neuror.utils.RepairType
and value is whether it should be repaired or not. If not provided, all types will be repaired.apical_point – 3d vector for apical point, else, the automatic apical detection is used if
apical_point == -1
, no automatic detection will be triedparams – repair internal parameters (see comments in code for details)
validate_params – if set to
True
, the given parameters are validated before processing
Note
This class is based on https://bbpgitlab.epfl.ch/nse/morphologyrepair/BlueRepairSDK/-/blob/main/BlueRepairSDK/src/repair.cpp#L469
- neuror.main._get_sholl_proba(sholl_data: dict, section_type: SectionType, sholl_layer: int, pseudo_order: int) Dict[Action, float] [source]¶
Return the probabilities of bifurcation, termination and bifurcation in a dictionnary for the given sholl layer and branch order.
If no data are available for this branch order, the action_counts are averaged on all branch orders for this sholl layer
- Parameters:
sholl_data –
nested dict that stores the number of section per SectionType, sholl order, sholl layer and Action type
sholl_data[neurite_type][layer][order][action_type] = counts
section_type – section type
sholl_layer – sholl layer
pseudo_order – pseudo order
- Returns:
Probability of each action
Note
This is based on https://bbpgitlab.epfl.ch/nse/morphologyrepair/BlueRepairSDK/-/blob/main/BlueRepairSDK/src/helper_dendrite.cpp#n398
Note
OrderedDict
ensures the reproducibility ofnumpy.random.choice()
outcome.
- neuror.main.is_branch_intact(branch, cut_points)[source]¶
Does the branch have leaves belonging to the cut plane?
- neuror.main.is_cut_section(section, cut_points)[source]¶
Return true if the section is close from the cut plane.
- neuror.main.repair(inputfile: Path, outputfile: Path, axons: List[Path] | None = None, seed: int = 0, cut_leaves_coordinates: ndarray | None = None, legacy_detection: bool = False, plot_file: Path | None = None, repair_flags: Dict[RepairType, bool] | None = None, apical_point: List | None = None, params: Dict | None = None, validate_params=False)[source]¶
The repair function.
- Parameters:
inputfile – the input morph
outputfile – the output morph
axons – the axons
seed – the numpy seed
cut_leaves_coordinates – List of 3D coordinates from which to start the repair
plot_file – the filename of the plot
repair_flags – a dict of flags where key is a
neuror.utils.RepairType
and value is whether it should be repaired or not. If not provided, all types will be repaired.apical_point – 3d vector for apical point, else, the automatic apical detection is used
params – repair internal parameters, None will use defaults
validate_params – if set to
True
, the given parameters are validated before processing