s-news
[Top] [All Lists]

Re: Importing EDF format EEG data

To: Robert Lawson <robert.lawson@augustmail.com>
Subject: Re: Importing EDF format EEG data
From: ripley@stats.ox.ac.uk
Date: Wed, 26 Jun 2002 08:12:14 +0100 (BST)
Cc: <s-news@lists.biostat.wustl.edu>
In-reply-to: <3D195688.30003@augustmail.com>
On Wed, 26 Jun 2002, Robert Lawson wrote:

> Splus experts,
>
> I do EEG research and I use SPLUS to filter and sample my data. Up until
> now, I have always imported ASCII data. However, my new EEG instrument
> exports data as EDF (European Data Format). The first line of the EDF
> data file is an ASCII header that defines the data set. The rest of the
> file is binary data.
>
> I have a Matlab script that will import EDF. However, I would prefer to
> use SPLUs for all my data processing.
>
> I dont know much about binary formats but the Matlab script includes
> the line:
> data = fread(fp,'int16');
>
> I assume this means the binary is of integer type with 16 bits or bytes
> (I am exposing my ingnorance here).
>
> Does anyone have a script that opens EDF files or can someone advise me
> how to import binary data?

You can do this sort of thing via connections, which means you need
S-PLUS 5.x or 6.x.  They enable you to read from a file successively in
different formats.  Unfortunately, as far I am aware in S-PLUS this can
only read integers/float/double of the machine's native format, which
means 32-bit integers, except on Alphas.  (There is a problem of
endianness in your description which may also need to be addessed.
Different machines, e.g. Intel vs Sparc, output bytes in different
orders.)

Since R can handle all these problems (size-changing, endianness) and it
can be very helpful, it would be a worthwhile enhancement to S-PLUS.
Meanwhile, I think you either need to write C code to read the format
or use some other program (Matlab) to convert the files.

As a European, I do find this a rather surprising use of `European Data
Format'.  As far as I am aware, harmonization in the EU has not gone as
far as mandating a single data format!

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595


<Prev in Thread] Current Thread [Next in Thread>