EEG simulation steps

Dear Experts
Hi
I'm trying to simulate EEG data. Actually, I'm going to assign a focal source with arbitrary sinusoidal signal to an arbitrary region of head volume and Obtain the signals recorded at the electrodes on the scalp with an arbitrary electrodes' structure (cap).
I've almost followed all discussions about this subject like:

but I've couldn't do it. I've completely confused on doing process steps. I've done the steps as follow:
1- create protocol and subject (use default anatomy and use one channel file per acquisitions )
2- Set a default EEG cap
3-Edit the EEG cap to fit in on the subject’s head
4-Compute a forward model (whole cerebral volume)
5-Define some source activity, with the process "Simulate > Simulate generic signal.
6-Create a scout for which you want to set this activity (you can use the menu “Scout > New: Coordinates” to create a new ROI based on MNI coordinates)
7-Associate the signal with the scout and use this to simulate EEG or MEG recordings, with process “Simulate > Simulate recordings from scouts” (select the simulated signal in Process1, and select the scout in the process options)
Are these process steps right? Do I must to do additional steps that I left it?

Best Regards
Morteza

Hi Morteza,

That seems about right. You need an anatomy with registered EEG electrodes. With that a forward model that relates source activity in the brain to the electrodes. You could do this with a forward model with just the cortical surface as sources usually.

If you did those steps you can check what kind of simulated EEG signals come from that and see the topological plots and the frequency plots to see if that 's more or less what you expect.

Kind regards,
Steven

Thanks dear Steven

How can I introduce an anatomy with registered EEG electrodes? could you please tell me which step?
I have another question, please. Can I compute leadfield matrix by BS and export that to the database and import the computed leadfield for another protocol?

Regards

Can you tell me what you exactly mean with this? Do you have an individual anatomy that you would like to use for your simulations?

You can compute a leadfield matrix and export that to for example matlab and import it again. Though the leadfield matrix is very specific to all the variables (anatomy, EEG locations, segmentation, BEM or 3 shell etc.). Why would you like to do that?

Kind regards,
Steven

At first, I want to create a sinusoidal focal source in default BS anatomy and simulate the achieved signals from it in electrodes.

I just want to move the focal source in several regions of whole head volume with the same anatomy and electrode positions (cap). Since computing leadfield is a Time-consuming process for each scenario and protocol, I want to compute the leadfield matrix once.

Regards
Morteza

You can compute for example the bem surfaces from the standard anatomy model and it should look more or less like this in the anatomy folder

After that you can assign an EEG cap to it in the data tab and make your head model :slight_smile:

You could make one leadfield matrix and use different scouts to simulate your signal from. The leadfield matrix is not dependent on the scouts.

Kind regards,
Steven

2 Likes

@SBeumer Thanks for your valuable help on the forum :slight_smile:

2 Likes

FYI: To address all the recent questions we had related with simulations, I added some code in Brainstorm and wrote a new tutorial:
https://neuroimage.usc.edu/brainstorm/Tutorials/Simulations

Just committed a new process "Simulate recordings from dipoles":
https://neuroimage.usc.edu/brainstorm/Tutorials/Simulations#Single_dipoles


image

Hi Francois,
At first, thank you for your valuable addition.
I tried to simulate EEG signals from dipoles in a new protocol without preprocesses that were done in "TutorialIntroduction". So when I wanted to do this step " Add process Simulate > Simulate recordings from dipoles" I couldn't find it. Could you please tell me is it necessary to do the preprocess in "TutorialIntroduction" or no?

Regards
Morteza

Hi
Dear Francois, I'm following this tutorial:

but when I'm trying to assign the simulated signal "Simulated X (3*600)", I face with this error:

image

I know that it is possibly related to constrained scout, but it isn't mentioned that how I chang constrained scout to unconstrained scout.
how can I fix this error?

Regards
Morteza

No, you can run this from anywhere, but you need to update Brainstorm first.
If you are using an older version of Matlab, maybe there is some syntax in this new process that is not recognized. Do you see any error/ message in the Matlab command window when you click on the button "Run" of the Process1 tab?

but when I'm trying to assign the simulated signal "Simulated X (3*600)", I face with this error:

This error message also indicates that you are not running the latest version of Brainstorm. The error message is slightly different now. Please start by updating Brainstorm.

1 Like

Thanks dear Francois, I get the new version but I receive the error yet!
I did the process steps as follow:

  1. I created a protocol with default anatomy
  2. I created a new subject
  3. created a new folder
  4. selected standard cap 10-10 65
  5. no noise modeling
  6. calculated headmodel 3-sell sphere (cortex surface)
  7. simulated signal Data (1,:)=(sin2 f t); Data(2,:)=Data(3,:)=0*t; and named it SimulatedX
  8. defined one scout on the cortex and named it dip1
  9. Carried SimulatedX on process1 and ran the simulate recordings from scout
    but I received the error again!
    where were these steps wrong?

wishes
Morteza

If you have an updated version of Brainstorm, the error message cannot be the one you posted. In the last parenthesis, it must show two numbers.
https://github.com/brainstorm-tools/brainstorm3/blob/master/toolbox/process/functions/process_simulate_recordings.m#L211

Please post again screen captures showing your database explorer, the process options, and the error message.

Hi
Here are the steps those I did:
anatomy view:


Functional Data:

and BS error:

image
and MATLAB Command Window:

I don't know why I'm facing with this error!

Regards
Morteza

also for VolumeEEG again this error happend:

Brainstorm is not correctly updated, or you have multiple versions of Brainstorm in your Matlab path.
The error message you get is NOT the one that is online at the moment:
https://github.com/brainstorm-tools/brainstorm3/blob/master/toolbox/process/functions/process_simulate_recordings.m#L211

Type "edit process_simulate_recordings" to see where the faulty function. Check line 211, it should be the same as the link above.

What you can do:

  • Edit the Matlab path, remove all the folders that are not directly related with the Matlab installation folder. SAVE.
  • Delete the brainstorm3 folder, and all the other older Brainstorm installations you might have on your computer.
  • Download again Brainstorm from the website. Do not add its subfolders to the Matlab path.
1 Like