<div dir="ltr">Dear Julian,<div><br></div><div>Thanks a lot for your advice! Some follow-up questions and clarifications.<br><div><br></div><div>1a. I've looked at both approaches suggested in <a href="http://www.fieldtriptoolbox.org/tutorial/sourcemodel?s%5B%5D=warp">http://www.fieldtriptoolbox.org/tutorial/sourcemodel?s%5B%5D=warp</a>. For the first approach (interpolate then normalize volumes), I used the following code (for EEG data), where I compute source values from two conditions, ON and OFF:</div><div><br></div><div><p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">    cfg              = [];</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">    cfg.method       = <span style="color:#b245f3">'dics'</span>;</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">    cfg.frequency    = 18;</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">    cfg.grid         = grid;</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">    cfg.headmodel    = headmodel;</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">    cfg.dics.projectnoise = <span style="color:#b245f3">'yes'</span>;</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">    cfg.dics.lambda       = <span style="color:#b245f3">'5%'</span>;</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">    cfg.dics.keepfilter   = <span style="color:#b245f3">'yes'</span>;</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">    cfg.dics.realfilter   = <span style="color:#b245f3">'yes'</span>;</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">    sourceAllneg_pos = ft_sourceanalysis(cfg, freqAll);</p></div><div><span class="sewkmz8w9iidcuw"></span><span class="sewj6cnnyyyz0sb"></span><br></div><div><p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">    cfg.grid.filter = sourceAllneg_pos.avg.filter;</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">    sourceOFF_con  = ft_sourceanalysis(cfg, freqOFF);</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">    sourceON_con = ft_sourceanalysis(cfg, freqON);</p></div><div><span class="sewkmz8w9iidcuw"></span><span class="sewj6cnnyyyz0sb"></span><br></div><div><p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(178,69,243)"><span style="color:#000000">    atlas = ft_read_atlas(</span>'~/Documents/MATLAB/fieldtrip-20170618/template/atlas/aal/ROI_MNI_V4.nii'<span style="color:#000000">);</span></p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">    cfg=[];</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">    cfg.parameter=<span style="color:#b245f3">'pow'</span>;</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">    cont_sources{pat,1,1}=ft_sourceinterpolate(cfg, sourceOFF_con, atlas);</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">    cont_sources{pat,1,2}=ft_sourceinterpolate(cfg, sourceON_con, atlas); </p><p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier"><br></p><p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">    cfg=[];</p><p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">    cfg.parameter='pow';</p><p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">    [mri] = ft_volumenormalise(cfg, mri)<span class="sewkmz8w9iidcuw"></span><span class="sewj6cnnyyyz0sb"></span></p><p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier"><br></p><p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier"><br></p></div><div><span class="sewkmz8w9iidcuw"></span>Using ft_sourceinterpolate normalized the .pos values across my subjects, however I'm not sure what to do with the MRI variable created with ft_volumenormalize, but I'm guessing it should be integrated somewhere for results to be valid.</div><div><br></div><div> 1b. I also tried the second method in the tutorial (Subject-specific grids), but the standard_sourcemodel3dxmm.mat files are based on the single shell method, and hence only relevant for MEG. When inputting cfg.grid.template= 'cortex_xxxx.surf.gii' (the other templates, which I hope are for EEG), I get the error using load: 'Number of columns on line 2 of ASCII file cortex_xxxx.surf.gii must be the same as previous lines.</div></div><div><br></div><div>2. Yes, I just used</div><div><br></div><div><p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">%get mri</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">mri = ft_read_mri(<span style="color:#b245f3">'0001.dcm'</span>);</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;min-height:12px"> </p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">%segment mri</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">cfg=[];</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(178,69,243)"><span style="color:#000000">cfg.output={</span>'brain'<span style="color:#000000">,</span>'skull'<span style="color:#000000">,</span>'scalp'<span style="color:#000000">};</span></p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">segmentedmri=ft_volumesegment(cfg,mri);</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">% Y</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">% r</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">% a</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">% s</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">% n</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45);min-height:12px"> </p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">cfg=[];</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(178,69,243)"><span style="color:#000000">cfg.tissue={</span>'brain'<span style="color:#000000">,</span>'skull'<span style="color:#000000">,</span>'scalp'<span style="color:#000000">};</span></p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">cfg.numvertices=[3000 2000 1000];</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)"><span style="color:#000000">cfg.method=</span><span style="color:#b245f3">'projectmesh'</span><span style="color:#000000">;</span>% or 'iso2mesh', 'isosurface',</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">bnd=ft_prepare_mesh(cfg,segmentedmri);</p></div><div><span class="sewkmz8w9iidcuw"></span><span class="sewj6cnnyyyz0sb"></span><br></div><div><p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">cfg=[];</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)"><span style="color:#000000">cfg.method=</span><span style="color:#b245f3">'bemcp'</span><span style="color:#000000">;</span>%or dipoli on a mac, or openmeeg</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">headmodel        = ft_prepare_headmodel(cfg,bnd);</p></div><div><span class="sewkmz8w9iidcuw"></span><span class="sewj6cnnyyyz0sb"></span><br></div><div>I'm using a mac, though I can't get dipoli to work. I've used this for the other subjects without every problem. I have no fiducials, not sure if this has any influence. <br></div><div><br></div><div>3. I've thought about this further, it doesn't make much sense to do this at the source level.</div><div>4. The warning occurs after running</div><div><p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">    cfg=[];</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)"><span style="color:#000000">    cfg.method=</span><span style="color:#b245f3">'bemcp'</span><span style="color:#000000">;</span>%or dipoli on a mac, or openmeeg</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">    headmodel        = ft_prepare_headmodel(cfg,bnd);</p></div><div><span class="sewkmz8w9iidcuw"></span><span class="sewj6cnnyyyz0sb"></span><br></div><div>, though I also get this when running sample data from fieldtrip tutorials.</div><div><br></div><div>Again, thank you immensely for your pointers!</div><div>Uri</div></div><div class="gmail_extra"><br><div class="gmail_quote">2017-12-12 17:49 GMT+01:00 Julian Keil <span dir="ltr"><<a href="mailto:julian.keil@gmail.com" target="_blank">julian.keil@gmail.com</a>></span>:<br><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">Dear Eduardo,<div><br></div><div>@1: Do you mean normalize across the group? What you could do is interpolate the source-level data to an MRI and then use ft_volumenormalise to normalize all images to a common standard MRI. Check the FT site here: <a href="http://www.fieldtriptoolbox.org/tutorial/sourcemodel?s%5B%5D=warp" target="_blank">http://www.fieldtriptoolbox.<wbr>org/tutorial/sourcemodel?s[]=<wbr>warp</a></div><div>Alternatively, you could take care that a common source grid is warped to the individual headmodel prior to the source analysis. In this case, you don’t need to normalize, as all subjects have the same number of sources. Check the tutorials on the FT-website for hints (e.g. <a href="http://www.fieldtriptoolbox.org/tutorial/salzburg?s%5B%5D=warp" target="_blank">http://www.<wbr>fieldtriptoolbox.org/tutorial/<wbr>salzburg?s[]=warp</a> or <a href="http://www.fieldtriptoolbox.org/tutorial/beamformingextended?s%5B%5D=warp" target="_blank">http://<wbr>www.fieldtriptoolbox.org/<wbr>tutorial/beamformingextended?<wbr>s[]=warp</a>)</div><div><br></div><div>@2: Did you build your own headmodel? It might be that the elements of the headmodel intersect. I would go back and double check all steps leading up to the leadfield computation for errors.</div><div><br></div><div>@3: I have no idea.</div><div><br></div><div>@4: When does this happen?</div><div><br></div><div>Good luck,</div><div><br></div><div>Julian<br><div><br><blockquote type="cite"><div><div class="h5"><div>Am 12.12.2017 um 14:38 schrieb Uri Eduardo Ramírez Pasos <<a href="mailto:urieduardo@gmail.com" target="_blank">urieduardo@gmail.com</a>>:</div><br class="m_-5176628974459660507Apple-interchange-newline"></div></div><div><div><div class="h5"><div dir="ltr">Dear fieldtrippers,<div><br></div><div>I have a couple questions regarding source reconstruction that I hope you can help me with.</div><div><br></div><div>1. What is the best way to 'normalize' the position values in each forward model across my subjects so that I can run ft_sourcestatistics with cfg.statistic = 'ft_statfun_depsamplesT' ? </div><div><br></div><div>2. For one of my subjects, their leadfield keeps containing only NaNs. What could be the source (no pun intended) of the problem?</div><div><br></div><div>3. If my experiment's design has three 'levels' (say A1, A2, A3) for one 'factor', is it valid to subtract source values (obtained using method 'dics') for a comparison (e.g. A1-A3 vs A2-A3)? </div><div><br></div><div>4. What could have gone wrong when i get the warning “matrix is singular, close to singular or badly scaled. Results may be inaccurate.” How does one go about solving this? </div><div><br></div><div>Best regards,</div><div>Eduardo Ramírez, PhD candidate</div><div>University of Würzburg</div></div></div></div>
______________________________<wbr>_________________<br>fieldtrip mailing list<br><a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br><a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">https://mailman.science.ru.nl/<wbr>mailman/listinfo/fieldtrip</a></div></blockquote></div><br></div></div><br>______________________________<wbr>_________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a><br>
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank">https://mailman.science.ru.nl/<wbr>mailman/listinfo/fieldtrip</a><br></blockquote></div><br></div>