Pipelines for Mouse Data Analysis in MNE-Python

Dear MNE-Python Community,

I am currently engaged in analyzing EEG mouse data and I would like to use MNE-Python as usual. I wanted to reach out to see if there are existing pipelines or modules that could potentially streamline my workflow. Before reinventing the wheel, I’d like to explore any available resources within the MNE-Python ecosystem that could expedite my data analysis process.

Thank you in advance for your assistance and support.

Dave

Hello,

These are some well-known EEG processing pipelines that are fully automated (although parameterizable):
MNE-BIDS-Pipeline: MNE-BIDS-Pipeline
PREP pipeline: pyprep.PrepPipeline — pyprep 0.4.3+7.ge4840d9 documentation

Hope that helps

I know this pipeline! Not sure what do you mean with this suggestions…is there a surface-based reconstruction of mouse brain?

If you are not just looking for pipelines or modules to expedite eeg processing, but tools to find inverse solution and work directly on the sources then there are the MNE tutorials (putting them here in case you don’t know them):
https://mne.tools/stable/auto_tutorials/forward/index.html
https://mne.tools/stable/auto_tutorials/inverse/index.html

I’ve also found MNE-Connectivity’s examples and tutorials useful and well done:

https://mne.tools/mne-connectivity/stable/auto_examples/mixed_source_space_connectivity.html

https://mne.tools/mne-connectivity/stable/auto_examples/mne_inverse_label_connectivity.html

Their first part (before calculating connectivity) typically illustrates ways of solving the inverse problem with MNE-python.

@Nab8338 To my understanding, @Davi1990 is looking for assistance specifically to process mouse, not human, data.

I don’t think MNE-Python is of much use there for anything other than sensor-space analysis.

Best wishes,
Richard

2 Likes

Oh sorry my own coffee-less brain missed the most important word in the question. Indeed. I don’t know anything either using mne-python to do source localization in the mouse brain, good luck in your quest.

1 Like

I generally agree, though if one did have mouse BEM meshes and a mouse source space from some other software (and electrode locations), in principle our inverse code could still work? Though there are a few assumptions about the BEM layers that are based on human anatomy that might need to be hacked (e.g., IIRC “outer skin” is computed from “outer skull” as a fixed offset distance normal to the skull surface; that distance probably differs in mice)

1 Like

Thank you for your response. That’s exactly what I was considering, but I wanted to ensure I wasn’t reinventing the wheel. I appreciate your clarification on the potential challenges with adapting BEM meshes and source space from other software for mouse models. I will keep you in the loop and please let me know if anything else comes to your mind

1 Like

Just wanted to drop you a quick update on the project. I’ve managed to snag some 3D surface models of the mouse brain and skull, all in .obj format. No skin this time since we placed the electrodes directly on the skull after lifting the scalp.

Now comes the fun part: figuring out how to whip up BEM, src objects, and .surf files (for FreeSurfer).

Your insights would be super helpful

Thanks

this tutorial talks about using blender to edit .obj files and export them in a format that is useable by MNE-Python. I suspect you will run into problems having only a 2-layer BEM though; @larsoner will probably know off the top of his head if that will crash / where to adjust MNE-Python code to accommodate it.

I don’t think the forward code in MNE-Python was meant to solve this sort of problem. It seems more like something OpenMEEG was designed for :frowning:

Hi @Davi1990 , I am also currently looking into processing eeg data using mne python that we have collected from mouse. Could you please let me know if you have any success in this ? Thanks.

Hi @nikhil777shingte thanks for your message. My data has been already preprocessed actually. So I am mainly looking for source modelling here. Let me know if you want to connect to explore this further

That would be super helpful. Could you please send me email to shingte777nikhil@gmail.com, and we can connect from there.

Hey @Davi1990 Thank you for the update, and for starting this discussion.
If you want to convert a .obj file into a .surf file you can use the following code:

import mne

obj_file_path = "path/to/file.obj"
verts, faces = surf_dict = mne.read_surface(obj_file_path, file_format='obj')

surf_file_path = "path/to/surface.surf"
mne.write_surface(surf_file_path, verts, faces, overwrite=True, file_format="freesurfer")

I have recently looked into MNE source localization because I wanted to use a 4-layer BEM (in humans).
After a lot of trial and error, I reached the following conclusions:

  • It is possible to adapt the BEM model’s source code to make BEM models with any number of layers.

  • As long as the BEM model is made correctly the inverse/forward solution will work. You need to remove all the if statements that check if the BEM model has exactly 3 layers.

  • It’s unclear to me why MNE forces the users to have exactly 3 layers even if the mathematical model used to make the source localization works with any number of layers. For more information about the model I found this line of the Source code that points to this article

I also take the chance to point to these two questions that are related to the topic but haven’t been answered at the moment:

Good luck with your project and keep us updated with your progress.