Container for FIFF annotations with I/O in JSON and CSV formats. More...
#include <fiff_annotations.h>
Public Types | |
| typedef QSharedPointer< FiffAnnotations > | SPtr |
| typedef QSharedPointer< const FiffAnnotations > | ConstSPtr |
Public Member Functions | |
| FiffAnnotations () | |
| int | size () const |
| bool | isEmpty () const |
| const FiffAnnotation & | operator[] (int index) const |
| FiffAnnotation & | operator[] (int index) |
| void | append (const FiffAnnotation &annotation) |
| void | append (double onset, double duration, const QString &description, const QStringList &channelNames=QStringList(), const QString &comment=QString()) |
| void | remove (int index) |
| void | clear () |
| const QVector< FiffAnnotation > & | toVector () const |
| int | onsetToSample (int index, double sfreq, int firstSample=0) const |
| int | endToSample (int index, double sfreq, int firstSample=0) const |
| FiffAnnotations | select (const QString &descriptionFilter) const |
| FiffAnnotations | selectByChannel (const QString &channelName) const |
| FiffAnnotations | crop (double tmin, double tmax) const |
Static Public Member Functions | |
| static FiffAnnotations | readJson (const QString &path) |
| static bool | writeJson (const QString &path, const FiffAnnotations &annot) |
| static FiffAnnotations | readCsv (const QString &path) |
| static bool | writeCsv (const QString &path, const FiffAnnotations &annot) |
| static FiffAnnotations | read (const QString &path) |
| static bool | write (const QString &path, const FiffAnnotations &annot) |
Container for FIFF annotations with I/O in JSON and CSV formats.
Definition at line 79 of file fiff_annotations.h.
| typedef QSharedPointer<const FiffAnnotations> FIFFLIB::FiffAnnotations::ConstSPtr |
Const shared pointer type.
Definition at line 83 of file fiff_annotations.h.
| typedef QSharedPointer<FiffAnnotations> FIFFLIB::FiffAnnotations::SPtr |
Shared pointer type.
Definition at line 82 of file fiff_annotations.h.
| FiffAnnotations::FiffAnnotations | ( | ) |
Constructs an empty FiffAnnotations object.
Definition at line 63 of file fiff_annotations.cpp.
| void FiffAnnotations::append | ( | const FiffAnnotation & | annotation | ) |
Appends an annotation.
| [in] | annotation | The annotation to append. |
Definition at line 97 of file fiff_annotations.cpp.
| void FiffAnnotations::append | ( | double | onset, |
| double | duration, | ||
| const QString & | description, | ||
| const QStringList & | channelNames = QStringList(), | ||
| const QString & | comment = QString() ) |
Appends an annotation by fields.
| [in] | onset | Onset in seconds. |
| [in] | duration | Duration in seconds. |
| [in] | description | Description label. |
| [in] | channelNames | Channel names (empty for global). |
| [in] | comment | Optional comment. |
Definition at line 104 of file fiff_annotations.cpp.
| void FiffAnnotations::clear | ( | ) |
Removes all annotations.
Definition at line 125 of file fiff_annotations.cpp.
| FiffAnnotations FiffAnnotations::crop | ( | double | tmin, |
| double | tmax ) const |
Returns annotations overlapping [tmin, tmax], clipping partially overlapping ones.
| [in] | tmin | Start time in seconds. |
| [in] | tmax | End time in seconds. |
Definition at line 180 of file fiff_annotations.cpp.
| int FiffAnnotations::endToSample | ( | int | index, |
| double | sfreq, | ||
| int | firstSample = 0 ) const |
Converts end (onset+duration) of annotation at index to a sample number.
| [in] | index | Annotation index. |
| [in] | sfreq | Sampling frequency in Hz. |
| [in] | firstSample | First sample offset. |
Definition at line 146 of file fiff_annotations.cpp.
| bool FiffAnnotations::isEmpty | ( | ) | const |
Returns true if no annotations are stored.
Definition at line 76 of file fiff_annotations.cpp.
| int FiffAnnotations::onsetToSample | ( | int | index, |
| double | sfreq, | ||
| int | firstSample = 0 ) const |
Converts onset of annotation at index to a sample number.
| [in] | index | Annotation index. |
| [in] | sfreq | Sampling frequency in Hz. |
| [in] | firstSample | First sample offset. |
Definition at line 139 of file fiff_annotations.cpp.
| FiffAnnotation & FiffAnnotations::operator[] | ( | int | index | ) |
Subscript operator.
| [in] | index | Index of the annotation. |
Definition at line 90 of file fiff_annotations.cpp.
| const FiffAnnotation & FiffAnnotations::operator[] | ( | int | index | ) | const |
Const subscript operator.
| [in] | index | Index of the annotation. |
Definition at line 83 of file fiff_annotations.cpp.
|
static |
Auto-detects format and reads annotations.
| [in] | path | File path (.json or .csv). |
Definition at line 357 of file fiff_annotations.cpp.
|
static |
Reads annotations from a CSV file.
| [in] | path | File path. |
Definition at line 289 of file fiff_annotations.cpp.
|
static |
Reads annotations from a JSON file.
| [in] | path | File path. |
Definition at line 208 of file fiff_annotations.cpp.
| void FiffAnnotations::remove | ( | int | index | ) |
Removes the annotation at the given index.
| [in] | index | Index to remove. |
Definition at line 118 of file fiff_annotations.cpp.
| FiffAnnotations FiffAnnotations::select | ( | const QString & | descriptionFilter | ) | const |
Selects annotations whose description starts with the filter string.
| [in] | descriptionFilter | Prefix to match. |
Definition at line 154 of file fiff_annotations.cpp.
| FiffAnnotations FiffAnnotations::selectByChannel | ( | const QString & | channelName | ) | const |
Selects annotations that reference the given channel name.
| [in] | channelName | Channel name to match. |
Definition at line 167 of file fiff_annotations.cpp.
| int FiffAnnotations::size | ( | ) | const |
Returns the number of annotations.
Definition at line 69 of file fiff_annotations.cpp.
| const QVector< FiffAnnotation > & FiffAnnotations::toVector | ( | ) | const |
Returns a const reference to the underlying vector.
Definition at line 132 of file fiff_annotations.cpp.
|
static |
Auto-detects format and writes annotations.
| [in] | path | File path (.json or .csv). |
| [in] | annot | Annotations to write. |
Definition at line 377 of file fiff_annotations.cpp.
|
static |
Writes annotations to a CSV file.
| [in] | path | File path. |
| [in] | annot | Annotations to write. |
Definition at line 336 of file fiff_annotations.cpp.
|
static |
Writes annotations to a JSON file.
| [in] | path | File path. |
| [in] | annot | Annotations to write. |
Definition at line 254 of file fiff_annotations.cpp.