All Projects → navis-org → skeletor

navis-org / skeletor

Licence: GPL-3.0 license
3D skeleton extraction from meshes.

Programming Languages

python
139335 projects - #7 most used programming language
Jupyter Notebook
11667 projects

Projects that are alternatives of or similar to skeletor

navis
Python 3 library for analysis of neuroanatomical data
Stars: ✭ 68 (-40.87%)
Mutual labels:  neurons, volumes, meshes
Py BL MeshSkeletonization
Mesh Skeleton Extraction Using Laplacian Contraction
Stars: ✭ 32 (-72.17%)
Mutual labels:  skeleton, mesh, skeletonization
kimimaro
Skeletonize densely labeled 3D image segmentations with TEASAR.
Stars: ✭ 85 (-26.09%)
Mutual labels:  connectomics, skeletonization, teasar
unity-plumber
A component to procedurally generate pipe-like meshes in Unity
Stars: ✭ 55 (-52.17%)
Mutual labels:  mesh, meshes
Creature godot
2D Skeletal Animation Creature Runtime for Godot Engine
Stars: ✭ 70 (-39.13%)
Mutual labels:  skeleton, mesh
intersection-wasm
Mesh-Mesh and Triangle-Triangle Intersection tests based on the algorithm by Tomas Akenine-Möller
Stars: ✭ 17 (-85.22%)
Mutual labels:  mesh, meshes
roadifier
Open Source road mesh generator script for Unity
Stars: ✭ 30 (-73.91%)
Mutual labels:  mesh, meshes
SkeletonBridgeRecon
The code for CVPR2019 Oral paper "A Skeleton-bridged Deep Learning Approach for Generating Meshes of Complex Topologies from Single RGB Images"
Stars: ✭ 72 (-37.39%)
Mutual labels:  skeleton, mesh
SkeletonMatching
This repository implements skeleton matching algorithm.
Stars: ✭ 30 (-73.91%)
Mutual labels:  skeleton, skeletonization
Creature unity
2D Skeletal Animation Unity Runtimes for Creature
Stars: ✭ 50 (-56.52%)
Mutual labels:  skeleton, mesh
Gltfforue4
Import glTF 2.0 in Unreal Engine
Stars: ✭ 145 (+26.09%)
Mutual labels:  skeleton, mesh
react-bones
💀 Dead simple content loading components for React and React-Native. 💀
Stars: ✭ 42 (-63.48%)
Mutual labels:  skeleton
nycmesh.net
NYC Mesh Website
Stars: ✭ 33 (-71.3%)
Mutual labels:  mesh
MorphIO
A python and C++ library for reading and writing neuronal morphologies
Stars: ✭ 25 (-78.26%)
Mutual labels:  neurons
qsiprep
Preprocessing and reconstruction of diffusion MRI
Stars: ✭ 94 (-18.26%)
Mutual labels:  connectomics
Magento-2-Module-Skeleton
This Module provides a basic Skeleton for further Magento 2 Modules.
Stars: ✭ 30 (-73.91%)
Mutual labels:  skeleton
Angular4-boilerplate-webpack2
Clean Angular Boilerplate with webapack 2
Stars: ✭ 17 (-85.22%)
Mutual labels:  skeleton
vtkplotlib
Wrap up VTK (python 3D graphics library) into an easy to use 3D equivalent of matplotlib
Stars: ✭ 31 (-73.04%)
Mutual labels:  mesh
bash-framework
◼️ speed up your shell script development and add a modern look and feel (alpha version) ✨ 💫
Stars: ✭ 21 (-81.74%)
Mutual labels:  skeleton
EspNowFloodingMesh
Arduino EspNow managed flooding mesh network with mqtt
Stars: ✭ 55 (-52.17%)
Mutual labels:  mesh

Generic badge Tests DOI

Skeletor

Unlike its namesake, this Python 3 library does not (yet) seek to conquer Eternia but to turn meshes into skeletons.

Heads-up: skeletor 1.0.0 introduced some breaking changes and major reorganizations. Please see the changelog for details.

Install

pip3 install skeletor

For the dev version:

pip3 install git+https://github.com/navis-org/skeletor@master

Dependencies

Automatically installed with pip:

  • networkx
  • numpy
  • pandas
  • scipy
  • scikit-learn
  • trimesh
  • tqdm
  • python-igraph
  • ncollpyde

Optional because not strictly required for the core functions but highly recommended:

  • pyglet is required by trimesh to preview meshes/skeletons in 3D: pip3 install pyglet
  • fastremap for sizeable speed-ups with some methods: pip3 install fastremap

Documentation

Please see the documentation for details.

The change log can be found here.

Quickstart

For the impatient a quick example:

>>> import skeletor as sk
>>> mesh = sk.example_mesh()
>>> # To load and use your own mesh instead of the example mesh:
>>> # import trimesh as tm
>>> # mesh = tm.Trimesh(vertices, faces)  # or...
>>> # mesh = tm.load_mesh('mesh.obj')
>>> fixed = sk.pre.fix_mesh(mesh, remove_disconnected=5, inplace=False)
>>> skel = sk.skeletonize.by_wavefront(fixed, waves=1, step_size=1)
>>> skel
<Skeleton(vertices=(1258, 3), edges=(1194, 2), method=wavefront)>

All skeletonization methods return a Skeleton object. These are just convenient objects to represent and inspect the results.

>>> # location of vertices (nodes)
>>> skel.vertices
array([[16744, 36720, 26407],
       ...,
       [22076, 23217, 24472]])
>>> # child -> parent edges
>>> skel.edges
array([[  64,   31],
       ...,
       [1257, 1252]])
>>> # Mapping for mesh to skeleton vertex indices
>>> skel.mesh_map
array([ 157,  158, 1062, ...,  525,  474,  547])
>>> # SWC table
>>> skel.swc.head()
   node_id  parent_id             x             y             z    radius
0        0         -1  16744.005859  36720.058594  26407.902344  0.000000
1        1         -1   5602.751953  22266.756510  15799.991211  7.542587
2        2         -1  16442.666667  14999.978516  10887.916016  5.333333
>>> # Save SWC file
>>> skel.save_swc('skeleton.swc')

If you installed pyglet (see above) you can also use trimesh's plotting capabilities to inspect the results:

>>> skel.show(mesh=True)

skeletor_example

Benchmarks

skeletor_examples

Benchmarks were run on a 2018 MacBook Pro (2.2 GHz Core i7, 32Gb memory) with optional fastremap dependency installed. Note some of these functions (e.g. contraction and TEASAR/vertex cluster skeletonization) can vary a lot in speed based on parameterization.

Contributing

Pull requests are always welcome!

References & Acknowledgments

Mesh contraction and the edge collapse approach are based on this paper: [1] Au OK, Tai CL, Chu HK, Cohen-Or D, Lee TY. Skeleton extraction by mesh contraction. ACM Transactions on Graphics (TOG). 2008 Aug 1;27(3):44. The abstract and the paper can be found here. Also see this YouTube video.

Some of the code in skeletor was modified from the Py_BL_MeshSkeletonization addon for Blender 3D created by #0K Srinivasan Ramachandran and published under GPL3.

The mesh TEASAR approach was adapted from the implementation in meshparty by Sven Dorkenwald, Casey Schneider-Mizell and Forrest Collman.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].