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):

  1. 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.

  2. 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.

  3. epochs: a ROW vector (1xn) with the epoch that each spike occurred (just assign the number 1 to each one and it will work).

  4. color: A 1x3 vector with the color that the event will be displayed on the Brainstorm viewer. The vector takes values [0,1].

  5. reactTimes: set this to [].

  6. select: set this to 1.

  7. channels: a ROW cell-array (1xn) of empty matrices (optionally, for better visualization of the spikes while displaying timeseries, you can assign a ROW cell array (1xn) with each element being a cell entry {channelLabel})

  8. notes: a ROW cell-array (1xn) of empty matrices


An example events structure is shown here:

eventsConversion_new.png

The electrode with the label “AD06” on this example events file, has 2 neurons that fired 2036, and 670spikes respectively during this recording. The electrode with label “AD03” picked up 9727 spikes assigned to a single neuron/cluster etc.

The filename of the events, 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:

http://neuroimage.usc.edu/brainstorm/Tutorials/EventMarkers


Converting to .csv Events

Alternatively, for simplicity, one can convert their spiking events into a .csv file, and sequentially import that into Brainstorm. The channelLabels follow the same convention as described in the previous section. Each line in the .csv file should be comprised of the channelLabel and the timing of each spiking event in seconds, separated by a comma.

e.g.
SpikesChannel AD03, 7.234
SpikesChannel AD03, 7.386
...
SpikesChannel AD06 |1|, 10.500
SpikesChannel AD06 |1|, 11.356
...
SpikesChannel AD06 |2|, 11.234
SpikesChannel AD06 |2|, 11.834
...

e-phys/ConvertToBrainstormEvents (last edited 2022-04-05 22:00:33 by ?Konstantinos Nasiotis)