Repository navigation
DOMINION v0.2.0 — Morphology analysis: skeletonization, Sholl, persistence
DOMINION v0.2.0
Morphology analysis release. Per-cell tracing, Sholl, full CSV provenance, and settings persistence.
Headline features
Per-cell skeletonization (Feature 2)
A new Skeletons section between Tessellation and Measurements. After tessellation, click Run to extract a one-pixel-wide skeleton inside each domain mask, rooted at the corresponding seed. Backed by skan for the branch graph; outputs land in state.skeletons.per_domain[domain_id] with branch paths, lengths in µm, branchpoint / endpoint counts, total length, and the tree's root pixel.
Controls:
- Min branch length (µm) — geometric prune of short twigs.
- Min branch signal — intensity-aware prune (mean signal along each twig). Combined with Min branch length using OR logic — a twig is cut only when both armed thresholds fail, so a short bright branch survives.
- Force tree topology (no loops) — default ON. Detects every topological cycle via a spanning-tree pass on the branch graph and breaks each by dropping its dimmest interior pixel. Skeletons are guaranteed connected.
A Skeletons napari Labels layer overlays the tracings on the signal, color-coded per domain.
Sholl analysis (Feature 3)
A new Sholl analysis section. One slider — Ring spacing (µm) — and Run. For each cell skeleton, computes concentric-ring intersection counts using connected-component counts within each annulus (the proper Sholl crossing metric, not raw pixel counts). Derived per cell:
- peak intersections
- peak radius (µm)
- max radius (µm)
- critical radius (first ring past the peak where intersections drop to ≤ peak / 2)
- AUC (sum of intersections)
- ramification index (peak / innermost-ring intersections)
Extended CSV export (Feature 4)
The Measurements export now picks up skeleton + Sholl results when those have been run. Per-domain rows get 4 skeleton columns and 6 Sholl columns; the summary CSV gains population-level aggregates (medians, means) for everything plus the ring-spacing parameter for reproducibility.
Batch — Save / Load settings
A new Batch section at the bottom of the dock. Two buttons:
- Save settings… — writes every section's widget values (every slider, combobox, checkbox, channel selection) to JSON next to the source image.
- Load settings… — applies the saved values back into every section. Does not run any pipeline step — you still click Run on each section.
Sliders with mid-Run-configured ranges (peak strength, classification T / θ, tessellation min signal, skeletons min branch signal) widen their range on load so a settings file made on one image loads cleanly into a fresh session on another.
Foundation for the directory-batch processing planned next.
UX polish
- All sections collapsed by default except the seed-finding stage (the one you actually interact with first).
- Skeletons placed above Measurements so a quick visual sanity check comes before exporting numbers.
- Default seed point size is a fixed 24 in data units, not pixel-scaled — visible regardless of image resolution.
- The state graph is now branching, not linear:
tessellation → {measurements, skeletons → sholl}. Running Measurements no longer invalidates your Skeletons, and vice versa. Re-running Tessellation still clears everything downstream.
Loop-breaking rewrite
This one came from real user feedback that v0.1.0's tracings still had loops everywhere. The story, in commits:
- First attempt looked for skan's
branch_type == 3— only catches isolated closed loops. The common case (tree-with-cycle: a side branch that rejoins the trunk) is twobranch_type == 2paths between the same junctions, which my check missed entirely. - Second attempt switched to a spanning tree on the branch graph (union-find with paths sorted by minimum signal). Caught most cycles but skipped 2-pixel redundant paths to avoid disconnecting branchpoint neighbors. 50 / 728 cells still had cycles on the test image.
- Third attempt: handle 2-pixel paths too (drop the dimmer of the two pixels, let the
_largest_componentpost-process at the end reknit). 0 / 728 cells with cycles, 0 fragmented.
Tracings are now actually trees.
Install
The skan and networkx dependencies are new in this version. In your dominion env:
pip install skan networkx
pip install -e . --no-deps # reinstall with the bumped versionOr from a fresh env, follow the recipe in the README — the new deps are pinned in pyproject.toml now.
Coming next
- Directory-batch button next to Save / Load — apply a saved settings file across a folder of images, exporting per-image CSVs and territory masks.