<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><div dir="ltr"><div>Dear Pierre,</div><div><br></div><div>if you are running a recent version of FieldTrip (newer than Dec 15, 2018), there should be a check included in ft_prepare_vol_sens to avoid this behavior, i.e., if a transfer matrix is detected in the vol-struct provided to ft_prepare_vol_sens, it is checked if whether this fits to the indicated sensor configuration and if this is the case no new transfer matrix is computed. This should also work if a subset of sensors is selected. Thus, it would be great, if you could check whether this behavior remains when using a recent checkout of FieldTrip.</div><div><br></div><div>Regarding the time requirement for computing the transfer matrix - the calculation in sb_transfer can be easily parallelized by replacing l 35 in sb_transfer with a parfor loop, e.g., parfor(i=2:length(vol.elecnodes),8), if you want to compute on 8 cores.</div><div><br></div><div>I hope this answer is helpful to you!</div><div><br></div><div>Best,</div><div>    Johannes<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Am Do., 21. Feb. 2019 um 17:17 Uhr schrieb Pierre Bastien Megevand <<a href="mailto:Pierre.Megevand@unige.ch">Pierre.Megevand@unige.ch</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">




<div dir="ltr">
<div id="gmail-m_6405811675439077465divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<p>Dear all,</p>
<p><br>
</p>
<p>I think I have found an inconsistency in the way Fieldtrip handles the building of a FEM forward solution. <span style="font-size:12pt">I am following the procedure described in </span><span style="font-size:12pt">Vorwerk, Oostenveld et al., </span><span style="font-size:12pt">The </span><span style="font-size:12pt">FieldTrip-SimBio
 pipeline for EEG forward solutions. Biomed Eng Online. 2018 </span><span style="font-size:12pt">(</span><a href="https://biomedical-engineering-online.biomedcentral.com/articles/10.1186/s12938-018-0463-y" class="gmail-m_6405811675439077465OWAAutoLink" id="gmail-m_6405811675439077465LPlnk762959" style="font-size:12pt" target="_blank">https://biomedical-engineering-online.biomedcentral.com/articles/10.1186/s12938-018-0463-y</a><span style="font-size:12pt">).
 This procedure suggests to build the forward solution by calling the following Fieldtrip functions:</span></p>
<p>ft_read_mri</p>
<p>ft_volumerealign</p>
<p>ft_volumereslice</p>
<p>ft_volumesegment</p>
<p>ft_prepare_mesh</p>
<p>ft_prepare_headmodel</p>
<p>    ft_read_header (to get electrode data)</p>
<p>    ft_electroderealign</p>
<p>ft_prepare_vol_sens</p>
<p>ft_prepare_sourcemodel</p>
<p>ft_prepare_leadfield</p>
<p><br>
</p>
<p>My issue is the following: the FieldTrip-SimBio pipeline explicitly calls ft_prepare_vol_sens, which takes very long to execute (over 6 hours in the case of the published paper, which used about 80 electrodes). However, ft_prepare_leadfield later calls (line
 165) prepare_headmodel, which <span style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size:16px">
itself </span>calls (line 113) ft_prepare_vol_sens again, with the same parameters as far as I can tell (and again taking ages to run).</p>
<p><br>
</p>
<p>Is this redundancy intended? If not, can it be circumvented?</p>
<p><br>
</p>
<p>Thank you in advance,</p>
<p><br>
</p>
<p>Pierre</p>
<p><br>
</p>
<div id="gmail-m_6405811675439077465Signature">
<div id="gmail-m_6405811675439077465divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<p></p>
<div class="gmail-m_6405811675439077465PlainText">Pierre Mégevand, MD, PhD<br>
Senior research associate, Dept. of basic neurosciences</div>
<div class="gmail-m_6405811675439077465PlainText"><span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">F</span><span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">aculty of medicine</span><span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">, </span>University
 of Geneva, Switzerland<br>
T. +41 76 693 65 22 | <a href="mailto:pierre.megevand@unige.ch" target="_blank">pierre.megevand@unige.ch</a></div>
<br>
<p></p>
</div>
</div>
</div>
</div>

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