Converting to Brainstorm Events
Author: Konstantinos Nasiotis
In case you have data that have already been spike-sorted, you can use the spike-timestamps as separate events for each electrode and import the events from a single events file for your analysis. Brainstorm needs its events to be in a specific format, so they can be imported. Moreover, the functions that use spike-events, will use those events only if you label the events properly and construct the events in the appropriate format.
What you need to do so you can import your spikes, is to create a structure named events in Matlab, and add one entry per neuron on each electrode recorded. The entry should be per neuron, since there are electrodes that might pick up spikes from several neurons.
The following convention for the spiking events is used throughout this toolbox:
“Spikes Channel channelLabel”, where channelLabel is the Label of the electrode assigned by the acquisition system.
If the spike-sorter assigned the spikes’ waveforms into more than one cluster/neuron during this automatic clustering, the neuronal events would be (e.g. for an electrode that picked up spikes from 3 neurons):
“Spikes Channel channelLabel |1|”, “Spikes Channel channelLabel |2|”, “Spikes Channel channelLabel |3|”
Each entry should have the following fields (see reference documentation):
label: The label of the spike events. It should read: “Spikes Channel channelLabel” where channelLabel is the label of the electrode. In the case where multiple neurons are recorded from a single electrode, the label of the events should be: “Spikes Channel channelLabel |iNeuron|”, where channelLabel is the label of the electrode and iNeuron the number of the neuron on that electrode.
times: a ROW vector (1xn where n is the number of spikes) with the timestamps of the spikes that the neuron fired, in seconds. The latencies should be aligned strictly on existing samples, to enforce this: times=round(times*sfreq)/sfreq.
epochs: a ROW vector (1xn) with the epoch that each spike occurred (just assign the number 1 to each one and it will work).
color: A 1x3 vector with the color that the event will be displayed on the Brainstorm viewer. The vector takes values [0,1].
reactTimes: set this to .
select: set this to 1.
channels: a ROW cell-array (1xn) of empty matrices
notes: a ROW cell-array (1xn) of empty matrices
An example events structure is shown here:
The electrode with the label “raw 1” on this example events file, has 3 neurons that fired 2253, 159 and 83 spikes respectively during this recording. The electrode with label “raw 11” picked up 1181 spikes assigned to a single neuron/cluster etc.
The filename of the events that needs to be saved in the end, should start with the string "events". Example: “events_filename.mat” and should contain the events structure as described above.
The page about events on Brainstorm’s Tutorial describes briefly how you can deal with events that are already imported: