neuror.cut_plane.cut_leaves¶
Detect cut leaves with new algo.
Functions
Compute the cut leaves from a given HalfSpace object. |
|
Find all cut leaves for cuts with strong signal for real cut. |
- neuror.cut_plane.cut_leaves._get_cut_leaves(half_space, morphology, bin_width, percentile_threshold)[source]¶
Compute the cut leaves from a given HalfSpace object.
For the half plane, we find all the cut leaves in the slice of size bin_width, and compute the quality of the cut (see docstring of find_cut_leaves for details). If the quality is positive, a cut is considered valid, and the cut leaves are returned.
- Parameters:
half_space (planes.HalfSpace) – half space to search cut points
morphology (morphio.Morphology) – morphology
bin_width (float) – the bin width
percentile_threshold (float) – the minimum percentile of leaves counts in bins
- Returns:
ndarray of dim (n, 3) with cut leaves coordinates quality: quality for these cut leaves
- Return type:
leaves
- neuror.cut_plane.cut_leaves.find_cut_leaves(morph: Morphology, bin_width: float = 3, percentile_threshold: float = 70.0, searched_axes: List[str] = ('Z',), searched_half_spaces: List[float] = (-1, 1))[source]¶
Find all cut leaves for cuts with strong signal for real cut.
The algorithm works as follow. Given the searched_axes and searched_half_spaces, a list of candidate cuts is created, consisting of a slice with bin_width adjusted to the most extreme points of the morphology in the direction of serched_axes/serached_half_spaces. Each cut contains a set of leaves, which are considered as cut leaves if their quality is positive. The quality of a cut is defined the number of leaves in the cut minus the ‘percentile_threshold’ percentile of the distribution of the number of leaves in all other slices of bin_width size of the morphology. More explicitely, if a cut has more leaves than most of other possible cuts of the same size, it is likely to be a real cut from an invitro slice.
Note that all cuts can be valid, thus cut leaves can be on both sides.
- Parameters:
morph – morphology
bin_width – the bin width
percentile_threshold – the minimum percentile of leaves counts in bins
searched_axes – x, y or z. Specify the half space for which to search the cut leaves
searched_half_spaces – A negative value means the morphology lives on the negative side of the plane, and a positive one the opposite.
- Returns:
cut leaves list: list of qualities in dicts with axis and side for each
- Return type:
ndarray