v2.0.0
Loading...
Searching...
No Matches
MNELIB::MNEEventList Class Reference

Ordered list of trigger events with comments. More...

#include <mne_event_list.h>

Public Member Functions

bool writeFif (const QString &path, int offset=0) const
void sort ()
void append (const MNEEventList &other)
MNEEventList selectOnsets (unsigned int value=0) const
unsigned int maxOnset () const
Eigen::MatrixXi toMatrix () const
int nevent () const
 Returns the number of events in the list.

Static Public Member Functions

static std::optional< MNEEventList > readFif (const QString &path, int offset=0)
static std::optional< MNEEventList > readText (const QString &path, int offset, int oldOffset, float sfreq)
static MNEEventList fromMatrix (const Eigen::MatrixXi &matrix)

Public Attributes

std::vector< MNEEvent > events

Detailed Description

Ordered list of trigger events with comments.

Definition at line 49 of file mne_event_list.h.

Member Function Documentation

◆ append()

void MNEEventList::append ( const MNEEventList & other)

Appends the events of another list (MNE-C mne_add_to_event_list).

Parameters
[in]otherThe events to append.

Definition at line 191 of file mne_event_list.cpp.

◆ fromMatrix()

MNEEventList MNEEventList::fromMatrix ( const Eigen::MatrixXi & matrix)
static

Builds a list from rows of sample, value before and value after.

Parameters
[in]matrixnEvents x 3 matrix as returned by toMatrix().
Returns
The events, without comments.

Definition at line 233 of file mne_event_list.cpp.

◆ maxOnset()

unsigned int MNEEventList::maxOnset ( ) const

Returns the largest trigger value that starts from 0.

Returns
The largest onset value, 0 for a list without onsets.

Definition at line 209 of file mne_event_list.cpp.

◆ nevent()

int MNELIB::MNEEventList::nevent ( ) const
inline

Returns the number of events in the list.

Returns
Number of events.

Definition at line 151 of file mne_event_list.h.

◆ readFif()

std::optional< MNEEventList > MNEEventList::readFif ( const QString & path,
int offset = 0 )
static

Reads the event block of a FIFF file (MNE-C mne_load_events_fiff).

Parameters
[in]pathA -eve.fif file or a raw file carrying an event block.
[in]offsetSamples to subtract from every event, e.g. the first sample of the recording.
Returns
The events with their comments, or no value if the file has no event block.

Definition at line 50 of file mne_event_list.cpp.

◆ readText()

std::optional< MNEEventList > MNEEventList::readText ( const QString & path,
int offset,
int oldOffset,
float sfreq )
static

Reads an MNE-C text event file (MNE-C mne_load_events).

Each line holds sample, time, trigger value before and after, and an optional comment; # starts a comment line. A negative sample is computed from the time. A first line with both trigger values 0 marks the current format: it gives the first sample of the recording and is not an event. Old files have no such line; their samples are shifted by oldOffset instead.

Parameters
[in]pathThe text file.
[in]offsetSamples to subtract from every event (the recording's first sample).
[in]oldOffsetExtra offset used by files in the old format.
[in]sfreqSampling frequency, to convert times of events without a sample.
Returns
The events, or no value if the file cannot be read or holds no events.

Definition at line 85 of file mne_event_list.cpp.

◆ selectOnsets()

MNEEventList MNEEventList::selectOnsets ( unsigned int value = 0) const

Keeps the onsets of one trigger value (MNE-C filter_events): events rising from 0 to value, or every onset if value is 0.

Parameters
[in]valueThe trigger value to keep, or 0 for all onsets.
Returns
The selected events in their original order.

Definition at line 198 of file mne_event_list.cpp.

◆ sort()

void MNEEventList::sort ( )

Sorts the events by sample; events at the same sample keep their order.

Definition at line 182 of file mne_event_list.cpp.

◆ toMatrix()

Eigen::MatrixXi MNEEventList::toMatrix ( ) const

Returns the events as rows of sample, value before and value after, the layout of FIFFLIB::FiffEvents::events and of mne.read_events.

Returns
nEvents x 3 matrix.

Definition at line 222 of file mne_event_list.cpp.

◆ writeFif()

bool MNEEventList::writeFif ( const QString & path,
int offset = 0 ) const

Writes the list as an event block with comments, readable by mne.read_events.

Parameters
[in]pathThe output file.
[in]offsetSamples to add back to every event.
Returns
True if the file was written.

Definition at line 139 of file mne_event_list.cpp.

Member Data Documentation

◆ events

std::vector<MNEEvent> MNELIB::MNEEventList::events

The events.

Definition at line 156 of file mne_event_list.h.


The documentation for this class was generated from the following files: