Projecting dipole into eeg electrode

Hello

How can I make like the below in BST,

  1. Choosing 1 dipole and project it to the electrode,
  2. changing the orientation of that dipole and again project it to the electrodes

Thank you

Bests
Abdallah
topoplotIndie(-lf.Gain(:,1,diploc), EEG.chanlocs,'numcontour',0,'electrodes','numbers','shading','interp');

changing the orientation of that dipole:
topoplotIndie(-lf.Gain(:,2,diploc), EEG.chanlocs,'numcontour',0,'electrodes','numbers','shading','interp');

PS, I am not able to use the above code because it seems that they used the channel format of eeglab, where in BST we do not have "theta", and the other variable exist in the image below,
either if you can help me convert the channel of bst to the below format or how can I project one dipole to channel in BST or if yiu can help me with both it would be great

Is Brainstorm has an option to export the channel locations using eeglab format?

You can export to a different file by right-clicking the channel file and then exporting to file and then you can save it into EEG Lab format. For your first question, you can do that by scripting in brainstorm, you can get the lead field matrix in Matlab and do arithmetic on that :slight_smile:

Thank you but the other variable: theta, radius, sph_theta,.... how can I get them? may be it is important for the topoplot

You could convert with matlab x,y,z to theta rho phi by using a cartesian to spherical transformation. Brainstorm doesn't have this implemented for exporting as far as i know

OK thank you, can we choose 1 dipole and project it to the electrode?

What you can do is export the leadfield matrix to matlab and then multiplying it by your sources, thus one dipole, arbitrary orientation, and import it as EEG data back into brainstorm and do the visualisations.

You can create a scout, define some activity for it (=simulate a signal), and use both to simulate recordings. This would use the orientation defined in your source model (= the normal to the cortex):

From the forward model (matrix Gain), if you know how to obtain a matrix [Nchannels x 1], you can use the function view_topography() to display it, by setting it as the input variable "F" (read the help at the beginning of the function):
[hFig, iDS, iFig] = view_topography(DataFile, Modality, TopoType, F)

changing the orientation of that dipole and again project it to the electrodes

This is not that easy to do, it would involve some scripting and deep understanding of the Brainstorm data structures involves.
A research group in Oldenburg has recently done a simulation study with Brainstorm, they were observing the effect of dipoles orientation and depth on the scalp EEG. The article will be published soon, and maybe they have some example scripts they could already share.
@ArndMeiser @martinbleichner @stedeben

where in BST we do not have "theta"

As mentioned by @SBeumer, you can use [theta,phi,r] = cart2sph(x,y,z).

OK thank you, can we choose 1 dipole and project it to the electrode?

To get the index of one dipole: either use the panel "Get coordinates" or create a scout with only one vertex and get the corresponding index from its structure in the cortex surface.
https://neuroimage.usc.edu/brainstorm/Tutorials/ExploreAnatomy#Get_coordinates
https://neuroimage.usc.edu/brainstorm/Tutorials/ExploreAnatomy#On_the_hard_drive:_Surface
https://neuroimage.usc.edu/brainstorm/Tutorials/SourceEstimation#On_the_hard_drive
https://neuroimage.usc.edu/brainstorm/Tutorials/HeadModel#On_the_hard_drive

Thank you Francois,
@ArndMeiser @martinbleichner @stedeben do you have some example scripts for studying the effect of dipoles orientation and depth on the electrode?

Thank you!