Container for FiffAnnotation entries with FIFF, JSON and CSV serializers. 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 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.
Definition at line 78 of file fiff_annotations.h.
| typedef QSharedPointer<const FiffAnnotations> FIFFLIB::FiffAnnotations::ConstSPtr |
Const shared pointer type.
Definition at line 82 of file fiff_annotations.h.
| typedef QSharedPointer<FiffAnnotations> FIFFLIB::FiffAnnotations::SPtr |
Shared pointer type.
Definition at line 81 of file fiff_annotations.h.
| FiffAnnotations::FiffAnnotations | ( | ) |
Constructs an empty FiffAnnotations object.
Definition at line 45 of file fiff_annotations.cpp.
| void FiffAnnotations::append | ( | const FiffAnnotation & | annotation | ) |
Appends an annotation.
| [in] | annotation | The annotation to append. |
Definition at line 79 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 86 of file fiff_annotations.cpp.
| void FiffAnnotations::clear | ( | ) |
Removes all annotations.
Definition at line 107 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 162 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 128 of file fiff_annotations.cpp.
| bool FiffAnnotations::isEmpty | ( | ) | const |
Returns true if no annotations are stored.
Definition at line 58 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 121 of file fiff_annotations.cpp.
| FiffAnnotation & FiffAnnotations::operator[] | ( | int | index | ) |
Subscript operator.
| [in] | index | Index of the annotation. |
Definition at line 72 of file fiff_annotations.cpp.
| const FiffAnnotation & FiffAnnotations::operator[] | ( | int | index | ) | const |
Const subscript operator.
| [in] | index | Index of the annotation. |
Definition at line 65 of file fiff_annotations.cpp.
|
static |
Auto-detects format and reads annotations.
| [in] | path | File path (.json or .csv). |
Definition at line 339 of file fiff_annotations.cpp.
|
static |
Reads annotations from a CSV file.
| [in] | path | File path. |
Definition at line 271 of file fiff_annotations.cpp.
|
static |
Reads annotations from a JSON file.
| [in] | path | File path. |
Definition at line 190 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 100 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 136 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 149 of file fiff_annotations.cpp.
| int FiffAnnotations::size | ( | ) | const |
Returns the number of annotations.
Definition at line 51 of file fiff_annotations.cpp.
| const QVector< FiffAnnotation > & FiffAnnotations::toVector | ( | ) | const |
Returns a const reference to the underlying vector.
Definition at line 114 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 359 of file fiff_annotations.cpp.
|
static |
Writes annotations to a CSV file.
| [in] | path | File path. |
| [in] | annot | Annotations to write. |
Definition at line 318 of file fiff_annotations.cpp.
|
static |
Writes annotations to a JSON file.
| [in] | path | File path. |
| [in] | annot | Annotations to write. |
Definition at line 236 of file fiff_annotations.cpp.