Repository navigation
Pipeline Overview
golgi models peripheral nerve stimulation as a directed sequence of stages, from a raw image to a
fiber-type-selective recruitment result. The same stages run whether you drive them from the
GUI, the Python API, or the CLI — they all
act on one shared golgi.Study state on disk.
flowchart TD
A["Image / surface / mask"] -->|segment / import| B["Segmentation + 3-D reconstruction"]
B -->|geometry| C["Multi-region tetrahedral mesh"]
M["Electrode / cuff design"] --> C
S["Conductivities (Cole–Cole / IT'IS)"] --> D
C --> D["Anisotropic FEM (per-contact lead fields)"]
B --> E["Fiber populations + curved 3-D trajectories"]
D -->|Vₑ on fibers| F["Fiber activation (NEURON / AxonML)"]
E --> F
F --> G["Recruitment · selectivity · steering"]
D -.->|reciprocity| R["Recording / CNAP"]
E -.-> R
G --> H["Hashed, replayable study bundle"]
| # | Stage | Input → Output | API | Page |
|---|---|---|---|---|
| 1 | Geometry | image/mask/surface → 3-D nerve geometry (endo/epi, fascicles) |
import_nerve (+ GUI segmentation) |
Geometry Import & Segmentation |
| 2 | Electrode design | electrode type + placement → cuff geometry, contacts, polarities |
set_electrodes / Cuff Designer |
Electrodes & Cuff Designer |
| 3 | Meshing | geometry + cuff → multi-region tetrahedral mesh |
set_mesh + run_mesh
|
Meshing |
| 4 | Materials | tissue conductivities (anisotropic, frequency-aware) |
set_mesh(...) / Materials drawer |
Conductivity & Tissue Properties |
| 5 | FEM | mesh + σ + electrodes → extracellular field Vₑ, lead fields, impedance | run_fem |
Finite-Element Solver |
| 6 | Fibers | geometry → curved 3-D fiber trajectories, branch-classified |
set_fiber_seed + run_fibers
|
Fiber Populations & Trajectories |
| 7 | Activation | Vₑ on fibers + pulse → spikes, thresholds | (within run_sweep / GUI panels) |
Fiber Models & Activation |
| 8 | Analysis | thresholds → recruitment curves, selectivity, comparison | run_sweep |
Recruitment Sweeps & Selectivity |
| — | Recording | fiber currents + reciprocity lead fields → CNAP | pipeline/recording |
Recording & CNAP |
| 9 | Export | the whole study → bundle / figures / PDF report | export_bundle |
Reproducible Bundles · Figures & Reports |
- Geometry before meshing — the mesh is built from the reconstructed surfaces (endoneurium, epineurium) plus the cuff and contacts.
- Electrodes feed both meshing and FEM — contacts become tagged facets in the mesh and current boundary conditions in the solve.
- Fibers are independent of the cuff — trajectories are generated on a nerve-only mesh (decoupled from cuff position), so the same fibers can be evaluated against different electrode designs.
- FEM produces lead fields, not just one field — because the quasi-static problem is linear in current, golgi solves a per-contact basis once and combines it for any montage and any amplitude. This is what makes multi-contact current steering and fast amplitude sweeps possible without re-solving.
-
Activation reads Vₑ sampled on the fibers —
run_femwritespaths_Ve.npz(the field along every fiber), which the fiber models turn into spikes and thresholds.
Every stage writes its artifacts under the project directory and is content-hashed, so unchanged inputs are not recomputed:
- FEM lead fields are fingerprinted on (mesh, σ, contact geometry, solver preset).
- Sweeps are cached by a SHA over the request — re-running an identical sweep is instant.
- An
I_stimamplitude sweep rescales the cached field instead of re-solving the FEM (linearity).
This same hashing underpins the reproducible study bundle: the bundle's
manifest records the stage DAG and the hash of every input and output, so golgi replay can verify
the whole chain byte-for-byte.
A project can hold several designs (electrode geometries) and configs (polarity/current montages) on the same nerve. The nerve and far-field bath are canonical and shared; only the cuff moves between designs. This is what powers cuff-position sweeps and side-by-side design comparison.
golgi · open image-to-recruitment modeling of peripheral nerve stimulation · repository · issues · AGPL-3.0-or-later · data CC-BY-4.0
Get started
Tutorial
Build a model
Simulate & analyze
- Finite-Element Solver
- Fiber Populations & Trajectories
- Fiber Models & Activation
- Recruitment Sweeps & Selectivity
- Recording & CNAP
Share & reproduce
Scripting & scale
Reference
Research & project