<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Floris,<div><br></div><div>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.</div><div><br></div><div>Cheers,</div><div><br></div><div>JM</div><div><br></div><div><br><div><div>On Jul 7, 2009, at 1:34 PM, Floris de Lange wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Dear Jan-Matthijs and other fieldtrippers,<br><br>Thanks for your reply. I tried out your first suggestion. Unfortunately, the dipole time courses look considerably worse than what I get from picking the planar sensors that have the strongest signal. I've attached the results for 2 conditions in the left and right auditory cortex, for comparison. On the top left is (one of the 3 matrices of) the relevant leadfield, and on the right is the planar ERF. On the bottom are the time courses of the pinv'ed leadfield * ERF time course, which are then pca'ed. I have pasted the code used below. Any idea why the dipole time course looks so much worse? <br> <br>% calculate leadfields for the two dipole locations<br>    cfg                       = [];<br>    cfg.grad                  = erf{1}.grad;<br>    cfg.vol                   = vol;<br>    cfg.channel               = {'MEG'};<br>     cfg.grid.pos  = source.dip.pos;<br>    [grid]                    = prepare_leadfield(cfg);<br><br>% multiply pseudo-inverse of leadfield with erf, then do a pca<br>dip{i}{cond} = pinv(grid.leadfield{i}) * erf{cond}.avg;<br> [tmp1 tmp2] = pca(dip{i}{cond});<br><br>Any input appreciated,<br>Best wishes,<br>Floris<br><br><br><br><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote"> Dear Floris,<br><br> Dipolefitting uses the pseudo-inverse of the leadfield as its inverse<br> operator. Using prepare_leadfield with the right input should give<br> you the leadfields of the two locations of interest, pinv'ing the<br> concatenated leadfields would give you the inverse operator (and<br> multiplying the sensor level evoked field with the inverse operator<br> gives you the dipoles' time courses (each in 3D)). The individual<br> timecourses could be reduced to 1D by a pca. Alternatively, you could<br> multiply each of the individual leadfields with the average<br> reconstructed dipole orientation, so that you end up with a<br> (concatenated across the two dipoles) forward model of 275x2,<br> pinv'ing this one, and multiplying it with your sensor data directly<br> gives you time courses in 1D.<br><br> Cheers,<br><br> JM<br><br> On Jul 6, 2009, at 5:48 PM, Floris de Lange wrote:<br><br> > Dear Fieldtrippers,<br> ><br> > I have a fairly basic Fieldtrip question; I hope you can point me<br> > in the right direction.<br> > I'm running a dipole model on the early auditory response (60-90 ms<br> > after the click). The dipoloe fit works very well. Just for<br> > completeness, these are the lines of code I used:<br> ><br> > cfg = [];<br> > cfg.numdipoles = 2;<br> > cfg.symmetry = 'y';<br> > cfg.model = 'regional';<br> > cfg.latency = [-0.44 -0.41];<br> > cfg.vol = vol;<br> > cfg.inwardshift  = 0;<br> > source = dipolefitting(cfg,erf{1});<br> ><br> > % visualize where the dipoles are<br> > figure(1); clf; headmodelplot(cfg,erf{1})<br> > hold on;<br> > plot3([source.dip.pos(1,1)],[<div id=":11s" class="ii gt">source.dip.pos(1,2)],[source.dip.pos<br> > (1,3)],'ro');<br> > plot3([source.dip.pos(2,1)],[source.dip.pos(2,2)],[source.dip.pos<br> > (2,3)],'bo');<br> ><br> > I have fitted the dipole over a 30 msec window. But now, I would<br> > like to plot the response of these dipoles for the whole time<br> > window sampled.<br> > In other words, I would like to use the coordinates obtained from<br> > the dipole fitting procedure, and use them as 'virtual sensors' to<br> > reduce the dimensionality of my data from 275 channel time courses<br> > to 2. I don't want to use the dipole moments, because they're only<br> > defined within the 30 ms that I used to calculate my dipole.<br> > I suppose I have to project my data through the dipoles, but I'm<br> > not sure how. Any help is greatly appreciated!<br> ><br> > Best wishes,<br> > Floris</div></blockquote> <br><br clear="all">--<br>Floris de Lange<br><a href="http://www.florisdelange.com">http://www.florisdelange.com</a><br><p>----------------------------------</p><p>The aim of this list is to facilitate the discussion between users of the FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis.</p><p>  <a href="http://listserv.surfnet.nl/archives/fieldtrip.html">http://listserv.surfnet.nl/archives/fieldtrip.html</a></p><p>  <a href="http://www.ru.nl/fcdonders/fieldtrip/">http://www.ru.nl/fcdonders/fieldtrip/</a></p> <span><flodlan_dipresults_1_1.tif></span><span><flodlan_dipresults_1_2.tif></span><span><flodlan_dipresults_2_1.tif></span><span><flodlan_dipresults_2_2.tif></span></blockquote></div><br></div></body></html><p>----------------------------------</p>
<p>The aim of this list is to facilitate the discussion between users of the FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis.</p>
<p>  http://listserv.surfnet.nl/archives/fieldtrip.html</p>
<p>  http://www.ru.nl/fcdonders/fieldtrip/</p>