Skip to main content

BidsEvent

Namespace: BIDSLIB  ·  Library: BIDS Library

#include <bids/bids_event.h>

struct BIDSLIB::BidsEvent

Single event annotation, typically parsed from or written to *_events.tsv.

Each event represents a discrete occurrence during the recording, such as a stimulus presentation, button press, or seizure onset.

src/examples/ex_bids/main.cpp
const BidsDatasetDescription description = BidsDatasetDescription::read(root + "/dataset_description.json");
const QList<BidsChannel> channels = BidsChannel::readTsv(channelsTsv); // one row per channel
const QList<BidsEvent> events = BidsEvent::readTsv(ieeg.eventsTsvPath().filePath()); // onset, duration, sample, value, trial_type
const QList<BidsElectrode> electrodes = BidsElectrode::readTsv(ieeg.electrodesTsvPath().filePath());
const BidsCoordinateSystem coords = BidsCoordinateSystem::readJson(ieeg.coordsystemJsonPath().filePath());

Static Methods​

readTsv(sFilePath)​

Read a BIDS *_events.tsv file.

Parses onset, duration, sample, value, and trial_type columns. Missing or "n/a" fields default to zero / empty.

Parameters:

  • sFilePath : const QString & Path to the events.tsv file.

Returns:


writeTsv(sFilePath, events)​

Write a BIDS *_events.tsv file.

Parameters:

  • sFilePath : const QString & Output path.

  • events : const QList< BidsEvent > & List of events.

Returns:

  • bool — true on success.

Example​

Used in examples​

ex_bids​

BIDS library: paths, sidecar TSVs, BrainVision/EDF readers and a raw-data round trip.

src/examples/ex_bids/main.cpp, line 109
const BidsDatasetDescription description = BidsDatasetDescription::read(root + "/dataset_description.json");
const QList<BidsChannel> channels = BidsChannel::readTsv(channelsTsv); // one row per channel
const QList<BidsEvent> events = BidsEvent::readTsv(ieeg.eventsTsvPath().filePath()); // onset, duration, sample, value, trial_type
const QList<BidsElectrode> electrodes = BidsElectrode::readTsv(ieeg.electrodesTsvPath().filePath());
const BidsCoordinateSystem coords = BidsCoordinateSystem::readJson(ieeg.coordsystemJsonPath().filePath());
ok &= expect(description.name == "MNE-CPP Test Dataset" && description.bidsVersion == "1.9.0" && channels.size() == 32 && channels[0].name == "FP1" && channels[0].units == "µV" && events.size() == 4 && events[3].sample == 5250 && events[3].value == 3 && events[3].trialType == "feedback" && electrodes.size() == 10 && electrodes[0].name == "FP1" && electrodes[0].x == "-0.0254" && coords.system == "ACPC" && coords.units == "m",
"dataset_description, channels/events/electrodes.tsv and coordsystem.json read as written");

Authors of this file​