fafbseg.google.find_missed_branches¶
- fafbseg.google.find_missed_branches(x, autoseg_instance, tag=False, tag_size_thresh=10, min_node_overlap=4, **kwargs)[source]¶
Use autoseg to find (and annotate) potential missed branches.
- Parameters:
x (pymaid.CatmaidNeuron/List) – Neuron(s) to search for missed branches.
autoseg_instance (pymaid.CatmaidInstance) – CATMAID instance containing the autoseg skeletons.
tag (bool, optional) – If True, will tag nodes of
x
that might have missed branches with “missed branch?”.tag_size_thresh (int, optional) – Size threshold in microns of cable for tagging potentially missed branches.
min_node_overlap (int, optional) – Minimum number of nodes that input neuron(s) x must overlap with given segmentation ID for it to be included.
**kwargs – Keyword arguments passed to
fafbseg.neuron_from_segments
.
- Returns:
summary (pandas.DataFrame) – DataFrame containing a summary of potentially missed branches.
If input is a single neuron:
fragments (pymaid.CatmaidNeuronList) – Fragments found to be potentially overlapping with the input neuron.
branches (pymaid.CatmaidNeuronList) – Potentially missed branches extracted from
fragments
.
Examples
Setup
>>> import fafbseg >>> import pymaid
>>> # Set up connections to manual and autoseg CATMAID >>> manual = pymaid.CatmaidInstance('URL', 'HTTP_USER', 'HTTP_PW', 'API_TOKEN') >>> auto = pymaid.CatmaidInstance('URL', 'HTTP_USER', 'HTTP_PW', 'API_TOKEN')
>>> # Set a source for segmentation data >>> fafbseg.google.use_google_storage("https://storage.googleapis.com/fafb-ffn1-20190805/segmentation")
Find missed branches and tag them
>>> # Fetch a neuron >>> x = pymaid.get_neuron(16, remote_instance=manual) >>> # Find and tag missed branches >>> (summary, ... fragments, ... branches) = fafbseg.google.find_missed_branches(x, autoseg_instance=auto)
>>> # Show summary of missed branches >>> summary.head() n_nodes cable_length node_id 0 110 28.297424 3306395 1 90 23.976504 20676047 2 64 15.851333 23419997 3 29 7.494350 6298769 4 16 3.509739 15307841
>>> # Co-visualize your neuron and potentially overlapping autoseg fragments >>> x.plot3d(color='w') >>> fragments.plot3d()
>>> # Visualize the potentially missed branches >>> pymaid.clear3d() >>> x.plot3d(color='w') >>> branches.plot3d(color='r')