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_EEG
— Functionread_EEG(fname::AbstractString)
read_EEG(args...)
Read a file or IO stream and store the data in an GeneralEEG
type.
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)remove_first
: Number of epochs to be removed from start of recording (0)max_epochs
: Maximum number of epochs to retain (0 = all)
Supported file formats
- BIOSEMI (.bdf)
Querying data
Neuroimaging.samplingrate
— Methodsamplingrate(t::Type, s::EEG)
samplingrate(s::EEG)
Return the sampling rate of an EEG type in Hz as the requested type. If no type is provided, the sampling rate is returned as a floating point number.
Examples
s = read_EEG(filename)
samplingrate(s)
Neuroimaging.channelnames
— Methodchannelnames(s::EEG)
Return the names of sensors in EEG measurement.
Examples
s = read_EEG(filename)
channelnames(s)
Neuroimaging.sensors
— Methodsensors(s::EEG)
channelnames(s::EEG, l::AbstractVector{AbstractString})
Returns the sensors for an EEG recording.
Examples
s = read_EEG(filename)
sensors(s)
Neuroimaging.data
— Methoddata(s::EEG)
data(s::EEG, channel::AbstractString)
data(s::EEG, channels::AbstractVector{AbstractString})
Return the data stored in the type object. This may be useful for integration with custom processing.
Examples
s = read_EEG(filename)
data(s)
data(s, "Cz")
data(s, ["Cz", "P2"])
Manipulating data
Base.hcat
— Methodhcat(a::EEG, b::EEG)
Concatenate two EEG measurements together, effectively creating a single long measurement.
Examples
hcat(a, b)
Neuroimaging.add_channel
— Methodadd_channel(a::EEG, data::Vector, chanLabel::AbstractString)
Add a channel to the EEG type with specified channel names.
Examples
s = read_EEG(filename)
new_channel = mean(s.data, 2)
s = add_channel(s, new_channel, "MeanChannelData")
Neuroimaging.remove_channel!
— Methodremove_channel!(a::EEG, channelname::AbstractString)
remove_channel!(a::EEG, channelnames::Array{AbstractString})
remove_channel!(a::EEG, channelidx::Int)
remove_channel!(a::EEG, channelidxs::Array{Int})
Remove channel(s) from EEG as specifed by channelname
or channelidx
.
Examples
a = read_EEG(filename)
remove_channel!(a, ["TP8", "Cz"])
Neuroimaging.keep_channel!
— Methodkeep_channel!(a::EEG, channelname::AbstractString)
keep_channel!(a::EEG, channelnames::Array{AbstractString})
keep_channel!(a::EEG, channelidxs::Array{Int})
Remove all channels except those requested from EEG.
Examples
a = read_EEG(filename)
keep_channel!(a, ["P8", "Cz"])
Neuroimaging.trim_channel
— Methodtrim_channel(a::EEG, stop::Int; start::Int=1)
Trim EEG recording by removing data after stop
specifed samples and optionally before start
samples.
Examples
s = trim_channel(s, 8192*300, start=8192)
Neuroimaging.merge_channels
— Functionmerge_channels(a::EEG, merge_Chans::Array{S}, new_name::S) where {S<:AbstractString}
merge_channels(a::EEG, merge_Chans::S, new_name::S) where {S<:AbstractString}
Average EEG
channels listed in merge_Chans
and label the averaged channel as new_name
.
Examples
s = merge_channels(s, ["P6", "P8"], "P68")
Filtering
Neuroimaging.filter_highpass
— Methodfilter_highpass(a::EEG; cutOff::Real=2, fs::Real=samplingrate(a), order::Int=0, kwargs...)
Apply a high pass filter.
If order is zero then its computed magically.
Examples
a = read_EEG(fname)
b = filter_highpass(a)
c = filter_highpass(a, cutOff = 1)
Neuroimaging.filter_lowpass
— Methodfilter_lowpass(a::EEG; cutOff::Real=150, fs::Real=samplingrate(a), order::Int=0, kwargs...)
Apply a low pass filter.
If order is zero then its computed magically.
Examples
a = read_EEG(fname)
b = filter_lowpass(a)
c = filter_lowpass(a, cutOff = 1)
Epoching
Neuroimaging.epoch_rejection
— Methodepoch_rejection(a::EEG; retain_percentage::Number = 0.95, kwargs...)
Reject epochs such that retain_percentage
is retained.