mne-tools / mne-bids

MNE-BIDS is a Python package that allows you to read and write BIDS-compatible datasets with the help of MNE-Python.
https://mne.tools/mne-bids/
BSD 3-Clause "New" or "Revised" License
132 stars 86 forks source link

BrainVision export for MNE #41

Closed palday closed 5 years ago

palday commented 6 years ago

This isn't really an issue to solve but rather an announcement to save duplication of effort. It looks like BrainVision and EDF will be the preferred formats for BIDS-EEG, so it's important that MNE-BIDS has a way of writing to those formats.

I recently implemented a basic BrainVision writer for MNE-Python Raw objects as part my own package of convenience functions. I have plans to extend support to reading and writing MNE-Python Epochs objects.

Following discussions with @robertoostenveld, the core parts of this code will be re-factored and moved to a separate package (planned name: pybv) and will not be dependent on MNE in any way, but rather manipulate simple NumPy arrays for the data and events and a dictionary of attributes. The MNE-based writer functionality will then be reworked to simply be wrappers around this functionality.

Similarly, @robertoostenveld has been kind enough to license his pure-python EDF reader and writer under the 3-clause BSD license. I'll also be packaging that up in the next few weeks and putting that on PyPI as pyEDF. There are already two existing EDF packages available on PyPI; however, they are both dependent on the EDFlib C/C++ library.

After the refactoring, repackaging and adding a good CI test suite, the plan is to offer to transfer ownership of the repositories to INCF. The code will be intentionally minimal in terms of reading and writing arrays and not depending on MNE. That said, there are some rather nice array-based constructors for the MNE object classes, so it should be straightforward to e.g. integrate convenience functions for the writers under an mne.export module and potentially refactor the current readers to use these external libraries. But that's a bridge the broader MNE community can decide whether to cross when we get there.

Again, this is mostly an announcement in a convenient forum because a lot of this discussion has happened in private emails or in person and thus isn't accessible to the MNE-Python/BIDS community.

@choldgraf @sappelhoff This isn't quite just giving the writer over to MNE-BIDS, but it should still help.