<div dir="ltr">Hi Mushfa,<div><br></div><div style>The values inside grid_*.leadfield are the ones that need to be concatenated, per grid position. So the first thing to do is figure out which rows in grid_eeg.pos match up with which rows in grid_meg.pos, and then only for those that match, concatenate so that the *.leadfield is of size [(number of eeg channels + number of meg channels) X 3]. </div>
<div style><br></div><div style>It might be easier to first ensure that the grid used to create these leadfields have the same 'inside' positions (inside the volume conductor).</div><div style><br></div><div style>
Best,</div><div style>Johanna</div><div style><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/5/22 Mushfa Yousuf <span dir="ltr"><<a href="mailto:mushfa.yousuf@googlemail.com" target="_blank">mushfa.yousuf@googlemail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello <span style="font-size:13px;font-family:arial,sans-serif">Jörn;</span><div><span style="font-family:arial,sans-serif;font-size:13px"><br>
</span></div><div><span style="font-family:arial,sans-serif;font-size:13px">I have calculated an indiviual leadfield for both EEG and MEG. The structure of EEg and MEG shows the following variable</span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><div><font face="arial, sans-serif" color="#000000">grid_meg = </font></div><div><font face="arial, sans-serif" color="#351c75"><br></font></div>
<div><font face="arial, sans-serif" color="#351c75"> </font><font face="arial, sans-serif" color="#0000ff"> xgrid: [1x20 double]</font></div><div><font face="arial, sans-serif" color="#0000ff"> ygrid: [-8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8]</font></div>
<div><font face="arial, sans-serif" color="#0000ff"> zgrid: [-2 -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13]</font></div><div><font face="arial, sans-serif" color="#0000ff"> dim: [20 17 16]</font></div><div><font face="arial, sans-serif" color="#0000ff"> pos: [5440x3 double]</font></div>
<div><font face="arial, sans-serif" color="#0000ff"> unit: 'cm'</font></div><div><font face="arial, sans-serif" color="#0000ff"> inside: [1x3177 double]</font></div><div><font face="arial, sans-serif" color="#0000ff"> outside: [1x2263 double]</font></div>
<div><font face="arial, sans-serif" color="#0000ff"> cfg: [1x1 struct]</font></div><div><font face="arial, sans-serif" color="#0000ff"> leadfield: {1x5440 cell}</font></div><div><font face="arial, sans-serif" color="#351c75"><br>
</font></div><div><br></div><div><font face="arial, sans-serif" color="#000000">grid_eeg = </font></div><div><font face="arial, sans-serif" color="#351c75"><br></font></div><div><font face="arial, sans-serif" color="#351c75"> </font><font face="arial, sans-serif" color="#741b47"> </font><font face="arial, sans-serif" color="#0000ff"> xgrid: [-6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9]</font></div>
<div><font face="arial, sans-serif" color="#0000ff"> ygrid: [-6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6]</font></div><div><font face="arial, sans-serif" color="#0000ff"> zgrid: [2 3 4 5 6 7 8 9 10 11]</font></div><div>
<font face="arial, sans-serif" color="#0000ff"> dim: [16 13 10]</font></div><div><font face="arial, sans-serif" color="#0000ff"> pos: [2080x3 double]</font></div><div><font face="arial, sans-serif" color="#0000ff"> unit: 'cm'</font></div>
<div><font face="arial, sans-serif" color="#0000ff"> inside: [1x1331 double]</font></div><div><font face="arial, sans-serif" color="#0000ff"> outside: [1x749 double]</font></div><div><font face="arial, sans-serif" color="#0000ff"> cfg: [1x1 struct]</font></div>
<div><font face="arial, sans-serif" color="#0000ff"> leadfield: {1x2080 cell}</font></div><div><font face="arial, sans-serif" color="#0000ff"><br></font></div><div><font face="arial, sans-serif" color="#0000ff"><br></font></div>
<div><font face="arial, sans-serif" color="#000000">Can you please give me a rough idea that how to concatenate the variables from both structure ?</font></div><div><font face="arial, sans-serif" color="#000000"> </font></div>
<div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">Thank you</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">Regards ; </font></div>
<span class="HOEnZb"><font color="#888888">
</font></span></div><span class="HOEnZb"><font color="#888888"><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">Mushfa Yousuf</font></div></font></span></div><div class="HOEnZb"><div class="h5">
<div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, May 13, 2013 at 11:13 AM, "Jörn M. Horschig" <span dir="ltr"><<a href="mailto:jm.horschig@donders.ru.nl" target="_blank">jm.horschig@donders.ru.nl</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
<div>Dear Mushfa,<br>
<br>
I think you have to compute two leadfield matrices, one for EEG
(elec) and one for MEG (grad), and then concatenate these (and
make sure that the order of sensors won't get mixed up anywhere,
because sourceanalysis just expects the leadfield matrix to be
ordered like your data. If that's not the case, you either
encounter the previous error you described or (if the number of
channels matches, but order is mixed up) it will just return wrong
source estimated activity.<br>
<br>
Best,<br>
Jörn<div><div><br>
<br>
On 5/6/2013 2:47 PM, Mushfa Yousuf wrote:<br>
</div></div></div><div><div>
<blockquote type="cite">
<div dir="ltr">Hello;
<div><br>
</div>
<div>Yes you were right. I have defined the wrong sensors i.e
'grad' instead of 'elec' while calculating the Leadfield.</div>
<div><br>
</div>
<div>Actually I am trying to calculate Combined source
reconstruction from both EEG and MEG sensors.</div>
<div><br>
</div>
<div>Do you have any idea, how to define both elec and
grad definition while calculating first forward then inverse
solution.</div>
<div><br>
</div>
<div>Because in a fieldtrip either you can defined elec or grad
at one time.</div>
<div><br>
</div>
<div><br>
</div>
<div>
<div style="font-family:arial,sans-serif;font-size:13px">Regards;</div>
<div style="font-family:arial,sans-serif;font-size:13px"><br>
</div>
<div style="font-family:arial,sans-serif;font-size:13px">
<br>
</div>
<div style="font-family:arial,sans-serif;font-size:13px">Mushfa
Yousuf</div>
<div style="font-family:arial,sans-serif;font-size:13px"><br>
</div>
<div style="font-family:arial,sans-serif;font-size:13px">Neurozentrum,</div>
<div style="font-family:arial,sans-serif;font-size:13px">Universitätsklinikum
Schleswig-Holstein, </div>
<div style="font-family:arial,sans-serif;font-size:13px">Campus
Kiel (UKSH), Deutschland</div>
</div>
</div>
<div class="gmail_extra">
<br>
<br>
<div class="gmail_quote">On Tue, Apr 30, 2013 at 6:23 PM,
Johanna Zumer <span dir="ltr"><<a href="mailto:johanna.zumer@gmail.com" target="_blank">johanna.zumer@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Hi Mushfa,
<div><br>
</div>
<div>My guess is that the channels that have you used to
compute .csdspctrm are not the same as the channels in
cfg.elec. If you set cfg.channel = freqPost.label,
does that solve it?</div>
<div><br>
</div>
<div>Cheers,</div>
<div>Johanna</div>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">2013/4/30 Mushfa Yousuf <span dir="ltr"><<a href="mailto:mushfa.yousuf@googlemail.com" target="_blank">mushfa.yousuf@googlemail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div>
<div dir="ltr">
<div>Hello Fieldtrippers,</div>
<div><br>
</div>
<div>I am doing source reconstruction using EEG
channels on a fieldtrip.</div>
<div><br>
</div>
<div>I have computed Forward solution i.e head
model using 'Openmeeg' and lead field
successfully.</div>
<div><br>
</div>
<div>For the inverse solution using 'dics'
method, I wrote the following syntax </div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div> cfg = []; </div>
<div>
cfg.method = 'dics';</div>
<div> cfg.frequency = 130;</div>
<div> cfg.elec = dataFIC12.hdr.elec;</div>
<div> cfg.grid = grid; </div>
<div> cfg.vol = vol;</div>
<div><br>
</div>
<div> sourcePost = ft_sourceanalysis(cfg,
freqPost);</div>
<div><br>
</div>
<div><br>
</div>
<div>and I have received the following error:</div>
<div><br>
</div>
<div><br>
</div>
<div>
<div><font color="#ff0000">??? Error using
==> mtimes</font></div>
<div><font color="#ff0000">Inner matrix
dimensions must agree.</font></div>
<div><font color="#ff0000"><br>
</font></div>
<div><font color="#ff0000">Error in ==>
beamformer_dics at 314</font></div>
<div><font color="#ff0000"> filt =
pinv(lf' * invCf * lf) * lf' * invCf;
%</font></div>
<div><font color="#ff0000"> Gross eqn.
3, use PINV/SVD to cover rank deficient</font></div>
<div><font color="#ff0000"> leadfield</font></div>
<div><font color="#ff0000"><br>
</font></div>
<div><font color="#ff0000">Error in ==>
ft_sourceanalysis at 595</font></div>
<div><font color="#ff0000"> dip(i) =
beamformer_dics(grid, sens, vol, [],</font></div>
<div><font color="#ff0000">
squeeze(Cf(i,:,:)), optarg{:});</font></div>
<div><font color="#ff0000"><br>
</font></div>
<div><font color="#ff0000">Error in ==>
newCode at 214</font></div>
<div><font color="#ff0000">sourcePost =
ft_sourceanalysis(cfg, freqPost);</font></div>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>Any help would be appreciated.</div>
<div><br>
</div>
<div><br>
</div>
<div>Regards;</div>
<div><br>
</div>
<div><br>
</div>
<div>Mushfa Yousuf</div>
<div><br>
</div>
<div>Neurozentrum,</div>
<div>Universitätsklinikum Schleswig-Holstein, </div>
<div>Campus Kiel (UKSH), Deutschland</div>
<div><br>
</div>
</div>
<br>
</div>
</div>
_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
</blockquote>
</div>
<br>
</div>
<br>
_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
</blockquote>
</div>
<br>
</div>
<br>
<fieldset></fieldset>
<br>
<pre>_______________________________________________
fieldtrip mailing list
<a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a></pre>
</blockquote>
<br>
<br>
</div></div><pre cols="72">--
Jörn M. Horschig
PhD Student
Donders Institute for Brain, Cognition and Behaviour
Centre for Cognitive Neuroimaging
Radboud University Nijmegen
Neuronal Oscillations Group
FieldTrip Development Team
P.O. Box 9101
NL-6500 HB Nijmegen
The Netherlands
Contact:
E-Mail: <a href="mailto:jm.horschig@donders.ru.nl" target="_blank">jm.horschig@donders.ru.nl</a>
Tel: <a href="tel:%2B31-%280%2924-36-68493" value="+31243668493" target="_blank">+31-(0)24-36-68493</a>
Web: <a href="http://www.ru.nl/donders" target="_blank">http://www.ru.nl/donders</a>
Visiting address:
Trigon, room 2.30
Kapittelweg 29
NL-6525 EN Nijmegen
The Netherlands</pre>
</div>
<br>_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br></blockquote></div><br></div>