{"id":28184,"library":"skan","title":"Skan","description":"Skeleton analysis in Python. Current version 0.13.1, released 2024-08-26. Active development, irregular releases.","status":"active","version":"0.13.1","language":"python","source_language":"en","source_url":"https://github.com/jni/skan","tags":["skeleton","morphology","image-analysis","branch-analysis"],"install":[{"cmd":"pip install skan","lang":"bash","label":"PyPI"}],"dependencies":[{"reason":"Required for Numba-accelerated functions; version >=0.58 for v0.13+","package":"numba","optional":false},{"reason":"Array operations; v0.12+ supports NumPy 2.0","package":"numpy","optional":false},{"reason":"Sparse matrix and morphological operations","package":"scipy","optional":false},{"reason":"Conversion to/from NetworkX graphs","package":"networkx","optional":true},{"reason":"Plugin for visualization; optional","package":"napari","optional":true}],"imports":[{"note":"Skeleton is a class in the top-level skan module.","wrong":"import skan.Skeleton","symbol":"Skeleton","correct":"from skan import Skeleton"},{"note":"summarise is exported from top-level; csr submodule is internal.","wrong":"from skan.csr import summarise","symbol":"summarise","correct":"from skan import summarise"},{"note":"draw_overlay is in the top-level skan module as of v0.12.","wrong":"from skan.visualise import draw_overlay","symbol":"draw_overlay","correct":"from skan import draw_overlay"}],"quickstart":{"code":"import numpy as np\nfrom skimage.morphology import skeletonize\nfrom skan import Skeleton, summarise\n\n# Create a binary skeleton (example)\nimage = np.array([[0,0,0,0,0],\n                  [0,1,1,1,0],\n                  [0,0,0,1,0],\n                  [0,1,1,1,0],\n                  [0,0,0,0,0]], dtype=bool)\nskel = skeletonize(image)\n\n# Analyse skeleton\nbranch_data = summarise(skel)\nprint(branch_data.head())","lang":"python","description":"Basic usage: skeletonise an image and summarise branches."},"warnings":[{"fix":"Remove these arguments from your `Skeleton` calls. If you relied on the old behaviour, contact the maintainers.","message":"In skan v0.10.0, the junction resolution algorithm changed to always use a minimum spanning tree. The `uniquify_junctions` and `junction_mode` arguments to `Skeleton` are deprecated and will be removed in a future version.","severity":"breaking","affected_versions":">=0.10.0"},{"fix":"Update code to use new column names (e.g. 'branch-type' -> 'branch_type'). Use `skan.summarise(..., separator='_')` to force new style.","message":"Column names in the summary dataframe used `-` as separator; as of v0.12.0, they use `_`. The old names are deprecated and will be removed.","severity":"deprecated","affected_versions":">=0.12.0"},{"fix":"Ensure your skeleton image has 1 for skeleton pixels (foreground) and 0 for background.","message":"Skan expects binary skeleton images where skeleton pixels are 1 (True) and background is 0 (False). If you pass a skeleton with 0 for skeleton and 1 for background, results will be incorrect.","severity":"gotcha","affected_versions":"all"},{"fix":"Update to skan >=0.12.2.","message":"When working with float32 images, skan v0.12.2 and earlier could crash due to a numba issue. This was fixed in v0.12.2, but upgrading to v0.13+ is recommended.","severity":"gotcha","affected_versions":"<0.12.2"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Run `pip install skan`.","cause":"skan is not installed.","error":"ModuleNotFoundError: No module named 'skan'"},{"fix":"Upgrade skan to at least v0.9.0: `pip install -U skan`. Then use `from skan import Skeleton`.","cause":"Old version of skan (pre-0.9) where Skeleton was in a submodule.","error":"ImportError: cannot import name 'Skeleton' from 'skan'"},{"fix":"Ensure the input to `Skeleton` or `summarise` is a 2D or 3D binary array.","cause":"Passing a multi-channel image instead of a single binary skeleton.","error":"ValueError: The truth value of an array with more than one element is ambiguous"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}