Initialize NeuroAnalyzer
using NeuroAnalyzer
import CairoMakie
# Quarto sets a default figure size (672 × 480 px), which overrides the sizes of
# NeuroAnalyzer figures: remove it
delete!(CairoMakie.Makie.CURRENT_DEFAULT_THEME, :resolution)using NeuroAnalyzer
import CairoMakie
# Quarto sets a default figure size (672 × 480 px), which overrides the sizes of
# NeuroAnalyzer figures: remove it
delete!(CairoMakie.Makie.CURRENT_DEFAULT_THEME, :resolution)Non-Invasive Brain Stimulation (NIBS) refers to a set of neuromodulation techniques that use electrical or magnetic fields to modulate brain activity without surgery or implants. These methods are widely used in neuroscience research, clinical therapy, and cognitive enhancement to study brain function, treat neurological and psychiatric disorders, and enhance brain performance.
NIBS techniques can be broadly categorized into four main types, each with unique mechanisms, applications, and parameters:
| Technique | Modality | Mechanism | Target Depth | Temporal Resolution | Spatial Resolution | Cost | Main Applications |
|---|---|---|---|---|---|---|---|
| Transcranial Magnetic Stimulation (TMS) | Magnetic | Induces eddy currents via magnetic pulses. | Superficial cortex (up to 2–3 cm) | Milliseconds to minutes | 1–2 cm | High | Depression, OCD, migraine (FDA-cleared) |
| Transcranial Direct Current Stimulation (tDCS) | Electrical | Modulates resting membrane potentials via weak DC current. | Superficial cortex | Minutes to hours | 3–5 cm | Low | Depression, chronic pain (research) |
| Transcranial Alternating Current Stimulation (tACS) | Electrical | Entrains brain oscillations via sinusoidal AC current. | Superficial cortex | Milliseconds to hours | 3–5 cm | Low | Cognition, sleep (research) |
| Transcranial Random Noise Stimulation (tRNS) | Electrical | Enhances signal-to-noise ratio via random noise. | Superficial cortex | Milliseconds to hours | 3–5 cm | Low | Cognition, pain (research) |
Definition
Transcranial Magnetic Stimulation (TMS) uses magnetic pulses to induce electric currents in the brain, modulating neural activity.
It is based on Faraday’s law of electromagnetic induction.
Mechanism
Types of TMS
| Type | Description | Typical Parameters |
|---|---|---|
| Single-Pulse TMS (spTMS) | Delivers a single pulse to study cortical excitability. | 80–120% of motor threshold (MT). |
| Paired-Pulse TMS | Delivers two pulses with a variable interstimulus interval (ISI) to study intracortical inhibition/facilitation. | ISI: 1–20 ms. |
| Repetitive TMS (rTMS) | Delivers trains of pulses (1–20 Hz or theta-burst) to induce long-lasting effects. | Frequency: 1 Hz (low), 5–20 Hz (high), theta-burst (50 Hz bursts). Intensity: 80–120% MT. |
| Theta-Burst Stimulation (TBS) | A form of rTMS using bursts of 3 pulses at 50 Hz, repeated at 5 Hz. | Protocol: Continuous TBS (cTBS) or Intermittent TBS (iTBS). |
Applications
| Application | Target Region | Stimulation Parameters | Evidence Level |
|---|---|---|---|
| Depression | Left DLPFC | High-frequency rTMS (10 Hz), 120% MT; or iTBS. | FDA-cleared |
| Obsessive-Compulsive Disorder (OCD) | Dorsomedial prefrontal / anterior cingulate cortex | Deep TMS (H7 coil), 20 Hz. | FDA-cleared |
| Migraine (with aura) | Occipital cortex | Single-pulse TMS. | FDA-cleared |
| Smoking cessation | Lateral prefrontal and insular cortex | Deep TMS (H4 coil), 10 Hz. | FDA-cleared |
| Schizophrenia | Temporoparietal cortex | High-frequency rTMS (10 Hz), 110% MT. | Clinical trials |
| Stroke Rehabilitation | Motor cortex | High-frequency rTMS (10 Hz), 110% MT. | Clinical trials |
| Epilepsy | Epileptogenic focus | Low-frequency rTMS (1 Hz), 90% MT. | Clinical trials |
| Chronic Pain | Motor cortex | High-frequency rTMS (10 Hz), 110% MT. | Clinical trials |
| Cognitive Enhancement | DLPFC | Theta-burst stimulation (iTBS), 80% MT. | Experimental |
Advantages
Limitations
Example: High-Frequency rTMS for Depression
Transcranial Direct Current Stimulation (tDCS) delivers a weak direct current (1–2 mA) through electrodes placed on the scalp.
The current modulates neuronal resting membrane potentials, increasing or decreasing excitability.
Mechanism
Types of tDCS
| Type | Description | Typical Parameters |
|---|---|---|
| Anodal tDCS | Anode placed over target region; cathode on contralateral supraorbital area. | Current: 1–2 mA; Duration: 10–30 min. |
| Cathodal tDCS | Cathode placed over target region; anode on contralateral supraorbital area. | Current: 1–2 mA; Duration: 10–30 min. |
| Bifocal tDCS | Anode and cathode placed over two brain regions to modulate connectivity. | Current: 1–2 mA; Duration: 10–30 min. |
| High-Definition tDCS (HD-tDCS) | Uses smaller, high-density electrodes for more focal stimulation. | Current: 1–2 mA; Duration: 10–20 min. |
Applications
| Application | Target Region | Stimulation Parameters | Evidence Level |
|---|---|---|---|
| Depression | Left DLPFC | Anodal tDCS (2 mA, 20 min). | Clinical trials |
| Chronic Pain | Motor cortex | Anodal tDCS (2 mA, 20 min). | Clinical trials |
| Stroke Rehabilitation | Ipsilesional motor cortex | Anodal tDCS (2 mA, 30 min). | Clinical trials |
| Cognitive Enhancement | DLPFC | Anodal tDCS (2 mA, 20 min). | Experimental |
| Schizophrenia | Temporoparietal cortex | Cathodal tDCS (2 mA, 20 min). | Clinical trials |
| Epilepsy | Epileptogenic focus | Cathodal tDCS (2 mA, 20 min). | Clinical trials |
| Addiction | DLPFC | Anodal tDCS (2 mA, 20 min). | Experimental |
Advantages
Limitations
Example: Anodal tDCS for Depression
Transcranial Alternating Current Stimulation (tACS) delivers a sinusoidal alternating current (0.5–2 mA, 1–200 Hz) to entrain brain oscillations.
How It Works
Types of tACS
| Type | Description | Typical Parameters |
|---|---|---|
| Alpha-tACS | Targets 8–12 Hz alpha oscillations. | Frequency: 10 Hz; Current: 0.5–2 mA; Duration: 10–30 min. |
| Theta-tACS | Targets 4–8 Hz theta oscillations. | Frequency: 6 Hz; Current: 0.5–2 mA; Duration: 10–30 min. |
| Gamma-tACS | Targets 30–100 Hz gamma oscillations. | Frequency: 40 Hz; Current: 0.5–2 mA; Duration: 10–30 min. |
Applications
Advantages
Limitations
Transcranial Random Noise Stimulation (tRNS) delivers broadband random noise (0.1–640 Hz) via electrodes to enhance signal-to-noise ratio.
How It Works
Applications
Advantages
Limitations
NeuroAnalyzer includes tools for planning and documenting transcranial electrical stimulation (TES) and for analyzing its effects:
The safety and comparability of TES protocols are described by the delivered charge, the current density and the charge density. For tDCS of 2 mA with 5 × 7 cm (35 cm²) electrodes for 20 minutes:
d = tdcs_dose(; current = 2, pad_area = 35, duration = 20 * 60)
println("Charge: ", round(d.charge; digits = 2), " C")
println("Current density: ", round(d.current_density; digits = 3), " A/m²")
println("Charge density: ", round(d.charge_density; digits = 3), " kC/m²")Charge: 2.4 C
Current density: 0.571 A/m²
Charge density: 0.686 kC/m²
For tACS (2 mA peak-to-peak, 10 Hz) the effective current is the mean absolute current over a cycle:
d = tacs_dose(; current = 2,
pad_area = 35,
duration = 20 * 60,
offset = 0,
frequency = 10,
phase = 0)
println("Charge: ", round(d.charge; digits = 2), " C")
println("Current density: ", round(d.current_density; digits = 3), " A/m²")Charge: 0.76 C
Current density: 0.182 A/m²
tes_protocol() creates a dictionary with all parameters of a stimulation session, e.g. anodal tDCS over F3 with the cathode over Fp2 (sizes in mm, times in seconds):
p = tes_protocol(; type = :tDCS,
hd = false,
current = 2,
anode_size = (50, 70),
cathode_size = (50, 70),
anode_loc = :F3,
cathode_loc = :Fp2,
duration = 20 * 60,
ramp_in = 30,
ramp_out = 30,
sham = false)Dict{Symbol, Any} with 12 entries:
:cathode_size => (50, 70)
:frequency => 0
:anode_loc => :F3
:ramp_out => 30
:duration => 1200
:hd => false
:ramp_in => 30
:current => 2
:anode_size => (50, 70)
:cathode_loc => :Fp2
:type => :tDCS
:sham => false
tes_model() shows a simplified model of the electric potential over the scalp for given anode and cathode locations (the superposition of the contributions of both electrodes, decreasing with the distance in the plane of the cap; it does not model the conduction through the skull and brain):
tes_model(; anode = "F3", cathode = "Fp2")