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

Implementation of EEG pipeline #6

Closed
13 of 15 tasks
sebastientourbier opened this issue Jul 25, 2019 · 5 comments · Fixed by #82
Closed
13 of 15 tasks

Implementation of EEG pipeline #6

sebastientourbier opened this issue Jul 25, 2019 · 5 comments · Fixed by #82
Assignees
Labels
big-effort Large amount of work BrainHack! OHBM Brainhack 2020 Tasks Brainhack21! Brainhack Global Geneva 2021 Tasks enhancement New feature or request high-impact Expected to have high impact
Projects
Milestone

Comments

@sebastientourbier
Copy link
Member

sebastientourbier commented Jul 25, 2019

First thoughts

  • Design/first sketch of the new EEG pipeline
  • Function to load Cartool / EEGlab / Fieldtrip inverse solutions as input
  • Implement the interface to compute single source dipoles per ROI based on SVD decomposition [Rubega et al. 2018] using pycartool
  • Computes diverse common functional connectivity metrics (Imaginary coherence, ...) using MNE
  • Implement the interface to compute time-varying functional connectivity based on the Granger causality framework and a modified version of the adaptive Kalman filter as proposed in [Pascucci et al. 2019]. This allows to recursively refine time-varying directed connectivity estimates with structural connectivity.

[Rubega et al. 2018] Rubega, M.; Carboni, M.; Seeber, M.; Vulliemoz, S.; and Michel, C. M. Estimating EEG source dipoles based on singular-value decomposition for connectivity analysis. 2018. paper

[Pascucci et al. 2019] Pascucci D.; Rubega M.; Hagmann P.; Plomp G. Adaptive filtering with anatomical priors: Integrating structural and effective connectivity. OHBM 19 abstract

What need to be answered

  • How to visualize sources estimated by Cartool in MNE (translation in log file enough?)
  • Check if MNE provides already function to load EEGlab, FieldTrip
    Yes (TO DO: list the functions).
  • How Cartool / EGGlab / Fieldtrip / Brainstorm / MNE are saving outputs (BIDS or in-house organization). This will indicate us how to grab the data (cleaned EEG data and LeadField matrix) in the most automatical way.
  • The determination of a common source space (Freesurfer space might be prefered as we already provide the annotation files for the Lausanne2008 and Lausanne2018 parcellations)
  • Difference between SVD method in [Rubega et al. 2018] and the SVD method implemented in MNE (mode: pca_flip)
  • How to adopt BIDS EEG (see spec paper)

To be prepared and implemented

Note: check in Nipype which MNE interfaces are already implemented which could then be used as they are or as a template for the developement of the MNE-related interfaces (Tasks 5. and 6.)

Achievement

  • Task 1
  • Task 2
  • Task 3
  • Task 4
  • Task 5
  • Task 6
  • Task 7
  • Task 8
  • Task 9

Task 1

Preparation of a sample dataset for development (See #6 (comment) for more details)

Task 2

Start the implementation of a simple Nipype workflow that can grab and convert to MNE's internal format the cleaned EEG data and the Lead Field matrix generated by:

  • Cartool
  • EEGlab
  • Fieldtrip
  • MNE
  • Brainstorm

Task 3

Implement for each toolbox an interface after the data grabber that converts and stores in MNE format the generated outputs (cleaned EEG data and lead field matrix)

Inputs

  • Cleaned EEG in toolbox format
  • Lead field matrix in toolbox format

Outputs

  • Cleaned EEG in MNE format
  • Lead field matrix in MNE format

Task 4

Implement an interface that creates the inverse solutions and transforms the source coordinates into a common source space

Inputs

  • Cleaned EEG in MNE format (channels x time)
  • Lead field matrix in MNE format (#sources x channels)
  • Transformation from toolbox source coordinates to common space

To be performed

  • Computes inverse solution (sources):
    Source = Lead field matrix x cleaned EEG
  • Transform the source coordinates (sources)

Outputs

  • Source time-series
  • Source coordinates

Task 5

Check if output sources from the different toolbox are in proper common space

Task 6

Implementation of an interface for estimating ROI dipoles based on Maria's SVD and/or MNE SVD methods.

Inputs

  • Inverse solution in MNE format
  • Parcellation annotation files or parcellation scheme

Outputs

  • ROI dipoles in MNE format

To be performed

  • Use MNE function or implementation of Maria's method to create ROI dipoles in MNE format

Task 7

Implementation of an interface for estimating multiple dynamic functional connectome maps

Inputs

  • ROI dipoles in MNE format

Outputs

  • Dynamic FC maps in .gpickle format
  • Dynamic FC maps in .mat format

To be performed

  • Computes multiple dynamic functional connectome maps using measure implemented in MNE and pycartool

Task 8 (Large effort)

Implementation of EEGPipeline:

  • Organisation of pipeline and stages (for configuration and ouput inspection with bidsappmanager)

  • Implement the stages (config parameters, create_worflow, inpsect_outputs) and modify the existing cmp/pipelines/EEG.py to implement the complete workflow

  • Implement the GUI components (EEGPipelineUI and all the related stages) for integration in the cmpbidsappmanager

  • Review bidsapp parser and run.py to take as input the eeg config file

Task 9

Documentation:

  • Add functionality in the index.html page
  • Update the bidsappmanager.html with EEG in 1) pipeline configuration, 2) run the bidsapp and 3) check stage outputs,
  • Update outputs.html page with BIDS-EEG derivatives data produced by CMP
@sebastientourbier
Copy link
Member Author

@sebastientourbier
Copy link
Member Author

Investigate head model with MNE

@sebastientourbier sebastientourbier added this to In progress in v3.0.0-eeg Nov 19, 2019
@sebastientourbier
Copy link
Member Author

What need to be answered

* [ ]  Check if MNE provides already function to load EEGlab, FieldTrip
  Yes (TO DO: list the functions).

* [ ]   How Cartool / EGGlab / Fieldtrip / Brainstorm / MNE are saving outputs (BIDS or in-house organization). This will indicate us how to grab the data (cleaned EEG data and LeadField matrix) in the most automatical way.

* [ ]   The determination of a common source space (Freesurfer space might be prefered as we already provide the annotation files for the Lausanne2008 and Lausanne2018 parcellations)

* [ ]  Difference between SVD method in [Rubega et al. 2018] and the SVD method implemented in MNE (mode: `pca_flip`)

* [ ]  How to adopt BIDS EEG ([see spec paper](https://www.nature.com/articles/s41597-019-0104-8.pdf))

To be implemented

1. A simple workflow that can grab and convert the MNE internal format the cleaned EEG data and the Lead Field matrix generated by:


* [ ]   Cartool

* [ ]  EEGlab

* [ ]  Fieldtrip

* [ ]   MNE

* [ ]   Brainstorm


1. Implement for each toolbox an interface after the data grabber that converts and stores in MNE format the generated outputs (cleaned EEG data and lead field matrix)

Inputs

* Cleaned EEG in toolbox format

* Lead field matrix in toolbox format

Outputs

* Cleaned EEG in MNE format

* Lead field matrix in MNE format


1. Implement an interface that creates the inverse solutions and transforms the source coordinates into a common source space

Inputs

* Cleaned EEG in MNE format (channels x time)

* Lead field matrix in MNE format (#sources x channels)

* Transformation from toolbox source coordinates to common space

To be performed

* Computes inverse solution (sources):
  Source = Lead field matrix x cleaned EEG

* Transform the source coordinates (sources)

Outputs

* Source time-series

* Source coordinates


1. Check if output sources from the different toolbox are in proper common space


* [ ]   Cartool

* [ ]  EEGlab

* [ ]  Fieldtrip

* [ ]   MNE

* [ ]   Brainstorm


1. Implementation of an interface for estimating ROI dipoles based on Maria's SVD and/or MNE SVD methods.

Inputs

* Inverse solution in MNE format

* Parcellation annotation files or parcellation scheme

Outputs

* ROI dipoles in MNE format

To be performed

* Use MNE function or implementation of Maria's method to create ROI dipoles in MNE format


1. Implementation of an interface for estimating multiple dynamic functional connectome maps

Inputs

* ROI dipoles in MNE format

Outputs

* Dynamic FC maps in .gpickle format

* Dynamic FC maps in .mat format

To be performed

* Computes multiple dynamic functional connectome maps using measure implemented in MNE and pycartool

Based on our discussion with Joan yesterday

@sebastientourbier
Copy link
Member Author

Preparation of a sample dataset for development

Tasks involved

  • Decision and creation of a common dataset (source data: T1w, EEG, (DWI and fMRI would be great also))
  • Estimation of inversion solutions for:
    • Cartool (proprietary)
    • EEGlab (open / matlab)
    • Fieldtrip (open / matlab)
    • Brainstorm (open / matlab)
    • MNE (open / python)
  • Organization of the different outputs in the dataset:
    • Cartool (proprietary)
    • EEGlab (open / matlab)
    • Fieldtrip (open / matlab)
    • Brainstorm (open / matlab)
    • MNE (open / python)

Example of structure

   ds-example/
    
    README
    CHANGES
    participants.tsv
    dataset_description.json
    
     sub-<subject_label>/
        anat/
            sub-<subject_label>_T1w.nii.gz
            sub-<subject_label>_T1w.json
        ...
        eeg/
           [To be checked in BIDS-EEG]
    
    ...

    derivatives/
        cartool/
            sub-<subject_label>/
                eeg/
                    [Outputs from cartool]

        eeglab/
            sub-<subject_label>/
                eeg/
                    [Outputs from eeglab]

        fieldtrip/
            sub-<subject_label>/
                eeg/
                    [Outputs from fieldtrip]

        mne/
            sub-<subject_label>/
                eeg/
                    [Outputs from mne]

    ...

Resources

@sebastientourbier
Copy link
Member Author

This is link to ohbm brainhack project "Integrate EEG inside CMP3" (ohbm/hackathon2020#214)

@sebastientourbier sebastientourbier linked a pull request Apr 6, 2021 that will close this issue
@sebastientourbier sebastientourbier added the Brainhack21! Brainhack Global Geneva 2021 Tasks label Dec 2, 2021
@sebastientourbier sebastientourbier added this to To do in v3.0.1 Dec 23, 2021
@sebastientourbier sebastientourbier added this to the v3.0.2 milestone Jan 5, 2022
@sebastientourbier sebastientourbier removed this from To do in v3.0.1 Jan 5, 2022
@sebastientourbier sebastientourbier added big-effort Large amount of work high-impact Expected to have high impact labels Jan 5, 2022
@sebastientourbier sebastientourbier modified the milestones: v3.0.2, v3.0.3 Jan 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
big-effort Large amount of work BrainHack! OHBM Brainhack 2020 Tasks Brainhack21! Brainhack Global Geneva 2021 Tasks enhancement New feature or request high-impact Expected to have high impact
Projects
No open projects
v3.0.0-eeg
  
In progress
Development

Successfully merging a pull request may close this issue.

3 participants