|
|
[[_TOC_]]
|
|
|
|
|
|
# Introduction
|
|
|
This function allows getting markers. Python objects will be returned as a list.
|
|
|
# Marker struct description
|
|
|
````python
|
|
|
import anywave.core.marker as marker
|
|
|
|
|
|
m = marker.Marker()
|
|
|
m.label # label of marker
|
|
|
m.position # position in seconds.
|
|
|
m.duration # duration in seconds.
|
|
|
m.value # value associated with marker
|
|
|
m.targets # list of electrode labels if the marker targets channels. Empty if the marker is GLOBAL.
|
|
|
````
|
|
|
# Default usage
|
|
|
````python
|
|
|
import sys, anywave
|
|
|
anywave.init(sys.argv)
|
|
|
markers = anywave.get_markers()
|
|
|
````
|
|
|
This code will get ALL the markers loaded with the current data file.
|
|
|
# Add an extra parameter to the function
|
|
|
In order to specify constraints or requirements on the data we want to access to, the function allows an extra parameter which must be a struct.
|
|
|
|
|
|
# Get markers by their labels
|
|
|
````python
|
|
|
import sys, anywave
|
|
|
anywave.init(sys.argv)
|
|
|
cfg = [];
|
|
|
cfg['labels'] = ['seizure', 'EI' ]
|
|
|
markers = anywave.get_markers(cfg)
|
|
|
if markers:
|
|
|
# process markers
|
|
|
|
|
|
````
|
|
|
This code will get all markers labeled *seizure* and *EI*.
|
|
|
|
|
|
# Get markers by values
|
|
|
````python
|
|
|
import sys, anywave
|
|
|
anywave.init(sys.argv)
|
|
|
|
|
|
cfg['values'] = [10 5 512]
|
|
|
markers = anywave.get_markers(cfg)
|
|
|
if markers:
|
|
|
# process markers
|
|
|
|
|
|
````
|
|
|
This code will get all markers with a value of 10, 5 or 512.
|
|
|
|
|
|
# Get markers which target channels
|
|
|
````python
|
|
|
import sys, anywave
|
|
|
anywave.init(sys.argv)
|
|
|
|
|
|
cfg['channels'] = ['A1', 'A3'] # get markers targeting channel A1 and/or A3
|
|
|
markers = anywave.get_markers(cfg)
|
|
|
if markers:
|
|
|
# process markers
|
|
|
````
|
|
|
|
|
|
# Get only markers with a duration
|
|
|
This can be done by specifying options:
|
|
|
````python
|
|
|
import sys, anywave
|
|
|
anywave.init(sys.argv)
|
|
|
|
|
|
cfg['options'] = ['with duration']
|
|
|
markers = anywave.get_markers(cfg)
|
|
|
if markers:
|
|
|
# process markers
|
|
|
```` |
|
|
\ No newline at end of file |