A lightweight neuromorphological mesh skeletonizer.
Project description
skeliner
A lightweight skeletonizer that converts neuron meshes into biophysical‑modelling‑ready morphologies. It extracts an acyclic center‑line skeleton, estimates per‑node radii, detects the soma, and bridges small gaps. It also provides robust contact‑site mapping between pairs of cells using both skeletons and meshes.
Features
-
Mesh → SWC skeletons
- Center‑line, acyclic skeleton.
- Per‑node radii with multiple estimators (median/mean/trim) and an automatic recommendation.
- Ellipsoidal soma detection near the soma centroid.
- Bridges disconnected mesh components back to the soma (gap‑closing) and prunes tiny peri‑soma artefacts.
- SWC and NPZ export with metadata;
-
Pairwise contact sites (two cells)
- Skeleton‑based seeding: fast KD‑tree search finds node↔node proximity pairs with tolerance; returns contact midpoints and per‑node loci.
- Mesh‑based patches: around seeds, projects to both meshes and extracts touching triangle patches; returns per‑site areas on A/B and their mean, plus compact AABBs for downstream use.
- Optional skeleton‑only approximation of contact sites/areas when meshes are unavailable.
-
I/O, visualization, diagnostics and post-processing
- Read/write SWC and compact NPZ; load meshes via
trimesh. - 2D projections and 3D viewers for meshes, skeletons, and contact patches.
- Various diagnostics and post-processing tools.
- Read/write SWC and compact NPZ; load meshes via
Installation
pip install skeliner
or from source:
git clone https://github.com/berenslab/skeliner.git
# with uv
uv sync --all-extras
# or not
pip install -e "skeliner[dev]"
Quickstart
Skeletonize a mesh and save SWC
import skeliner as sk
mesh = sk.io.load_mesh("cellA.obj") # or trimesh.load_mesh directly
skel = sk.skeletonize(mesh, unit="nm", verbose=True)
# Choose the recommended radius column (median/mean/trim)
print("Recommended radius:", skel.recommend_radius())
# Save SWC (e.g. convert nm → µm on write)
skel.to_swc("cellA.swc", scale=1e-3)
# Also persist a compact NPZ for fast reload
skel.to_npz("cellA.npz")
Find contact sites between two cells (skeleton + mesh)
import skeliner as sk
meshA = sk.io.load_mesh("cellA.obj")
meshB = sk.io.load_mesh("cellB.obj")
A = sk.skeletonize(meshA)
B = sk.skeletonize(meshB)
# 1) skeleton-based seeds (delta in the same unit as the skeletons/meshes)
seeds = pair.find_contact_seeds(A, B, exclude_soma=True)
print("seed count:", seeds.n)
# 2) mesh-based contact patches around the seed midpoints
sites = pair.map_contact_sites(meshA, meshB, seeds.pos, unit="nm^2")
print("contact patches:", len(sites.faces_A))
print("mean areas (mesh units^2):", sites.area_mean)
# Optional: visualize patches
# from skeliner.plot.vis3d import view_contacts
# sk.plot.view_contacts(meshA, meshB, sites, sides="A")
See example notebooks for more usage.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file skeliner-0.2.5.tar.gz.
File metadata
- Download URL: skeliner-0.2.5.tar.gz
- Upload date:
- Size: 11.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
494432ec0a9e2c92fde82cfdf84b565807ee1fd8d074cf3d5263a133f8845ae2
|
|
| MD5 |
fadae087037ceaee5121bb07cc00727e
|
|
| BLAKE2b-256 |
4a27f5feb53e357c6f73cdf480b54ba2902bb7bcf4a60e592fa343db7250e74d
|
Provenance
The following attestation bundles were made for skeliner-0.2.5.tar.gz:
Publisher:
python-publish.yml on berenslab/skeliner
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
skeliner-0.2.5.tar.gz -
Subject digest:
494432ec0a9e2c92fde82cfdf84b565807ee1fd8d074cf3d5263a133f8845ae2 - Sigstore transparency entry: 727453267
- Sigstore integration time:
-
Permalink:
berenslab/skeliner@bdacc1b6bf24e0476f0d18a039352f99d440e1b6 -
Branch / Tag:
refs/tags/v0.2.5 - Owner: https://github.com/berenslab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@bdacc1b6bf24e0476f0d18a039352f99d440e1b6 -
Trigger Event:
release
-
Statement type:
File details
Details for the file skeliner-0.2.5-py3-none-any.whl.
File metadata
- Download URL: skeliner-0.2.5-py3-none-any.whl
- Upload date:
- Size: 108.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
39ecbffd0ddaf6aef847faa0b2df0ceeea5affbfbd6c37cfb058f5978430b890
|
|
| MD5 |
8c098938864d6d2818d5eb524354f0ce
|
|
| BLAKE2b-256 |
f33ba855385f3ba0c374504688a908064690fff9c9f1f8e3c03552837775ce24
|
Provenance
The following attestation bundles were made for skeliner-0.2.5-py3-none-any.whl:
Publisher:
python-publish.yml on berenslab/skeliner
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
skeliner-0.2.5-py3-none-any.whl -
Subject digest:
39ecbffd0ddaf6aef847faa0b2df0ceeea5affbfbd6c37cfb058f5978430b890 - Sigstore transparency entry: 727453269
- Sigstore integration time:
-
Permalink:
berenslab/skeliner@bdacc1b6bf24e0476f0d18a039352f99d440e1b6 -
Branch / Tag:
refs/tags/v0.2.5 - Owner: https://github.com/berenslab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@bdacc1b6bf24e0476f0d18a039352f99d440e1b6 -
Trigger Event:
release
-
Statement type: