Once you have installed edfAnn you start the program in the usual way (calling the program from the commnand line or clicking the icon). We are going to use the file wav.edf. This file is also avaliable at the download page. You can use the program to face the following processes:
To do it, from inside edfAnn (some tooltips appear if the mouse is maintained over the fields)...
This is the output as seen with KWrite ( 3.1). Notice that the units of the EDF+ file are expressed in seconds related to the start time contained in the header of the file.
Notice that the Unicode character appears properly shown (of course to see properly Unicode characters this feature has to be supported by the program and by the Operating System). Also notice that the file contains six point annotations (they have no duration). You can see the code used to create the annotations in the tutorial Coding a sin wave in EDF+ by using Java
In the next point we are going to use an editor to add/erase/modify the annotations of a file.
To do it
Now let's do it in practice. We modify the text file. This is the file as seen with KWrite ( 3.2)
Once finished the process we can see the new file with RASCHlab ( 3.3)
Notice that the old annotations and the new ones are mixed. We can also see in the figure the full support of EDF+ annotations by RASCHlab (point annotations, annotations with duration -even annotations beginning out of the record- and annotations containing Unicode characters are shown). Also notice that the text file can be modified in many ways. The structure of the file is easy to remember
and so, the output of any processing package (e.g. Scilab, R, Octave..) can be
easily modified to be included in the EDF
file.
You can add annotations to the annotations included in
the EDF+ file (such as we did in the previous example) but you can also create
an annotation signal from scratch, e.g. to convert an EDF file in an EDF+
file (a plain EDF file does not contain annotations).
onset<TAB>duration<TAB>content<CR>
onset<TAB>duration<TAB>content<CR>
onset<TAB>duration<TAB>content<CR>
...
In EDF+ files the onset of each data record is coded as the first empty annotation (see the EDF+ documantation). Since this specific annotations have a very different function they are handled by edfAnn in a different (although similar) way. The procedure is exactly the same than the procedure used to read/write annotations. If we export the onsets of wav.edf to the file wav.onsets.txt, this is the result
Each line is the first time empty stamp, marking the onset of the data
record. The format is
The number of lines must be coincident with the number of data records (you
can find this value by editing the header of the EDF file with
edfEdit).
You can use this feature to convert continuous EDF+ files into discontinuous
EDF+ files. And the inverse process can also be carried out. Be aware that you
can also destroy the recording (the file that you will create) by changing the
relations between the different data records.
Unless you want to modify the time relations of the signals, this is not a very important issue.
je@unit1:~/prog/tmp> cat wav.onsets.txt
0
1
2
3
4
onset_rec0<CR>
onset_rec1<CR>
onset_rec2<CR>
...
As a summary think for a moment in the process used to import/export annotations. The magic comes when you modify the text file. Some examples:
You can include it as a signal of an EDF+ file.
0<TAB>30<TAB>Sleep stage 0<CR>
30<TAB>30<TAB>Sleep stage 0<CR>...
0<TAB>30<TAB>Sleep stage ?<CR>
30<TAB>30<TAB>Sleep stage ?<CR>...
You append the file containing the sleep stages with the apnea file and you
include the new signal that now contains stages and apneas.
1450<TAB>32.3<TAB>Obstructive apnea...
And possibly you will be able to imagine some similar ways to process sleep recordings or many other physiological signals... you will share the same procedures for the analysis of en EMG, the averaging of an evoked potential or the marking of a conventional EEG recording.
One last comment on the integration of annotations coming from different origins. Different formats of annotations can be converted by hand or by the appropriate programs. In this way annotations coming from different sources can be combined and included in the EDF+ file.
Let's face an example on how to include Physionet annotations. Of course you have to install Physionet WFDB . We begin by reading the sampling of the file and the annotations
Now we want to convert this annotation to our annotation format.
Notice that the original annotations indicate the position of QRS complex and
have no duration. We have to read the second column, convert position in
samples to position in seconds (in this case sampling rate is 360) and add a
duration of 0 to all the annotations. To do it we can use awk (the first line has been folded)
Now we can save the file and include the annotations in the EDF+
file. A similar process could be carried out with other annotations.
je@unit1:~/prog/tutorials/edfAnn/Code> sampfreq 100s
360
je@unit1:~/prog/tutorials/edfAnn/Code> rdann -r 100s -a atr | head -n 6
0:00.050 18 + 0 0 0 (N
0:00.213 77 N 0 0 0
0:01.027 370 N 0 0 0
0:01.838 662 N 0 0 0
0:02.627 946 N 0 0 0
0:03.419 1231 N 0 0 0
onset<TAB>duration<TAB>content<CR>
onset<TAB>duration<TAB>content<CR>
onset<TAB>duration<TAB>content<CR>
...
je@unit1:~/prog/tutorials/edfAnn/Code> rdann -r 100s -a atr |
awk '{print $2/360 "\t 0 \t" $3}'
0.05 0 +
0.21388 0 N
1.02778 0 N
1.83889 0 N
2.62778 0 N
3.41944 0 N
4.20833 0 N
5.025 0 N
5.67778 0 A
6.67222 0 N
...
Next: Some idiosyncrasies of the
Up: A tool to import/export
Previous: Installation
Contents
je
2006-10-13