I would like to simulate a dipole and do the inverse solution. For this I tried to note down the vertex number so as to edit the ImageGridAmp matrix setting everything to zero except the vertex of interest.
But after exporting it to MATLAB the ImageGridAmp has no value in it. It’s empty.
Can anyone suggest me how to solve this and even if there’s other solution to simulate a dipole.
Hi Kidist,
The method is correct: export the sources to Matlab, select one dipole of interest and set everything else to zero in ImageGridAmp, re-import it in the database, right-click on the file > Method evaluation > Simulate recordings.
The only thing you need to do is to calculate the initial source file using the option “Full sources” (expert mode, in the options window). For details about the meaning of ImageGridAmp and ImagingKernel, please read again the source estimation tutorial: http://neuroimage.usc.edu/brainstorm/Tutorials/TutSourceEstimation
Because your are trying to calculate a “shared kernel”, you need to compute your sources for one specific data file (or a few specific data files).
Please read again the tutorial if this is unclear.
After restarting the software the “Full sources” option is now enabled.
So I set everything to zero except the dipole (vertex number) that I’ve selected
Re-import and clicked the simulate recordings then I get the following error of mismatch :
** Error: Line 87: bst_simulation at 87
** Number of sources in the head model (15266) and the inverse model (1) do not match.
**
** Call stack:
** >bst_simulation.m at 87
** >bst_call.m at 28
** >tree_callbacks.m>@(h,ev)bst_call(@bst_simulation,filenameRelative) at 1385
**
In the edited source structure, the size of ImageGridAmp should be [Nsources x Ntime], with Nsources=15266
ImagingKernel must be set to the empty matrix [].
The error message tells you that in your case, Nsources = 1.
The vertex number I would like to simulate is let’s say 1304.
ImageGridAmp = 15266*2001
So I thought that all sources should be set to zero except for this particular source making the Nsources=1
So which rows do I need to edit from the ImageGridAmp matrix? The ImagingKernel matrix is already empty from the beginning.
The popup menu “Model evaluation > Simulate recordings” and the menu “Sources > Simulate recordings” in the scout tab are indeed calling the same function bst_simulation.m.
In the first case (from the database explorer), it uses the sources of the whole brain.
In the second case (scout options), it uses only the sources from the selected scouts. If there are no selected scouts (or no scouts at all), it uses the entire cortex surface, as in the first case.
This function simulates MEG/EEG recordings by multiplying the MNE source time series by the forward model. If ForwardMat represents the head model file structure, InverseMat the full source file, and iVertices the sources used for the simulation:
SimulatedRecordings = ForwardMat.Gain(:,iVertices) * InverseMat.ImageGridAmp(iVertices,:);
This menu is available only for the original wMNE results. The dSPM and sLORETA are additional statistics calculated from the wMNE results.
Thank you for your response, it has been very helpful!
But I have other query.
When you set ImageGridAmp matrix everything to zero except the vertex (a particular scout) of interest and them you select popup menu “Model evaluation > Simulate recordings”, is the same to put “Sources > Simulate recordings” in the scout tab (in the same scout, obviously) ?
Yes, it should produce the same results.
However, I haven’t used those functions in a while, there might be some small hidden bugs.
You could try both approaches for one file and make sure they give the same thing, just to make it works properly.
Francois