Repository navigation
Electrodes and Cuff Designer
golgi models a broad range of cuff and intrafascicular electrodes, fits them to the imported nerve, and supports arbitrary multi-contact (N-polar) montages with per-contact current fractions — the basis for current steering and selective stimulation.
Source: cuff_designer.py (parametric ASCENT-style primitives), golgi/scene/cuff_fit.py (PCA
fitting), golgi/scene/electrode_patches.py (renderable + meshable contacts),
golgi/state_defaults/electrode.py + cuff.py (defaults).
Set via the Designs drawer (GUI) or electrode_type in set_electrodes. Each type
has its own geometry parameters (defaults shown):
Type (electrode_type) |
Contacts | Models | Key parameters |
|---|---|---|---|
bipolar ring-pair |
2 | standard two-ring cuff | axial separation (4 mm), ring width (0.6 mm) |
tripolar (anode-cathode-anode) |
3 | guarded tripole | ring separation (2 mm), ring width (0.6 mm) |
ring-array (NxM) |
rows × cols | segmented multi-contact ring array | rows (2), cols (4), row separation (3 mm), contact width (0.6 mm), contact arc (60°) |
helical (Livanova-style) |
bands (2) | LivaNova helical spiral | bands (2), pitch (12 mm/turn), band arc (180°), band separation (8 mm) |
LIFE (longitudinal intrafascicular) |
rows × cols | Boretius/Rossini intrafascicular wires | contacts/wire, # wires, contact spacing, wire spacing, contact length, wire Ø (80 µm), target fascicle |
TIME (transverse intrafascicular) |
rows × cols | Boretius 2010 transverse ribbon | rows, cols, row/col spacing (230 µm pitch), contact width, ribbon width/thickness, chord angle, target |
DUKE (ASCENT preset) |
preset-dependent | ASCENT cuff library (LivaNova, MultiContact) | via the Cuff Designer dialog (see below) |
Intrafascicular electrodes (LIFE/TIME) are auto-positioned to the nerve cross-section centroid — or to a chosen target fascicle — when the design is refit.
Every contact carries a polarity and an optional current fraction:
POLARITY_CHOICES = ("off", "anode", "cathode", "ground")
-
Defaults are derived from the electrode type — e.g. bipolar →
[anode, cathode], tripolar →[anode, cathode, anode], arrays → a checkerboard of cathodes/anodes. -
Current fractions split the total stimulus current within a polarity group.
Nonemeans "equal share" (the solver uses1/N); explicit fractions let you specify, say, a 60/40 split between two cathodes. The GUI shows a per-group sum-check chip (green at Σ = 1). - The FEM driver injects
I_patch = I_stim · sign(polarity) · fraction, conserving charge (Σ anode = −Σ cathode = I_stim).
Because the field is solved as a per-contact lead-field basis, you can re-weight contacts (steer
current) and sweep amplitude without re-solving the FEM — see
Finite-Element Solver and
Recruitment Sweeps & Selectivity. Legacy projects that used the
old "active" role are migrated to "anode" automatically.
golgi places a cuff on a real, possibly curved nerve via a PCA pipeline (cuff_fit.py):
- Global PCA aligns the nerve's long axis with +z.
-
Cuff origin is chosen along that axis from an anchor (
trunklow-z end,branchedhigh-z end, orcentroid) plus an axial offset and small transverse nudges. - Local PCA refinement re-aligns to the nerve's local trajectory at that location (handling curvature and oblique cross-sections).
- Auto-sizing sets the cuff inner radius to clear the nerve by a user margin; the outer radius adds the wall thickness.
refit_design_geometry() re-runs this whenever a design's geometry or position changes (the per-row
Refit button, the design-sweep generator, and headless run_mesh all call it). With multiple
designs on one nerve, the first design anchors the shared mesh frame and each cuff is placed in its
own local frame — so switching designs moves only the cuff.
The DUKE type opens the Cuff Designer dialog — a pure-Python re-implementation of ASCENT's COMSOL "part primitive" library, with a live 3-D preview. It builds complex, literature-accurate cuffs from parametric primitives:
| Primitive | Role | Builds |
|---|---|---|
CuffFill_Primitive |
fill | solid/annular bore fill (saline / insulation) |
TubeCuff_Primitive |
insulator | hollow silicone shell (optional angular gap) |
CircleContact_Primitive |
conductor (+ recess) | curved disc contact on the inner wall |
LivaNova_Primitive |
insulator + conductor | helical insulator with a central conductor band |
Bundled preset families include LivaNova (LN, helical bipolar) and MultiContact (MCT,
segmented ring array). The dialog exposes only the user-editable parameters per preset (cuff radius,
wall thickness, length, contact size/recess, helix pitch/turns, contact pitch, …); everything else is
derived from a COMSOL-flavored expression DAG ("1.109 [mm]", unit brackets, cross-references, math
functions). Roles are colour-coded in the preview — silicone grey, contacts gold, fill translucent
blue.
The standalone
cuff_designer.pymodule can also be used programmatically:load_cuff_presets(dir)→ preset dicts,render_design(preset, param_overrides, ns_extras)→ a list of(instance, primitive, mesh, role)tuples (PyVista meshes, SI units).
electrode_patches.py turns each electrode into two things: renderable PolyData (tinted by
polarity in the viewport) and patch dictionaries (the electrode_config.json the solver reads as
current boundary conditions). Ring contacts become axial/helical patches; LIFE/TIME contacts become
cylindrical bands / ribbon rectangles. These tagged facets are what the
FEM solver injects current through.
- Navarro X, et al. (2005). A critical review of interfaces with the peripheral nervous system for the control of neuroprostheses and hybrid bionic systems. J Peripher Nerv Syst. — cuff vs intrafascicular (LIFE/TIME) interface overview.
- Veraart C, Grill WM, Mortimer JT (1993). Selective control of muscle activation with a multipolar nerve cuff electrode. IEEE Trans Biomed Eng 40:640. — multipolar cuffs and current steering.
- Musselman ED, Cariello JE, Grill WM, Pelot NA (2021). ASCENT: a pipeline for sample-specific computational modeling of electrical stimulation of peripheral nerves. PLOS Comput Biol. — the cuff part-primitive library the DUKE designer reimplements.
- Bucksot JE, et al. (2019). Flat electrode contacts for vagus nerve stimulation. PLOS ONE. — cuff contact geometry.
Meshing · Finite-Element Solver · Recruitment Sweeps & Selectivity · GUI Walkthrough · Configuration Reference
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