fafbseg.flywire.skeletonize_neuron#

fafbseg.flywire.skeletonize_neuron(x, shave_skeleton=True, remove_soma_hairball=False, assert_id_match=False, threads=2, save_to=None, progress=True, *, dataset=None, **kwargs)[source]#

Skeletonize FlyWire neuron.

Note that this is optimized to be primarily fast which comes at the cost of (some) quality. Also note that soma detection is using the nucleus segmentation and falls back to a radius-based heuristic if no nucleus is found.

Parameters:
  • x (int | trimesh.TriMesh | list thereof | NeuronCriteria) – ID(s) or trimesh of the FlyWire neuron(s) you want to skeletonize.

  • shave_skeleton (bool) – If True, we will attempt to remove any “bristles” on the on the backbone which typically occur if the neurites are very big (or badly segmented).

  • remove_soma_hairball (bool) – If True, we will try to drop the hairball that is typically created inside the soma. Note that while this should work just fine for 99% of neurons, it’s not very smart and there is always a small chance that we remove stuff that should not have been removed. Also only works if the neuron has its nucleus annotated (see fafbseg.flywire.get_somas()).

  • assert_id_match (bool) – If True, will check if skeleton nodes map to the correct segment ID and if not will move them back into the segment. This is potentially very slow!

  • threads (int) – Number of parallel threads to use for downloading the meshes.

  • save_to (str, optional) – If provided will save skeleton as SWC at {save_to}/{id}.swc.

  • progress (bool) – Whether to show a progress bar or not.

  • dataset (str | CloudVolume) –

    Against which FlyWire dataset to query::
    • ”production” (current production dataset, fly_v31)

    • ”sandbox” (i.e. fly_v26)

    • ”public”

    • ”flat_630” or “flat_571” will use the flat segmentations matching the respective materialization versions. By default these use lod=2, you can change that behaviour by passing lod as keyword argument.

Returns:

skeleton – The extracted skeleton.

Return type:

navis.TreeNeuron

See also

fafbseg.flywire.skeletonize_neuron_parallel()

Use this if you want to skeletonize many neurons in parallel.

fafbseg.flywire.get_l2_skeleton()

Generate a skeleton using the L2 cache. Much faster than skeletonization from scratch but the skeleton will be coarser.

get_skeletons()

Use this function to fetch precomputed skeletons. Only available for proofread neurons and for specific materialization versions.

Examples

>>> from fafbseg import flywire
>>> n = flywire.skeletonize_neuron(720575940603231916)