FiffAnnotations
Namespace: FIFFLIB · Library: FIFF Library
Python equivalent
mne.Annotations in MNE-Python.
#include <fiff/fiff_annotations.h>
class FIFFLIB::FiffAnnotations
Container for FiffAnnotation entries with FIFF, JSON and CSV serializers.
Read and written under FIFFB_MNE_ANNOTATIONS so the annotation list travels with the FIFF file. The JSON and CSV exporters let the same annotations be consumed by BIDS sidecars and by external scoring tools that do not understand FIFF directly.
src/examples/ex_fiff_api/main.cpp
MatrixXi firstThree = events.events.topRows(3);
FiffAnnotations annotations = annotationsFromEvents(firstThree, info.sfreq, {{1, "auditory/left"}, {2, "auditory/right"}}, raw.first_samp);
const FiffAnnotation blink{0.5, 1.0, "BAD_blink", {}, {}, {}}; // onset s, duration s, description, channels, ...
annotations.append(blink);
FiffAnnotations::write(tmp.filePath("annot.csv"), annotations);
const FiffAnnotations annotationsBack = FiffAnnotations::read(tmp.filePath("annot.csv"));
const MatrixXi eventsAgain = eventsFromAnnotations(annotationsBack.select("auditory"), info.sfreq, {{"auditory/left", 1}, {"auditory/right", 2}}, raw.first_samp);
Public Methods
FiffAnnotations()
Constructs an empty FiffAnnotations object.
size()
Returns the number of annotations.
Returns:
- int — Number of annotations.