v2.0.0
Loading...
Searching...
No Matches
FIFFLIB::FiffEvents Class Reference

FIFF event container with reading, writing and detection. More...

#include <fiff_events.h>

Public Member Functions

 FiffEvents ()
 FiffEvents (QIODevice &p_IODevice)
bool write_to_fif (QIODevice &p_IODevice) const
bool write_to_ascii (QIODevice &p_IODevice, float sfreq=0.0f) const
int num_events () const
bool is_empty () const

Static Public Member Functions

static bool read (const QString &t_sEventName, const QString &t_fileRawName, FiffEvents &p_Events)
static bool read_from_fif (QIODevice &p_IODevice, FiffEvents &p_Events)
static bool read_from_ascii (QIODevice &p_IODevice, FiffEvents &p_Events)
static bool detect_from_raw (const FiffRawData &raw, FiffEvents &p_Events, const QString &triggerCh=QString("STI 014"), unsigned int triggerMask=0xFFFFFFFF, bool leadingEdge=true)
static bool matchEvent (const AverageCategory &cat, const Eigen::MatrixXi &events, int eventIdx)

Public Attributes

Eigen::MatrixXi events

Detailed Description

FIFF event container with reading, writing and detection.

Provides FIFF event storage and I/O operations.

Each event is stored as a row in an Nx3 matrix: [sample, before, after]. The class provides methods to read/write events from/to FIFF or ASCII files, and to detect events from raw data trigger channels.

Definition at line 85 of file fiff_events.h.

Constructor & Destructor Documentation

◆ FiffEvents() [1/2]

FiffEvents::FiffEvents ( )

Default constructor. Creates an empty event set.

Definition at line 69 of file fiff_events.cpp.

◆ FiffEvents() [2/2]

FiffEvents::FiffEvents ( QIODevice & p_IODevice)
explicit

Constructs FiffEvents by reading from an I/O device.

Attempts to read as FIFF first; if that fails, tries ASCII format.

Parameters
[in]p_IODeviceThe I/O device to read from.

Definition at line 75 of file fiff_events.cpp.

Member Function Documentation

◆ detect_from_raw()

bool FiffEvents::detect_from_raw ( const FiffRawData & raw,
FiffEvents & p_Events,
const QString & triggerCh = QString("STI 014"),
unsigned int triggerMask = 0xFFFFFFFF,
bool leadingEdge = true )
static

Detect trigger events from raw data using a stimulus channel. Ported from detect_events (MNE-C).

Parameters
[in]rawThe raw data.
[out]p_EventsThe detected events.
[in]triggerChName of the trigger channel (empty = default "STI 014").
[in]triggerMaskBitmask to apply to trigger values.
[in]leadingEdgeIf true, only detect rising edges (default = true).
Returns
true if events were detected, false otherwise.

Definition at line 287 of file fiff_events.cpp.

◆ is_empty()

bool FIFFLIB::FiffEvents::is_empty ( ) const
inline

Returns true if no events are stored.

Returns
true if the event matrix has zero rows.

Definition at line 232 of file fiff_events.h.

◆ matchEvent()

bool FiffEvents::matchEvent ( const AverageCategory & cat,
const Eigen::MatrixXi & events,
int eventIdx )
static

Check whether an event matches a category definition.

Parameters
[in]catThe averaging category to match against.
[in]eventsFull event matrix (nEvents x 3): [sample, from, to].
[in]eventIdxIndex of the current event row.
Returns
true if the event matches.

Definition at line 351 of file fiff_events.cpp.

◆ num_events()

int FIFFLIB::FiffEvents::num_events ( ) const
inline

Returns the number of events.

Returns
Number of events.

Definition at line 225 of file fiff_events.h.

◆ read()

bool FiffEvents::read ( const QString & t_sEventName,
const QString & t_fileRawName,
FiffEvents & p_Events )
static

Read events from a FIFF or ASCII event file.

If t_sEventName is empty, the event file name is derived from the raw file name (replacing ".fif" with "-eve.fif").

Parameters
[in]t_sEventNamePath to the event file (empty = derive from raw file name).
[in]t_fileRawNamePath to the raw data file (used to derive event file name if needed).
[out]p_EventsThe loaded events.
Returns
true if succeeded, false otherwise.

Definition at line 85 of file fiff_events.cpp.

◆ read_from_ascii()

bool FiffEvents::read_from_ascii ( QIODevice & p_IODevice,
FiffEvents & p_Events )
static

Read a list of events from an ASCII event file.

Parameters
[in]p_IODeviceThe I/O device to read from.
[out]p_EventsThe loaded events.
Returns
true if succeeded, false otherwise.

Definition at line 215 of file fiff_events.cpp.

◆ read_from_fif()

bool FiffEvents::read_from_fif ( QIODevice & p_IODevice,
FiffEvents & p_Events )
static

Read an event list from a FIFF file.

Parameters
[in]p_IODeviceThe I/O device to read from.
[out]p_EventsThe loaded events.
Returns
true if succeeded, false otherwise.

Definition at line 131 of file fiff_events.cpp.

◆ write_to_ascii()

bool FiffEvents::write_to_ascii ( QIODevice & p_IODevice,
float sfreq = 0.0f ) const

Write the event list to a text file (MNE-C compatible format).

Parameters
[in]p_IODeviceThe I/O device to write to.
[in]sfreqSampling frequency for time column computation.
Returns
true if succeeded, false otherwise.

Definition at line 262 of file fiff_events.cpp.

◆ write_to_fif()

bool FiffEvents::write_to_fif ( QIODevice & p_IODevice) const

Write the event list to a FIFF file.

Parameters
[in]p_IODeviceThe I/O device to write to.
Returns
true if succeeded, false otherwise.

Definition at line 243 of file fiff_events.cpp.

Member Data Documentation

◆ events

Eigen::MatrixXi FIFFLIB::FiffEvents::events

Event matrix (nEvents x 3): [sample, before, after].

Definition at line 216 of file fiff_events.h.


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