FIFF event list: (sample, prev, new) integer triples with read / write / detect / filter helpers.
More...
#include <fiff_events.h>
|
| 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) |
| static FiffEvents | concatenate (const QList< FiffEvents > &events, const QList< int > &firstSamps, const QList< int > &lastSamps) |
| static FiffEvents | find_stim_steps (const Eigen::MatrixXi &stimData, int firstSamp, std::optional< int > padStart=std::nullopt, std::optional< int > padStop=std::nullopt, int merge=0) |
| static FiffEvents | make_fixed_length (const FiffRawData &raw, int id=1, double start=0.0, double stop=-1.0, double duration=1.0, bool firstSamp=true, double overlap=0.0) |
FIFF event list: (sample, prev, new) integer triples with read / write / detect / filter helpers.
On-disk representation matches mne.io.write.write_events output and the -eve.fif files consumed by mne.read_events; the detection path mirrors mne.find_events. Used by FiffEpochs and the batch-averaging path in FiffEvokedSet to drive epoch extraction.
Definition at line 75 of file fiff_events.h.
◆ FiffEvents() [1/2]
| FIFFLIB::FiffEvents::FiffEvents |
( |
| ) |
|
Default constructor. Creates an empty event set.
◆ FiffEvents() [2/2]
| FIFFLIB::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_IODevice | The I/O device to read from. |
◆ concatenate()
| FiffEvents FiffEvents::concatenate |
( |
const QList< FiffEvents > & | events, |
|
|
const QList< int > & | firstSamps, |
|
|
const QList< int > & | lastSamps ) |
|
static |
Concatenate the events of consecutive recordings, like mne.concatenate_events.
- Parameters
-
| [in] | events | Events of each recording. |
| [in] | firstSamps | First sample of each recording. |
| [in] | lastSamps | Last sample of each recording. |
- Returns
- Events on the sample axis of the concatenated recording (empty if the list lengths differ).
Definition at line 493 of file fiff_events.cpp.
◆ count()
| QMap< int, int > FiffEvents::count |
( |
const QList< int > & | ids = {} | ) |
const |
Count the events per code (column 2), like mne.count_events.
- Parameters
-
| [in] | ids | Codes to report (0 if absent); if empty, every code that occurs. |
- Returns
- Code to count.
Definition at line 479 of file fiff_events.cpp.
◆ detect_from_raw()
| bool FIFFLIB::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] | raw | The raw data. |
| [out] | p_Events | The detected events. |
| [in] | triggerCh | Name of the trigger channel (empty = default "STI 014"). |
| [in] | triggerMask | Bitmask to apply to trigger values. |
| [in] | leadingEdge | If true, only detect rising edges (default = true). |
- Returns
- true if events were detected, false otherwise.
◆ find_stim_steps()
| FiffEvents FiffEvents::find_stim_steps |
( |
const Eigen::MatrixXi & | stimData, |
|
|
int | firstSamp, |
|
|
std::optional< int > | padStart = std::nullopt, |
|
|
std::optional< int > | padStop = std::nullopt, |
|
|
int | merge = 0 ) |
|
static |
Find the samples where all stimulus channels change at once, like mne.find_stim_steps.
- Parameters
-
| [in] | stimData | Stimulus channel data (channels x samples); steps carry the values of the first row. |
| [in] | firstSamp | Sample number of the first column. |
| [in] | padStart | If set, a step from this value at sample 0 is added when the data start elsewhere. |
| [in] | padStop | If set, a step to this value after the last sample is added. |
| [in] | merge | Merge steps at most |merge| samples apart (> 0: into the later, < 0: into the earlier). |
- Returns
- Steps as [sample, value before, value after].
Definition at line 517 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 307 of file fiff_events.h.
◆ make_fixed_length()
| FiffEvents FiffEvents::make_fixed_length |
( |
const FiffRawData & | raw, |
|
|
int | id = 1, |
|
|
double | start = 0.0, |
|
|
double | stop = -1.0, |
|
|
double | duration = 1.0, |
|
|
bool | firstSamp = true, |
|
|
double | overlap = 0.0 ) |
|
static |
Events at regular intervals, like mne.make_fixed_length_events.
- Parameters
-
| [in] | raw | The recording. |
| [in] | id | Event code. |
| [in] | start | First event time in s. |
| [in] | stop | Time in s after which no event may start (negative: end of the recording). |
| [in] | duration | Duration of each segment in s. |
| [in] | firstSamp | Whether times count from the recording's first sample (true) or from 0. |
| [in] | overlap | Overlap of consecutive segments in s, 0 <= overlap < duration. |
- Returns
- The events (empty if none fit or the overlap is invalid).
Definition at line 567 of file fiff_events.cpp.
◆ matchEvent()
| bool FIFFLIB::FiffEvents::matchEvent |
( |
const AverageCategory & | cat, |
|
|
const Eigen::MatrixXi & | events, |
|
|
int | eventIdx ) |
|
static |
Check whether an event matches a category definition.
- Parameters
-
| [in] | cat | The averaging category to match against. |
| [in] | events | Full event matrix (nEvents x 3): [sample, from, to]. |
| [in] | eventIdx | Index of the current event row. |
- Returns
- true if the event matches.
◆ merge()
| FiffEvents FiffEvents::merge |
( |
const QList< int > & | ids, |
|
|
int | newId, |
|
|
bool | replaceEvents = true ) const |
Replace codes in both code columns by a new one, like mne.merge_events.
- Parameters
-
| [in] | ids | Codes to replace. |
| [in] | newId | The new code. |
| [in] | replaceEvents | If false, the original events are kept as well, sorted by row. |
- Returns
- The merged events.
Definition at line 448 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 300 of file fiff_events.h.
◆ pick()
| FiffEvents FiffEvents::pick |
( |
const QList< int > & | include, |
|
|
const QList< int > & | exclude = {}, |
|
|
bool | step = false ) const |
Select events by code, like mne.pick_events.
- Parameters
-
| [in] | include | Codes to keep; if empty, all codes except exclude are kept. |
| [in] | exclude | Codes to drop when include is empty. |
| [in] | step | Also match the code before the step (column 1). |
- Returns
- The selected events in their original order.
Definition at line 432 of file fiff_events.cpp.
◆ read()
| bool FIFFLIB::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_sEventName | Path to the event file (empty = derive from raw file name). |
| [in] | t_fileRawName | Path to the raw data file (used to derive event file name if needed). |
| [out] | p_Events | The loaded events. |
- Returns
- true if succeeded, false otherwise.
◆ read_from_ascii()
| bool FIFFLIB::FiffEvents::read_from_ascii |
( |
QIODevice & | p_IODevice, |
|
|
FiffEvents & | p_Events ) |
|
static |
Read a list of events from an ASCII event file.
- Parameters
-
| [in] | p_IODevice | The I/O device to read from. |
| [out] | p_Events | The loaded events. |
- Returns
- true if succeeded, false otherwise.
◆ read_from_fif()
| bool FIFFLIB::FiffEvents::read_from_fif |
( |
QIODevice & | p_IODevice, |
|
|
FiffEvents & | p_Events ) |
|
static |
Read an event list from a FIFF file.
- Parameters
-
| [in] | p_IODevice | The I/O device to read from. |
| [out] | p_Events | The loaded events. |
- Returns
- true if succeeded, false otherwise.
◆ write_to_ascii()
| bool FIFFLIB::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_IODevice | The I/O device to write to. |
| [in] | sfreq | Sampling frequency for time column computation. |
- Returns
- true if succeeded, false otherwise.
◆ write_to_fif()
| bool FIFFLIB::FiffEvents::write_to_fif |
( |
QIODevice & | p_IODevice | ) |
const |
Write the event list to a FIFF file.
- Parameters
-
| [in] | p_IODevice | The I/O device to write to. |
- Returns
- true if succeeded, false otherwise.
◆ events
| Eigen::MatrixXi FIFFLIB::FiffEvents::events |
Event matrix (nEvents x 3): [sample, before, after].
Definition at line 291 of file fiff_events.h.
The documentation for this class was generated from the following files: