Identifies epileptiform spike discharges in multi-channel EEG using either morphology-based derivative analysis or template matching via cross-correlation. The morphology method detects sharp transients by thresholding the first derivative, while the template method cross-correlates a canonical spike waveform with each channel.
Usage
eegSpikeDetect(
x,
method = c("morphology", "template"),
threshold_sd = 4,
min_duration_ms = 20,
max_duration_ms = 200,
min_amplitude = 50,
assay_name = NULL
)Arguments
- x
A PhysioExperiment object with EEG data.
- method
Detection method:
"morphology"(derivative-based) or"template"(cross-correlation with canonical spike shape).- threshold_sd
Number of standard deviations above the mean derivative magnitude for detection (default: 4).
- min_duration_ms
Minimum spike duration in milliseconds (default: 20).
- max_duration_ms
Maximum spike duration in milliseconds (default: 200).
- min_amplitude
Minimum peak amplitude in microvolts for a valid spike detection (default: 50).
- assay_name
Name of the assay to use. If
NULL, the default assay is used.
Value
A data.frame with columns:
- channel
Integer channel index.
- sample
Integer sample index of the spike peak.
- time_sec
Time of the spike in seconds.
- amplitude
Peak amplitude at the spike location.
- duration_ms
Estimated spike duration in milliseconds.
- confidence
Confidence score for the detection.
References
Nuwer, M. R., et al. (1999). IFCN standards for digital recording of clinical EEG. Electroencephalography and Clinical Neurophysiology, 106(3), 259-261.
Examples
pe <- make_eeg_spikes(n_time = 30000, n_channels = 19, sr = 500, n_spikes = 15)
spikes <- eegSpikeDetect(pe, method = "morphology")
head(spikes)
#> channel sample time_sec amplitude duration_ms confidence
#> 1 1 4668 9.334 234.5476 24 1
#> 2 1 18795 37.588 273.8889 166 1
#> 3 2 13100 26.198 283.5217 26 1
#> 4 13 10440 20.878 239.4109 52 1
#> 5 18 6120 12.238 279.9133 46 1
#> 6 18 16608 33.214 169.3206 128 1