# [FieldTrip] Dipole time course

Rojas, Don Don.Rojas at ucdenver.edu
Fri May 25 15:40:18 CEST 2012

```Max,

There is no reason why you can't simply use the same strategy for both dipoles. Each will produce its own leadfields, and then your inner product of the pinv'd leadfields and the waveforms will give you two separate waveforms.

Note that by using this pseudoinverse of the leadfield approach, depending on how far apart the sources are, you may have substantial correlation between the two waveforms that is an artifact of their leadfield correlation. This shouldn't be a big problem for things like auditory sources for the left and right hemisphere, or anterior and posterior sources within a hemisphere, but once you start getting sources closer together, you might consider an alternative approach. You can try using a beamformer to suppress correlated source activity, but you could also just adopt a beamformer-like set of weights for your dipole model instead. For that, you would ideally compute a covariance matrix on the epoched data, prior to averaging. Then, you can extend the logic of the pseudoinverse method by multiplication with inverse of the covariance matrix. You can see this in the fieldtrip functions that do beamformers, such as beamformer_lcmv. Around line 255, you can see:

filt = pinv(lf' * invCy * lf) * lf' * invCy;

where lf = leadfield and invCy = inverse of covariance matrix and filt = the resulting weight vector for your sensors for that particular source location. You can then do:

waveform = filt * data to get your timecourse. In the previous example, I used the dot function to remind myself it was an inner product, but it isn't strictly necessary in matlab.

Don

On May 23, 2012, at 7:46 AM, Taubert, Max wrote:

Hi,

I'd like to use the leadfield from the ft_compute_leadfield function to compute the time course of two dipoles, given their location and orientation. So I searched on the mailing list and found a thread from  Apr-1 2011 (http://mailman.science.ru.nl/pipermail/fieldtrip/2011-April/003690.html) with a nice explanation. By using this approach it is not very difficult to obtain the waveform of a single dipole, but in my case there are TWO dipoles.

This works when assuming a single dipole:

dip.pos = [0 0.5 0];
dip.ori = [1 0 0];
li = pinv(lf);
ori = dip.mom;
ori = repmat(ori,length(li),1)';
w = dot(li,ori);
waveform = dot(D.Data,repmat(w,size(D.Data,2),1)');

Is there any way to make this work with a two-dipole-model, so I get the waveforms of both of them?

Max

_______________________________________________
fieldtrip mailing list
fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>
http://mailman.science.ru.nl/mailman/listinfo/fieldtrip

-----------------------
Don Rojas, Ph.D.
Associate Professor of Psychiatry
U. of Colorado Denver Anschutz Medical Campus
Director, UCD Magnetoencephalography Lab
13001 E. 17th Pl F546
Aurora, CO 80045
303-724-4994

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20120525/07e448b3/attachment-0002.html>
```