# Position dependent dipole activations for Labels

Hi!

I want to create source estimates with the mne.SourceSimulator. Hence, I created a set of labels randomly. However, I am not aware of how to assign individual values to the vertices corresponding to a label. That is, I want to apply a radial function, e.g. a Gaussian, s.t. vertices which have a larger distance to the centre vertex/centre of mass have lower activations than nearby vertices. Normally, you just pass a time function, but not a spatial one, as the waveform. A particular problem is, that vertices can be repeated when having many labels. This is something, MNE handles by itself. Unfortunately, I have to manually find the duplicates and handle them, if I write my own function to apply â€śspatial transformationsâ€ť to the activations, which is quite unhandy. Is there an easier way of achieving that, i.e. a build-in mne method?

• MNE version: e.g. 1.0.3
• operating system: Windows 10

Best,
Robert

maybe this function https://mne.tools/dev/generated/mne.grow_labels.html can help?

Alex

1 Like

Okay, this would be at least a solution since I can set overlap to False and mitigate the problem. I used mne.label.select_sources beforehand. However, still, I need to write a â€ścustomâ€ť method, which works on stc.data after creating the source estimate, s.t. that the vertices of one label do not have the same activations throughout the patch at one time step. But at least it is easier yet, when the labels are not overlapping. So thank you for the hint!

Robert

you need to understand the concept of â€śvertnoâ€ť â€śverticesâ€ť in the source space. Then an stc
object is â€śjustâ€ť the list of vertno (vertex numbers) and the associated numpy array with time
courses

I suggest you read the code of this function to understand.

HTH
ALex

Okay, maybe I wasnâ€™t that explicit about what I wanted to achieve, so I try to clear it up.

It is straightforward to create different patches/labels from the source space which then make up my dipole activations within the SourceEstimate object. I use mne.simulation.SourceSimulator. For each label, I add the waveform and the events, as described in the documentation. However, the waveform is a 1D array, which simply describes the time evolution of the dipole activations. Thus, every vertex within label x will have a dipole activation corresponding to the waveform. Hence, all the vertices within label x have the same dipole activations. However, I want something different: I calculate the center of mass of each label (or use the â€ścentreâ€ť vertex when restricted to a specific source space). From that, I use a Gaussian RBF to calculate the dipole activations of each vertex. The mean of the RBF is the coordinates of the centre vertex and the variance is half of the largest distance within the label vertices. Thus, each dipole activation of a vertex depends on the distance to the centre of mass. And these dipole activations shall then be â€śtransformed into the time domainâ€ť by applying the time course. However, the SourceSimulator Class only accepts 1D waveforms (or 2D, but then one dimension corresponds to the events) - but basically, I would like to apply a waveform of shape (vertices_in_label, time_steps). As another workaround, I could calculate the centre of mass of the combination of all labels within a hemisphere and apply the resulting function again to stc.data, since I know which row corresponds to which vertex. However, when the labels are further away from each other, this will be somehow unrealistic.

Sorry for the long text, maybe I sketch something next time. Nevertheless, Iâ€™ll look into the code and maybe can take something away from there.

Thanks for the help!
Robert