Read EDF (European Data Format) files in Julia

265 views
Skip to first unread message

Charles Novaes de Santana

unread,
Mar 22, 2015, 3:28:20 AM3/22/15
to julia...@googlegroups.com
Dear all,

Does any of you know if there is a library or a function to read EDF files with Julia?

http://www.edfplus.info/specs/edf.html

EDF is a format for exchange and storage of multichannel biological and physical signals. In our case, we have polysomnographic data stored in this format.

We use to read this kind of data using functions written in R or Matlab, or to use a free open-source software (edfbrowser) to convert the data to ASCII. But as we always use Julia to do the analysis of the converted data I was wondering if there is something written in Julia to read them in their original format.

Thanks in advance for any help.

Best,

Charles
--
Um axé! :)

--
Charles Novaes de Santana, PhD
http://www.imedea.uib-csic.es/~charles

Tobias Knopp

unread,
Mar 22, 2015, 7:25:48 AM3/22/15
to julia...@googlegroups.com
I have recently created functions for reading and writing a similar format (Analyze/Nifti). Its not very complicated.

Something like the following to give you a start:

function load_edf(filename::String)

  header
= Dict{ASCIIString,Any}()

  open
(filename,"r") do fd
    version
=  bytestring( read(fd, Uint8, 8) )
    header
["version"] = version

    localPatientId
=  bytestring( read(fd, Uint8, 80) )
    header
["version"] = localPatientId

   
...

   
# here the data would be read
 
end
 
return data, header
end

Charles Novaes de Santana

unread,
Mar 22, 2015, 8:21:20 AM3/22/15
to julia...@googlegroups.com
Hi Tobias,

Thank you for this good start! ;) I was just wondering if there was any built function to do this before starting to do my own function. Tomorrow is Monday, if I don't find any built function I will move towards the direction you indicated ;) The R and Matlab functions I use can also help.

Have a nice Sunday!

Best,

Charles

Samuele Carcagno

unread,
Mar 22, 2015, 10:18:47 AM3/22/15
to julia...@googlegroups.com
Hi Charles,

if you start creating your own function it may be useful to look at the
BDF.jl package https://github.com/sam81/BDF.jl which deals with Biosemi
BDF files closely related to EDF files
http://www.biosemi.com/faq/file_format.htm

there is a fork of BDF.jl here https://github.com/codles/BDF.jl that
appears to have started to add support for EDF files, but I haven't
tested it.

Cheers,

Sam
> http://www.edfplus.info/specs/__edf.html
> <http://www.edfplus.info/specs/edf.html>
>
> EDF is a format for exchange and storage of multichannel
> biological and physical signals. In our case, we have
> polysomnographic data stored in this format.
>
> We use to read this kind of data using functions written in R or
> Matlab, or to use a free open-source software (edfbrowser) to
> convert the data to ASCII. But as we always use Julia to do the
> analysis of the converted data I was wondering if there is
> something written in Julia to read them in their original format.
>
> Thanks in advance for any help.
>
> Best,
>
> Charles
> --
> Um axé! :)
>
> --
> Charles Novaes de Santana, PhD
> http://www.imedea.uib-csic.es/__~charles

Charles Novaes de Santana

unread,
Mar 22, 2015, 1:32:08 PM3/22/15
to julia...@googlegroups.com
Great news! Thanks for the information, Sam! I will try this before starting something from scratch!

Best,

Charles
Reply all
Reply to author
Forward
0 new messages