<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Hi Jan-Mathias!</div><div><br></div><div>Thank you for the answer!</div><div>I changed the units of gradiometers and head model to cm. <br></div><div>This clearly decreased the residual variances. <br></div><div>Also, singleshell seems to work better than localspheres.  <br></div><div><br></div><div>However, the transformation seems to still increase the residual variance a lot. </div><div><br></div><div>Here are some examples:<br></div><div>original -> template             RV 407.64 %<br>original             -> original RV 9.85 %<br>original -> template -> original RV 10.75 %<br>realigning trial 706<br>original -> template             RV 393.13 %<br>original             -> original RV 9.00 %<br>original -> template -> original RV 9.90 %<br>realigning trial 707<br>original -> template             RV 362.10 %<br>original             -> original RV 8.33 %<br>original -> template -> original RV 9.18 %<br>realigning trial 708<br>original -> template             RV 377.15 %<br>original             -> original RV 9.43 %<br>original -> template -> original RV 10.33 %<br></div><div><br></div><div>The code is now as follows:</div><div>load([data_path nameList{subj} '.mat']);<br>grad = datafinal.grad;<br>hs=ft_read_headshape([hdr_path nameList{subj} '/hs_file']);<br>     <br></div><div>cfg           = [];<br>cfg.method    = 'singlesphere';<br>cfg.geom      = hs;<br>cfg.grad      = grad;<br>cfg.feedback  = true;<br>vol  = ft_prepare_headmodel(cfg);<br><br>vol = ft_convert_units(vol,'cm');<br>grad = ft_convert_units(grad,'cm');<br>cfg = [];<br>cfg.template = template;<br>cfg.inwardshift = 2.5;<br>cfg.feedback ='no';<br>cfg.vol =  vol;<br>data = ft_megrealign(cfg, data);<br></div><div><br></div><div>Best,</div><div>Maria<br></div></div></div></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr">to 1. marrask. 2018 klo 10.35 Schoffelen, J.M. (Jan Mathijs) (<a href="mailto:jan.schoffelen@donders.ru.nl" target="_blank">jan.schoffelen@donders.ru.nl</a>) kirjoitti:<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">
Hi Maria,
<div><br>
</div>
<div>Are you sure about the units in your headmodel (and gradiometers)? Using the value 1.0 as an inwardshift parameter suggests ‘cm’. Not sure what will happen when by accident the hs_file is in ‘m’ (which, as far as I know, is usually the case).</div>
<div><br>
</div>
<div>Best wishes,</div>
<div><br>
</div>
<div>Jan-Mathijs</div>
<div><br>
</div>
<div>
<div>
<div style="word-wrap:break-word">
<div style="word-wrap:break-word">
<div style="word-wrap:break-word">
J.M.Schoffelen, MD PhD<br>
Senior Researcher, VIDI-fellow - PI, language in interaction<br>
Telephone: +31-24-3614793</div>
<div style="word-wrap:break-word">
Physical location: room 00.028</div>
<div style="word-wrap:break-word">
Donders Centre for Cognitive Neuroimaging, Nijmegen, The Netherlands<br>
<br>
<br>
</div>
</div>
</div>
</div>
</div>
<div><br>
</div>
<div><br>
<div>
<blockquote type="cite">
<div>On 29 Oct 2018, at 13:33, Maria Hakonen <<a href="mailto:maria.hakonen@gmail.com" target="_blank">maria.hakonen@gmail.com</a>> wrote:</div>
<br class="m_-7034864709617909802m_1969197435777587028Apple-interchange-newline">
<div>
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">Dear FieldTrip experts,
<div><br>
</div>
<div>I have run ft_mergealign across subjects to align the head positions. However, the residual variance between the original and the realigned data seems to be high:</div>
<div> </div>
<div>
<div>original -> template             RV 21232.46 %</div>
<div>original             -> original RV 36.96 %</div>
<div>original -> template -> original RV 9579.95 %</div>
</div>
<div><br>
</div>
<div>Could someone please let me know what would be the largest acceptable change in the residual variance, and what should I do if the residual variance is too high? Does the increase in residual variance mean that there is a large shift in the head
 position? </div>
<div><br>
</div>
<div>I have used ft_mergealign as follows:</div>
<div><br>
</div>
<div>template = list of subjects (i.e. I want to calculate an average head position over the subjects)</div>
<div><br>
</div>
<div>
<div>grad = data.grad;</div>
<div>hs=ft_read_headshape([hdr_path nameList{subj} '/hs_file']);</div>
<div>vol = ft_headmodel_localspheres(hs,grad);</div>
<div><br>
</div>
<div>cfg = [];</div>
<div>cfg.template = template;</div>
<div>cfg.inwardshift = 1.0;</div>
<div>cfg.vol =  vol;</div>
<div>data_aligned = ft_megrealign(cfg, data);</div>
</div>
<div><br>
</div>
<div>Best,</div>
<div>Maria   <br>
</div>
<div><br>
</div>
</div>
</div>
</div>
_______________________________________________<br>
fieldtrip mailing list<br>
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
<a href="https://doi.org/10.1371/journal.pcbi.1002202" target="_blank">https://doi.org/10.1371/journal.pcbi.1002202</a><br>
</div>
</blockquote>
</div>
<br>
</div>
<br>
<br>
<div>
<div style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word">
<div style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word">
<div style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word">
<br>
</div>
</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>