[FieldTrip] Dipole time course

Andreas Wollbrink a.wollbrink at uni-muenster.de
Fri Apr 1 16:37:45 CEST 2011

Hi Don,

I just tried out your approach on how to achieve the source waveform 
based on a given dipole source but failed calculating the scalar product 
of the inverse leadfield matrix and the normed orientation vector:

W = dot(Li,Qn);

error message: A and B must be same size.

May I ask you for a suggestion?


On 03/31/11 17:57, Rojas, Don wrote:
> Mehmet et al.
> As a follow up to this, once you have the orientation info from the
> dipole, the source space projection you wish to achieve to derive the
> timecourse can be done as follows (or at least something similar to
> this), assuming you have the fieldtrip data (data) the source, and the
> volume conductor (vol):
> L = ft_compute_leadfield(source.dip.pos, data.grad,vol); % leadfields
> Li = pinv(L); % pseudoinverse of L
> Qn = double(orientation_vector)/norm(orientation_vector); % normed
> orientation vector
> W = dot(Li,Qn); % weights for projection to source space
> waveform = dot(data,repmat(W',1,length(data))); % source waveform
> where the orientation_vector is a 1 x 3 vector of qx, qy and qz. This
> can be had from one of your sources from source.dip.mom, or from the
> suggestion of Jan-Mathijs. I don't know if the data you have is an
> average that you want to project into source space or individual trials.
> If you want to do this with the individual trials, you'd just need to do
> the last piece of code above as a for loop through your trials - you
> don't have to recompute the weights (W) used for the projection.
> Best,
> Don
> On Mar 31, 2011, at 1:38 AM, jan-mathijs schoffelen wrote:
>> Hi Mehmet,
>> I forward this to the mailing list, so that people can participate in
>> the thread.
>> I do not fully understand where the orientation information in the vol
>> comes from. The description of the volume conductor is namely a
>> geometrical object, containing either a (set of) triangulated
>> surface(s), to describe compartment boundaries, or the description of
>> a (set of) sphere(s), with an origin and a radius.
>> The outcome of the dipolefitting algorithm gives you a field, called
>> dip.mom, describing the dipole moment as a function of time. At each
>> time point, the three numbers reflect the instantaneous orientation of
>> the dipole. Since you are working with MEG, I assume that the
>> orientation of this dipole is actually defined on a plane, because we
>> routinely suppress the component with the most radial orientation from
>> the leadfield. One way of reducing the dimension is to check whether
>> there is a single dominant orientation over time. This can be achieved
>> by doing a pca (or svd) of dip.mom. The ratio of the first two
>> singular values specifies how well the dipole can be approximated as
>> one having a fixed orientation. The left singular vectors give you the
>> projection vectors, and thus specify the orientation. In other words
>> [u,s,v] = svd(dip.mom). if s(1,1) >> s(2,2), one could justify to use
>> u(:,1) as the 'orientation' of the corresponding dipole.
>> Best,
>> Jan-Mathijs
>> Begin forwarded message:
>>> *From: *Mehmet-Akif Coskun <mcoskun at mail.uh.edu
>>> <mailto:mcoskun at mail.uh.edu>>
>>> *Date: *March 31, 2011 8:57:30 AM GMT+02:00
>>> *To: *jan-mathijs schoffelen <jan.schoffelen at donders.ru.nl
>>> <mailto:jan.schoffelen at donders.ru.nl>>
>>> *Subject: **Dipole time course*
>>> Hi Jan,
>>> Thanks for all your help. I am really close to get the dipole time courses. Everything looks fine in terms of reading data, preprocessing, creating headmodel and fitting a dipole. The last part is to obtain a dipole time course.
>>> I actually read through the previous emails in discussion list and followed the advices. I used the code below to obtain the leadfield and then project the pinv'ed leadfield onto ERF to get the dipole course. But the leadfield is 3D so i get 3 time courses.
>>> % prepare leadfield cfg=[]; cfg.grad= hdr.grad; cfg.vol=vol; cfg.channel='MEG'; cfg.grid.pos=dipM50.dip.pos;
>>> [grid_ft_segment2]=ft_prepare_leadfield(cfg);
>>> In the email below, you suggested to an other user to multiply the 3D leadfields with the orientation estimated by the dipole fit. I checked the outcome of the dipole but there wasn't any orientation information. However, i checked the vol structure which has the orientation and multiply 3D leadfields with vol.ori and then project 1d leadfield onto ERF. I got a nice looking time course. I just wonder whether what i did is meaningful.
>>> Thanks
>>> Mehmet
>>> P.S= Below is your previous email
>>> I suspect that the 'orientation' onto which the pca projects the dipoles is not optimal. Perhaps you might want to try the other way, i.e. compute the leadfields in 1D, either by specifying something in cfg.grid.mom (or ori, I keep forgetting) before calling prepare_leadfield, or by postmultiplying the 3D leadfields with the orientation as estimated by the dipole fit.
>> Dr. J.M. (Jan-Mathijs) Schoffelen
>> Donders Institute for Brain, Cognition and Behaviour,
>> Centre for Cognitive Neuroimaging,
>> Radboud University Nijmegen, The Netherlands
>> J.Schoffelen at donders.ru.nl <mailto:J.Schoffelen at donders.ru.nl>
>> Telephone: 0031-24-3614793
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl <mailto:fieldtrip at donders.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
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip



   Andreas Wollbrink, Biomedical Engineer

   Institute for Biomagnetism and Biosignalanalysis       	
   Muenster University Hospital

   Malmedyweg 15         phone:   +49-(0)251-83-52546
   D-48149 Muenster      mobil:   +49-(0)160-98527553
   Germany               fax:     +49-(0)251-83-56874	
                         e-Mail: a.wollbrink at uni-muenster.de


More information about the fieldtrip mailing list