Functions
In addition to the function available for processing EEG data, a number of functions are provided specifically for the processing of SSR data
Import
Neuroimaging.read_SSR
— FunctionRead SSR from file or IO stream
Read a file or IO stream and store the data in an SSR
type.
Matching .mat files are read and modulation frequency information extracted. Failing that, user passed arguments are used or the modulation frequency is extracted from the file name.
Arguments
fname
: Name of the file to be readmin_epoch_length
: Minimum epoch length in samples. Shorter epochs will be removed (0)max_epoch_length
: Maximum epoch length in samples. Longer epochs will be removed (0 = all)valid_triggers
: Triggers that are considered valid, others are removed ([1,2])stimulation_amplitude
: Amplitude of stimulation (NaN)modulationrate
: Modulation frequency of SSR stimulation (NaN)carrier_frequency
: Carrier frequency (NaN)participant_name
: Name of participant ("")remove_first
: Number of epochs to be removed from start of recording (0)max_epochs
: Maximum number of epochs to retain (0 = all)env
(nothing)bkt
("")
Supported file formats
- BIOSEMI (.bdf)
Filtering
Neuroimaging.filter_highpass
— Methodfilter_highpass(a::SSR; cutOff::Real=2, fs::Real=samplingrate(a), order::Int=3, tolerance::Real=0.01, kwargs...)
Applly a high pass filter.
A zero phase high pass filter is applied to the data using filtfilt
. A check is performed to ensure the filter does not affect the modulation rate. The filter coefficents are stored in the processing field.
Examples
a = read_SSR(fname)
b = filter_highpass(a)
c = filter_highpass(a, cutOff = 1)
Neuroimaging.filter_lowpass
— Methodfilter_lowpass(a::SSR; cutOff::Real=150, fs::Real=samplingrate(a), order::Int=3, tolerance::Real=0.01, kwargs...)
Applly a low pass filter.
A zero phase high pass filter is applied to the data using filtfilt
. A check is performed to ensure the filter does not affect the modulation rate. The filter coefficents are stored in the processing field.
Examples
a = read_SSR(fname)
b = filter_lowpass(a)
c = filter_lowpass(a, cutOff = 1)
Neuroimaging.filter_bandpass
— Methodfilter_bandpass(a::SSR; lower::Number=modulationrate(a) - 1, upper::Number=modulationrate(a) + 1, fs::Real=samplingrate(a), n::Int=24, rp::Number = 0.0001, tolerance::Real=0.01, kwargs...)
Applly a band pass filter. A check is performed to ensure the filter does not affect the modulation rate. The filter coefficents are stored in the processing field.
Examples
a = read_SSR(fname)
a = filter_bandpass(a)
Neuroimaging.downsample
— Methoddownsample(s::SSR, ratio::Rational)
Downsample signal by specified ratio.
Preprocessing
Neuroimaging.extract_epochs
— Methodfunction extract_epochs(a::SSR; valid_triggers::Union{AbstractArray,Int} = [1, 2], remove_first::Int = 0, remove_last::Int = 0, kwargs...)
Extract epoch data from SSR
Arguments
a
: A SSR objectvalid_triggers
: Trigger numbers that are considered valid ([1,2])remove_first
: Remove the first n triggers (0)remove_last
: Remove the last n triggers (0)
Examples
epochs = extract_epochs(SSR, valid_triggers=[1,2])
Statistics
Neuroimaging.ftest
— Methodftest(s::SSR)
ftest(s::SSR; kwargs...)
Run f-test statistics on steady state response measurement.
Arguments
freq_of_interest
: Frequency to analyse for presence of a responseside_freq
: Adjacent frequencies above and below the frequency of interest used to quantify the noiseID
: Participant ID for storage in resulting dataframespill_bins
: Number of bins each side of the FFT bin of interes to ignore in noise computationresults_key
: Dictionary key name to store results ins.processing
Examples
s = read_SSR(fname)
s.modulationrate = 33.2u"Hz"
s = ftest(s)
println(s.processing['statistics'])
Reference
Hofmann, M., Wouters, J. Improved Electrically Evoked Auditory Steady-State Response Thresholds in Humans. JARO 13, 573–589 (2012). https://doi.org/10.1007/s10162-012-0321-8
Luke, Robert, and Jan Wouters. "Kalman filter based estimation of auditory steady state response parameters." IEEE Transactions on Neural Systems and Rehabilitation Engineering 25.3 (2016): 196-204.
Plotting
Neuroimaging.plot_spectrum
— Methodplot_spectrum(eeg::SSR, chan::Int; kwargs...)
plot_spectrum(eeg::SSR, chan::AbstractString; kwargs...)
Plot the spectrum of a steady state response measurement.