Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read EDF file format #16

Open
abcsds opened this issue Aug 18, 2016 · 9 comments
Open

Read EDF file format #16

abcsds opened this issue Aug 18, 2016 · 9 comments
Assignees

Comments

@abcsds
Copy link

abcsds commented Aug 18, 2016

Very similar to BDF files, EDF is the standard format of biosignals for many EEG amplifiers, including the cheapest in the market: Emotiv Epoch, Emotiv Insight, and OpenBCI. Adding support to this format would allow a bigger community to use and support the project.
The description of the format can be found here, and an attempt at reading EDF from julia can be found here (although it seems like it's only some pasted python code)

From the google julia-users group I've found this code:

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

The conversation also points to @codles BDF.jl, but when trying to read an EDF with EEG.jl the following error appears:

WARNING:root:File type edf is unknown

I would love to help creating the functionality, but I'm still not very well acquainted with the library. If you can point me in the right direction I'll do my best to create it.

@rob-luke
Copy link
Owner

Thanks for the suggestion. Currently I use BDF.jl for reading data. I believe Sam has started working on EDF files in that package in a separate branch.

If EDF reading in BDF.jl is stable I will be happy to add support for it in this package. I have been meaning to overhaul the reading functions. Actually the whole package is ready for a refactor now that test coverage is high and a stable version was tagged on julia v0.4.

If you want to help then I would suggest reviewing @sam81 EDF reading code. Make sure it works with your files and report back to that package. Once the functionality is in master I will add it here. Unless @sam81 has other suggestions?

@rob-luke rob-luke self-assigned this Aug 18, 2016
@sam81
Copy link

sam81 commented Aug 19, 2016

@abcsds contributions to the EDF functionality in BDF.jl would be very welcome. The basic reading functionality is already in place but it has received very little testing and does not currently implement the full EDF/EDF+ specifications. I'll have very limited time and limited internet connectivity in the next month, but I'll try to answer any possible queries as well as I can. A good place to start to get familiar with the library is to look at the BDF specifications which are explained in a very clear way on the Biosemi website, and see how they are implemented in BDF.jl.

@wherrera10
Copy link

Happy New Year! Is the EEG.jl module still being updated? I have finally over the holidays had time to look at specs long enough to put together a module that reads and writes EDF+ and BDF+ files.

This is not a fork of EEG,jl. It does not handle triggers like EEG.jl does, since it is for processing EEG data more than for evoked potentials. I suppose you could use it to pull channels and annotations out for further use, though. It is still early alpha and not registered as an official Pkg. If you think you could use it in some way, have a look:

https://github.com/wherrera10/EDFPlus

@rob-luke
Copy link
Owner

Gday @wherrera10 ,

I'm just about to dive back in to this project so appreciate the update on your package, it looks great.

I plan to give EEG.jl an overhaul with julia 1.0. And am very keen to add EDF support.

Over the next year I am planning to add support for more than just evoked potentials and support for other signals such as MEG, FNIRS, spike trains, etc. I'm considering rolling this in to a new package Electrophysiology.jl, that's been on hold for a while. However, I will maintain this EEG.jl in the meantime and provide an easy transition when appropriate.

@wherrera10
Copy link

wherrera10 commented Jan 11, 2018 via email

@stefanches7
Copy link

Hello @rob-luke and others,

Beacon biosignals have rolled out a package for reading EDF in the meantime (https://github.com/beacon-biosignals/EDF.jl). Works like a charm! Maybe it could be integrated or referenced in the current package.

@Marco-Congedo
Copy link

That's great!
To all:
the neuroimaging community is converging toward the BIDS standard for sharing neuroimaging data.
With EDF IO support it is possible to support the BIDS standard fr EEG/MEG.
Is there any plan on doing this?

@Tokazama
Copy link

Note that EDF is a supported storage format within the BIDS standard. Therefore, the only thing really stopping us from properly supporting the BIDS standard at this point is a standard approach to file management as described by BIDS. I believe BIDSTools.jl was made for this sort of thing.

That being said, standard file management is of little benefit to anyone if once we read the data into Julia it all uses different structures and APIs. This was one of the primary motivators for starting NeuroCore.jl. The last couple weeks I've been trying to get some other parts of the Julia ecosystem in place to make another major PR to NeuroCore.jl. At which point it will hopefully be ready for incorporation into the general registry for people to play around with.

@wherrera10
Copy link

wherrera10 commented Jan 12, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants