Having two-byte integers implies that we have a range from -32,768 to 32,767 to represent amplitudes. So, the depth of our sixels is somewhat limited. On the other hand, in most cases we are not storing integers but float values. We have a ruler that measures more or less 60,000 steps, and we have to represent the wide variation of ranges present in nature. To do this, we stablish a relation between the magnitudes in nature and the 60,000 units of our ruler. EDF files use a set of fields at the beginning of the file to indicate these and other similar features. Let us see the basic mechanism used to describe the file. First of all, we have to stress that the header is written in ASCII characters, so the beginning of an EDF file can be seen with an editor as plain text.
We need two different kinds of information:
The main consequence of this feature is that the header uses the first
bytes, previously to the data included in an EDF file.
All the fields in the header of an EDF file use the same method: fixed-length ASCII strings. The extraction of these fields is the first step in decoding an EDF file.
Since the length of the header varies with the number of signals, the very first task is to know the number of signals. This is one of the fields of the header. This field is located at a fixed point at the beginning of the file, so it can be easily found. The number of bytes in header record is also defined but we can calculate it from the number of signals. Probably, the most important fields to decode the file are the number of signals, the duration of the data record and the number of data records.
The header of each signal has a surprising characteristic: the fields of each signal are mixed. So, the label of all the signals is followed by the transducer of all the signals and so on. It is easier to extract the transducer of all the signals than all the header fields describing the second signal.
The header of the signal includes among other fields the number of samples in each data record; so, to calculate the number of bytes of the whole data record, it is necessary to add the number of samples of each signal. Of course all data records have the same length (the double of the sum of the samples of the signals).
This structure defines very precisely the time sequence of the samples. To calculate the amplitude values of each signal, it is necessary to know:
Once known the relation between these points, all the other values can be easily calculated as in figure 3.1
![]() |
There are not many more features in the EDF header. It is a very compact structure. Imagine a file containing a sleep recording of 16 signals in 100 Mb. To define a lot of signals and to characterize completely the block structure, we need 4 kb, less than 0.005 percent of the file. These small strings formed by ASCII characters define completely the whole file allowing a very high degree of adaptability to very different environments.
It has been suggested that two-byte integers do not allow to represent the signals with precision. Consider that EDF is a format specifically designed to interchange traces. If we want to plot a curve at the same resolution (more or less 60,000 levels) in a set of screens having a vertical resolution of 1000 pixels, we would need 60 piled screens to show the result. So, an adequate choosing of the slope and the y-intercept of the conversion factor allows in most cases an appropriate representation of the signals.
As an example, imagine that we want to store the electrical activity of a muscle as it is evaluated in clinical electromyography. We want to record spontaneous activity, activity at slight contraction to evaluate the properties of the motor unit potentials, progressive effort to evaluate the recruitment and full effort. If we set physical dimension as
V, physical minimum as -30,000, physical maximum as 30,000, digital minimum as -30,000 and digital maximum as 30,000, the value included in each data record is equivalent to the value of the signal in
V. This is appropriate to see spontaneous activity (the usual configuration of the screen is 50
V/div) and also allows to see a maximum effort in the range from -30 mV to 30 mV. In this way, the whole recording of the muscle can be stored in only one file. Triggers, identification of motor unit potentials and other relevant information need additional mechanisms that will be explained in the next chapters. This example was included to show that a wide range of voltages that can be stored in the same EDF file.
Finally,a very important detail. Please do not miss the next paragraph. EDF defines the polarity of the signals in this way:
This point is so important that I think that it requires an example. A positive sharp wave as recorded with a concentric electrode on a zero baseline could have the following values:
This means that the polarity in the file is not inverted. Obviously, in EMG we see this wave as a downward peak. The displaying software must implement any such 'negativity upward' rule.
The consequences of missing this rule could be important in EEG (e.g., Positive Occipital Slow Transients of Sleep could be misinterpreted) but in some specific subfields the effect of changing polarity could be devastating. If we have a BAEP and we are not aware about the polarity of the curve, an erroneous interpretation could produce a completely wrong result. The failure is equivalent to plug the cables connected to the electrodes in the wrong position, a failure well known by all clinical neurophysiologists.
... This voltage must equal the potential at
the first electrode (before the '-' character)
minus the potential at the second electrode.
For example, if the 'Specification' is Fpz-Cz
(i.e. the standard label reads 'EEG Fpz-Cz '),
then the voltage in the file must be the potential
at Fpz minus the potential at Cz. In case of a
concentric needle electrode recording, a positivity
at the centrally insulated wire relative to the cannula
of the needle is stored as a positive value in the file.
{0, 0, 0, 100, 60, 30, 10, 5, 0, 0, 0}
Next: The changes introduced in
Up: Some introductory notes to
Previous: The structure of EDF/EDF+:
Contents
je
2006-10-12