Registry / data / skan
library0.13.1pypypi✓ verified 84d ago

Skeleton analysis in Python. Current version 0.13.1, released 2024-08-26. Active development, irregular releases.

pip install skan
INSTALL
IMPORT
SIG · SKAN
S
skan
datapythonv0.13.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Skeleton
from skan import Skeleton
import skan.Skeleton
Skeleton is a class in the top-level skan module.
summarise
from skan import summarise
from skan.csr import summarise
summarise is exported from top-level; csr submodule is internal.
draw_overlay
from skan import draw_overlay
from skan.visualise import draw_overlay
draw_overlay is in the top-level skan module as of v0.12.

Basic usage: skeletonise an image and summarise branches.

import numpy as np from skimage.morphology import skeletonize from skan import Skeleton, summarise # Create a binary skeleton (example) image = np.array([[0,0,0,0,0], [0,1,1,1,0], [0,0,0,1,0], [0,1,1,1,0], [0,0,0,0,0]], dtype=bool) skel = skeletonize(image) # Analyse skeleton branch_data = summarise(skel) print(branch_data.head())
Debug
Known issues
breakingIn 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.
fix
Remove these arguments from your `Skeleton` calls. If you relied on the old behaviour, contact the maintainers.
affects: >=0.10.0
deprecatedColumn names in the summary dataframe used `-` as separator; as of v0.12.0, they use `_`. The old names are deprecated and will be removed.
fix
Update code to use new column names (e.g. 'branch-type' -> 'branch_type'). Use `skan.summarise(..., separator='_')` to force new style.
affects: >=0.12.0
gotchaSkan 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.
fix
Ensure your skeleton image has 1 for skeleton pixels (foreground) and 0 for background.
affects: all
gotchaWhen 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.
fix
Update to skan >=0.12.2.
affects: <0.12.2
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'skan'
skan is not installed.
fix
Run `pip install skan`.
ImportError: cannot import name 'Skeleton' from 'skan'
Old version of skan (pre-0.9) where Skeleton was in a submodule.
fix
Upgrade skan to at least v0.9.0: `pip install -U skan`. Then use `from skan import Skeleton`.
ValueError: The truth value of an array with more than one element is ambiguous
Passing a multi-channel image instead of a single binary skeleton.
fix
Ensure the input to `Skeleton` or `summarise` is a 2D or 3D binary array.
Upgrade
Version history
0.13.1latest on PyPI · released Feb 6, 2026
Audit
Dependencies
numbarequiredRequired for Numba-accelerated functions; version >=0.58 for v0.13+
numpyrequiredArray operations; v0.12+ supports NumPy 2.0
scipyrequiredSparse matrix and morphological operations
networkxoptionalConversion to/from NetworkX graphs
naparioptionalPlugin for visualization; optional
Agent activity
9 hits · last 30 days
node
8
OpenAI (training)
1
Resources
skan — pip install skan · libregistry