Importing events with duration from text file

Dear brainstorm developers,

I would like to import events with a duration from a text file. Their format is as follows:
Event-Name Channel_Name Start Event(s) End Event(s)
burst G_A1-G_A2 260 262
What is the best way to import these events into brainstorm?

Thanks for your help!
Marcel

Hi Marcel,

As far as I know, it's not possible to import events from a non-standard file format using the Brainstorm interface. Is this produced by a specific acquisition system or software? If so, we could add support to it in order to benefit other users if you give us some more information.

Otherwise, if this is a one time use, you could make a script to import it yourself. As a starting point, you can have a look at the following importer that also takes as input a column-based text file: https://github.com/brainstorm-tools/brainstorm3/blob/master/toolbox/io/in_events_presentation.m
Or if you simplify your input file to simply the starting and end time of a single event, you can have a look at importing events from an Array of times / Array of samples (*.mat): https://github.com/brainstorm-tools/brainstorm3/blob/master/toolbox/io/in_events_array.m

I hope this helps!
Martin

Hi Marcel,

Was this generated by some standard software or in-house tools?
If this is coming from one of your clinical programs, please send us an example file.

Thanks
Francois

Hi Francois,

thank you for offering your help! It is indeed an output of an in-house developed automatic detector. It marks channel-specific events with duration. There may be different event types in the Column 'Description'. The current output is as follows in a tab separated text file. The output could be modified if needed.

|Data|Description|ChannelName|StartTime(s)EndTime(s)
|d|Spike|G_A1-G_A2|1.941388932066393|2.042951432066393|
|d|Fast oscillations|G_A1-G_A2|2.550763932066393|2.626935807066393|
|d|Spike|G_A1-G_A2|2.918927994566393|2.995099869566393|
|d|Spike|G_A1-G_A2|3.490217057066393|3.553693619566393|
|d|Spike|G_A1-G_A2|5.800763932066393|5.851545182066393|

Best regards
Marcel

Hi Marcel,

For making your request easier generalize, I included the support for the channel-specific events in the BIDS events.tsv file format:
https://github.com/brainstorm-tools/brainstorm3/commit/d5ce65bd50c865f68d1e482e0d1812d7db0422f2#diff-6e011f05992240b370a4601df572dcb3

Change your file format for a BIDS-compatible TSV file (all the values separated with TABS) with the following columns: onset, duration, trial_type, channel
https://bids-specification.readthedocs.io/en/stable/04-modality-specific-files/05-task-events.html

The column "channel" is not documented in the BIDS specification but could be added in any study.
If you don't have a channel to indicate, the BIDS specs recommend using "n/a" instead of a blank field, but both are supported by the file reader in Brainstorm.

Please let me know you have any issue with this solution.
Francois

Hi Francois,

thank you for these changes! The import of channel specific markers in BIDS format worked well, but there remains one bug: Our channels specific markers show up nicely as long as the marked channels are included in the montage that is shown. As soon as the channels with markers are not in the montage shown montage the markers are displayed as general markers that are not specific for a channel. Could you please remove the colored boxes over all channels for the channels that are not shown in the visualized montage? Otherwise these channel specific markings are very useful tools!

Marcel

Done: https://github.com/brainstorm-tools/brainstorm3/commit/de4e536cf6594813858939bdeea717d2225773f3#diff-78feb0cacc7e20dbee746fdc3b4029c9

I'm glad you like it.
Thanks a lot for your valuable feedback!
Francois