Skip to main content

MNEEvent

Namespace: MNELIB  ·  Library: MNE Library

#include <mne/mne_event.h>

class MNELIB::MNEEvent

Single trigger-event marker.

Records a stimulus transition (from one value to another) at a given sample position, together with an optional free-text comment.

src/examples/ex_mne_api/main.cpp
// Annotate the detected onsets, save them with their comments and read them back relative to the first sample
MNEEventList annotated = MNEEventList::fromMatrix(events.events).selectOnsets();
annotated.sort();
for (MNEEvent& event : annotated.events) {
event.comment = event.to == 1 ? "left auditory" : QString();
}
const QString commentedName = tmp.filePath("commented-eve.fif");
annotated.writeFif(commentedName);
const auto relative = MNEEventList::readFif(commentedName, raw.first_samp);
const MNEEventList leftAuditory = relative->selectOnsets(1);

Example​

Used in examples​

ex_mne_api​

MNE library: BEM surfaces, surface projection, ICP, source spaces and epochs.

src/examples/ex_mne_api/main.cpp, line 482
// Annotate the detected onsets, save them with their comments and read them back relative to the first sample
MNEEventList annotated = MNEEventList::fromMatrix(events.events).selectOnsets();
annotated.sort();
for (MNEEvent& event : annotated.events) {
event.comment = event.to == 1 ? "left auditory" : QString();
}
const QString commentedName = tmp.filePath("commented-eve.fif");
annotated.writeFif(commentedName);
const auto relative = MNEEventList::readFif(commentedName, raw.first_samp);
const MNEEventList leftAuditory = relative->selectOnsets(1);
// mne.find_events: 25 onsets, codes up to 32, 6 of code 1, the first at 14385 - 12900
ok &= expect(annotated.nevent() == 25 && annotated.maxOnset() == 32 && leftAuditory.nevent() == 6 && leftAuditory.events[0].sample == 14385 - 12900 && leftAuditory.events[0].comment == "left auditory" && relative->events[0].comment.isEmpty(),
"MNEEventList/MNEEvent: commented event file, onsets selected like mne.find_events");

Authors of this file​