LIMO-EEG-Toolbox / limo_tools

Hierarchical Linear Modelling for MEEG data
https://limo-eeg-toolbox.github.io/limo_meeg/
Other
58 stars 27 forks source link

FT to LIMO data structure #72

Closed NirOfir closed 2 years ago

NirOfir commented 3 years ago

Hi, my name is Nir Ofir, I'm a PhD student of Ayelet Landau at the Hebrew University, Israel. I'm analyzing an EEG dataset using Fieldtrip, and I wanted to use LIMO. I'm trying to figure out how I need to convert my data for it to be fitting for LIMO. I'm aware that Fieldtrip maintainers would also like to implement an interface, and I would be happy to help with that (fieldtrip/fieldtrip#1804).

However, since this is very relevant for my current work, I would like to get a headstart and not wait. I saw in the documentation for limo_eeg.m that "the data format is the one used by EEGLIMOlab". I couldn't find any other toolbox called EEGLIMOlab and I wondered whether EEGLAB was meant instead?

Thanks a lot for your time!

CPernet commented 3 years ago

yes great! @LucaLaFisca made already the necessary changes to work with ERPs and/or source, although the documentation on how to prepare the data from FieldTrip is missing -- that would be ideal to start with that (or see code change for freq. time/freq which will follow the same structure) -- it's pretty much just a problem of import (plus as we go along make sure things work, especially in source domain) -- see https://github.com/LIMO-EEG-Toolbox/limo_tools/tree/LIMO_FT_integration

NirOfir commented 3 years ago

Wonderful! I took a look into LucaLaFisca/LIMO-for-FieldTrip and the branch over here to understand what's already been done. So a couple of questions:

  1. Was any FT specific code already committed to the branch here? By just looking at the recent commits and differences from the master branch I didn't identify anything clear.
  2. What is the exact structure LIMO expects at the single subject level? Is it exactly the EEGLAB data type (as described here)?
  3. Related to the last question: If LIMO expects exactly an EEGLAB data structure, I think it might be more efficient to actually work on fieldtrip2eeglab(), and then call it as part of ft2limo(), rather than duplicating the work. What do you think?
CPernet commented 3 years ago

So far been for ERP - but if you look into https://github.com/LucaLaFisca/LIMO-for-FieldTrip/blob/main/utils/create_model.m you will see how limo_batch is called.

Instead of expecting an EEGLAB structure, we just read the FT structure but a few tweaks are needed for LIMO to understand some info. So I would not try to convert FT to EEGLAB because LIMO just wants to import stuff and it does it's own thing from there (expect a few dataviz we can work on later) -- I haven't reviewed much of the code base in a while so @LucaLaFisca is best to tell you where to look/change for time frequency

NirOfir commented 3 years ago

OK thanks! I will spend some more time with LucaLaFisca's code. Right now my preference is to just create an importing function and not any wrappers (like setting LIMO's defaults, which seems to be quite a lot of what LucaLaFisca did so far) so that the pipeline can be:

  1. Robust to changes in LIMO (as long as the API is kept the same).
  2. Robust to changes in the preprocessing choices in FT.

Basically, I would like to reformat my data the way LIMO wants it to be (in one function ft2limo), and then just use limo_eeg or limo_batch or whatever to do the analysis (in a separate script that is pure LIMO code, without any reliance on FT being on the path or not). Sounds reasonable?

Again many many thanks for your time.

CPernet commented 3 years ago

yes limo_batch is the general import function

CPernet commented 3 years ago

@LucaLaFisca has not pushed the last changes 👎🏻 (even when not clean, it's better to commit than not to since it's a dev. branch) - everyone is off for 2 weeks now but for sure we'll resume then ; it would really be fantastic if you contribute to get FT - TF analyses running https://github.com/LIMO-EEG-Toolbox/limo_tools/blob/master/contributing.md

NirOfir commented 3 years ago

Thanks, I'd be happy to help with this, I think it's a really cool toolbox. I'll wait until everyone is back from their vacations :) For now, the expedient solution was to write some code to convert the preprocessed data into EEGLAB, and then use the great tutorial you wrote for LIMO through EEGLAB to analyze the data that way. So far looks promising!

CPernet commented 3 years ago

no probs - add yourself to contributors.md please do relatively small and/or homogenous pull requests so it's easy to review (I prefer 10 small PR on specific stuffs than one giant with everything)

LucaLaFisca commented 3 years ago

Hello @NirOfir, I just pushed my code (sorry for the delay). You can find it within the branch "LIMO_FT_integration".

CPernet commented 3 years ago

ok @LucaLaFisca but you haven't pulled from master 1st ; we need to try keep things thigh ... @NirOfir let me see how we can merge with master so the latest and greatest are there too

CPernet commented 3 years ago

ok merged master into this branch + made a small PR for @LucaLaFisca to review and merge

CPernet commented 2 years ago

we have made big progress toward this - seems now to work (see the FT branch)