<div dir="auto"><div dir="auto">Thanks a lot Jan-Mathijs,</div><div dir="auto"><br></div>I'm going to join forces with Tibor and we'll file the PR if needed ;)<div dir="auto">Best</div><div dir="auto">Diego</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Oct 20, 2020, 13:14 Schoffelen, J.M. (Jan Mathijs) <<a href="mailto:jan.schoffelen@donders.ru.nl">jan.schoffelen@donders.ru.nl</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



<div style="word-wrap:break-word;line-break:after-white-space">
Hi Tibor,
<div><br>
</div>
<div>Let me deliberately ignore your follow up questions for now, and focus on the grand scheme of things, and ask a question back: </div>
<div><br>
</div>
<div>using the simbio headmodel, and the (it seems) cortically constrained source model as an input to ft_prepare_leadfield, does this result in dipoles which are inconsistently classified as ‘inside’, (as having a ’true’ for the corresponding entry
 in the inside-field) while the corresponding entry in the lead field cell-array is empty?</div>
<div><br>
</div>
<div>If so, this needs to be fixed, because it is incorrect behavior of the fieldtrip code. Again, looking forward to a PR that fixes this (possible) issue.</div>
<div><br>
</div>
<div>Best wishes,</div>
<div><br>
</div>
<div>Jan-Mathijs</div>
<div><br>
<div><br>
<blockquote type="cite">
<div>On 20 Oct 2020, at 11:44, <a href="mailto:tibor.auer@gmail.com" target="_blank" rel="noreferrer">
tibor.auer@gmail.com</a> wrote:</div>
<br>
<div>
<div style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none">
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
<span>Dear Diego and Jan-Mathijs,<u></u><u></u></span></div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
<span><u></u> <u></u></span></div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
<span>Thank you for your valuable input.<u></u><u></u></span></div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
<span><u></u> <u></u></span></div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
<span>I am using simbio headmodel with 5 tissue compartments.<u></u><u></u></span></div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
<span><u></u> <u></u></span></div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
<span>I have looked into the code and data, and<span> </span></span>Jan-Mathijs’ suspicion is correct. I have attached a figure, which shows the location of the 0-ranked leadfield on the sourcemodel, and they are indeed
 mostly ‘outside normal brain’ (i.e. ventricles and one spot just outside the cortex).<u></u><u></u></div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
<span><u></u> <u></u></span></div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
<span>Based on that, I think it is safe to exclude these locations. However, I wonder how these exlcusions might affect the analysis. Does it mean that I will not have an estimate for the affected locations, or will they be interpolated? If the former,
 then will these locations automatically excluded during group analysis, or do I have to explicitly exclude them?<u></u><u></u></span></div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
<span><u></u> <u></u></span></div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
<span>I understand that the locations I am showing on the attached figure are not of interest anyway.<u></u><u></u></span></div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
<span><u></u> <u></u></span></div>
<div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
Kind regards,<u></u><u></u></div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
Tibor<span> </span><u></u><u></u></div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
<u></u> <u></u></div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
<b><span style="color:rgb(34,42,53)">Auer, Tibor M.D. Ph.D.<u></u><u></u></span></b></div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
<a href="mailto:tibor.auer@gmail.com" style="color:blue;text-decoration:underline" target="_blank" rel="noreferrer"><span style="color:rgb(5,99,193)">tibor.auer@gmail.com</span></a><u></u><u></u></div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
<span style="color:rgb(34,42,53)">+44-7906-863837<u></u><u></u></span></div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
<a href="https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Ftwitter.com%2FTiborAuer&data=02%7C01%7Ct.auer%40surrey.ac.uk%7C0da68a9196be4a4fd60108d71a70e11e%7C6b902693107440aa9e21d89446a2ebb5%7C0%7C0%7C637006944417188277&sdata=aoE%2FhNWj%2F%2F3L8fDDz4S0dMuMTlt2p05mgHaDTXddP4w%3D&reserved=0" style="color:blue;text-decoration:underline" target="_blank" rel="noreferrer"><span style="color:rgb(5,99,193)">@TiborAuer</span></a><u></u><u></u></div>
</div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
<span><u></u> <u></u></span></div>
<div>
<div style="border-style:solid none none;border-top-width:1pt;border-top-color:rgb(225,225,225);padding:3pt 0cm 0cm">
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
<b>From:</b><span> </span>fieldtrip <<a href="mailto:fieldtrip-bounces@science.ru.nl" style="color:blue;text-decoration:underline" target="_blank" rel="noreferrer">fieldtrip-bounces@science.ru.nl</a>><span> </span><b>On
 Behalf Of<span> </span></b>Schoffelen, J.M. (Jan Mathijs)<br>
<b>Sent:</b><span> </span>20 October 2020 09:49<br>
<b>To:</b><span> </span>FieldTrip discussion list <<a href="mailto:fieldtrip@science.ru.nl" style="color:blue;text-decoration:underline" target="_blank" rel="noreferrer">fieldtrip@science.ru.nl</a>><br>
<b>Subject:</b><span> </span>Re: [FieldTrip] Source reconstruction - low-rank leadfield<u></u><u></u></div>
</div>
</div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
<u></u> <u></u></div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
Hi Tibor, and Jefe,<span> </span><u></u><u></u></div>
<div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
<u></u> <u></u></div>
</div>
<div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
<u></u> <u></u></div>
</div>
<div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
I guess that the road to a solution starts by looking into the code, and inspecting what line prompts the error (let me give this one away: line 145 in ft_inverse_eloreta).<u></u><u></u></div>
</div>
<div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
<u></u> <u></u></div>
</div>
<div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
Also, it might be useful to consider not only the source model, but also the volume conduction model, and the method that was used for the forward computation. This was not mentioned in your messages, so it is hard to comment on that.<u></u><u></u></div>
</div>
<div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
<u></u> <u></u></div>
</div>
<div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
Then, it may make sense to think about what matrix gives a rank of 0. Typically, the only way in which matlab returns a 0, is in the case of an empty matrix.<u></u><u></u></div>
</div>
<div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
<u></u> <u></u></div>
</div>
<div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
Thus, the suspicion will rise that the eloreta code is trying to operate on dipole positions for which the corresponding leadfield is an empty matrix.<u></u><u></u></div>
</div>
<div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
<u></u> <u></u></div>
</div>
<div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
The latter typically occurs if that dipole position is considered to be an ‘outside’ position in the forward computation step, e.g. when it is ’sticking out’ of the brain compartment boundary of the volume conduction model (but again, given the lack of details
 about the specifics of the volume conduction model etc., this is mere speculation, causing me to already type and think about this for longer than is probably necessary (in case the above is not true) ).<u></u><u></u></div>
</div>
<div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
<u></u> <u></u></div>
</div>
<div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
Then, the overall question might boil down to the question: why does the forward computation consider some dipoles to be outside (i.e. not returning a leadfield matrix for those locations), and why does the inverse computation code (at least for particular
 method) not take that into account?<u></u><u></u></div>
</div>
<div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
<u></u> <u></u></div>
</div>
<div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
Assuming that all my speculations above are valid, a principled solution will lie in ensuring that the eloreta code only considers the dipole positions with a valid lead field matrix. <u></u><u></u></div>
</div>
<div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
<u></u> <u></u></div>
</div>
<div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
I am looking forward for a PR that addresses this.<u></u><u></u></div>
</div>
<div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
<u></u> <u></u></div>
</div>
<div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
<u></u> <u></u></div>
</div>
<div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
Best wishes,<u></u><u></u></div>
</div>
<div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
<u></u> <u></u></div>
</div>
<div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
Jan-Mathijs<u></u><u></u></div>
</div>
<div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
<u></u> <u></u></div>
<div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
<br>
<br>
<u></u><u></u></div>
<blockquote style="margin-top:5pt;margin-bottom:5pt" type="cite">
<div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
On 20 Oct 2020, at 10:26, Diego Lozano-Soldevilla <<a href="mailto:dlozanosoldevilla@gmail.com" style="color:blue;text-decoration:underline" target="_blank" rel="noreferrer">dlozanosoldevilla@gmail.com</a>> wrote:<u></u><u></u></div>
</div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
<u></u> <u></u></div>
<div>
<div>
<div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
Dear Tibor and FieldTrippers<u></u><u></u></div>
</div>
<div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
I'm in the same situation. I excluded those positions but now I'm wondering whether this was a good decision. If somebody know what's happening and how to fix this, please drop a line!<u></u><u></u></div>
</div>
<div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
Yours sincerely,<u></u><u></u></div>
</div>
<div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
Diego<u></u><u></u></div>
</div>
<div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
<u></u> <u></u></div>
</div>
<div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
<u></u> <u></u></div>
</div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
<u></u> <u></u></div>
<div>
<div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
On Mon, 19 Oct 2020 at 20:17, <<a href="mailto:tibor.auer@gmail.com" style="color:blue;text-decoration:underline" target="_blank" rel="noreferrer">tibor.auer@gmail.com</a>> wrote:<u></u><u></u></div>
</div>
<blockquote style="border-style:none none none solid;border-left-width:1pt;border-left-color:rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin-left:4.8pt;margin-right:0cm" type="cite">
<div>
<div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
Dear FieldTrippers,<u></u><u></u></div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
 <u></u><u></u></div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
I have some questions regarding source reconstruction.<u></u><u></u></div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
 <u></u><u></u></div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
We use eLORETA, which runs fine for most participants, however, I receive this error message for quite a few:<u></u><u></u></div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
 <u></u><u></u></div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif;text-indent:36pt">
<i>the forward solutions have a different rank for each location, which is not supported</i><u></u><u></u></div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
 <u></u><u></u></div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
The rank of the leadfdield is reduced at each sourcemodel position to the default 3. However, it sometimes has an even lower rank (often 0) at certain sourcemodel positions, and I am not sure how to interpret it. We use a cortical sheet based sourcemodel, and
 I have noticed that only a handful (<<1%) of positions are affected. My educated guess would be to exclude those positions, but I am not sure how it affects the analysis, either.<u></u><u></u></div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
 <u></u><u></u></div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
Kind regards,<u></u><u></u></div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
Tibor<span> </span><u></u><u></u></div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
 <u></u><u></u></div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
<b><span style="color:rgb(34,42,53)">Auer, Tibor M.D. Ph.D.</span></b><u></u><u></u></div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
<b><span style="color:rgb(0,102,255)">Research Fellow</span></b><u></u><u></u></div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
<b><span style="color:rgb(0,102,255)">School of Psychology, Faculty of Health and Medical Sciences</span></b><u></u><u></u></div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
University of Surrey, Guildford GU2 7XH<u></u><u></u></div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
<a href="mailto:T.Auer@surrey.ac.uk" style="color:blue;text-decoration:underline" target="_blank" rel="noreferrer"><span style="color:rgb(5,99,193)">T.Auer@surrey.ac.uk</span></a><u></u><u></u></div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
<a href="https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Ftwitter.com%2FTiborAuer&data=02%7C01%7Ct.auer%40surrey.ac.uk%7Cdb32da458c424eedef2908d7d4bd1421%7C6b902693107440aa9e21d89446a2ebb5%7C0%7C0%7C637211780868086968&sdata=zrT5%2FnGGsar14C3WartuU99tzsfLu30Peh9fuaqrAUg%3D&reserved=0" style="color:blue;text-decoration:underline" target="_blank" rel="noreferrer"><span style="color:rgb(5,99,193)">@TiborAuer</span></a><u></u><u></u></div>
</div>
</div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
_______________________________________________<br>
fieldtrip mailing list<br>
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" style="color:blue;text-decoration:underline" target="_blank" rel="noreferrer">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
<a href="https://doi.org/10.1371/journal.pcbi.1002202" style="color:blue;text-decoration:underline" target="_blank" rel="noreferrer">https://doi.org/10.1371/journal.pcbi.1002202</a><u></u><u></u></div>
</blockquote>
</div>
</div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
_______________________________________________<br>
fieldtrip mailing list<br>
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" style="color:blue;text-decoration:underline" target="_blank" rel="noreferrer">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
<a href="https://doi.org/10.1371/journal.pcbi.1002202" style="color:blue;text-decoration:underline" target="_blank" rel="noreferrer">https://doi.org/10.1371/journal.pcbi.1002202</a><u></u><u></u></div>
</div>
</blockquote>
</div>
<div style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif">
<u></u> <u></u></div>
</div>
</div>
<span id="m_-985631603712496875cid:58D4DBE6-EFCE-4E3F-940B-BE0080C2E6DD@home"><diagnostic_aamod_meeg_sourcereconstruction_leadfieldrank.jpg></span><span style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;float:none;display:inline!important">_______________________________________________</span><br style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none">
<span style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;float:none;display:inline!important">fieldtrip
 mailing list</span><br style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none">
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" style="color:blue;text-decoration:underline;font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank" rel="noreferrer">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none">
<a href="https://doi.org/10.1371/journal.pcbi.1002202" style="color:blue;text-decoration:underline;font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank" rel="noreferrer">https://doi.org/10.1371/journal.pcbi.1002202</a><br style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none">
</div>
</blockquote>
</div>
<br>
</div>
</div>

_______________________________________________<br>
fieldtrip mailing list<br>
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer noreferrer" target="_blank">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
<a href="https://doi.org/10.1371/journal.pcbi.1002202" rel="noreferrer noreferrer" target="_blank">https://doi.org/10.1371/journal.pcbi.1002202</a><br>
</blockquote></div>