<div dir="ltr">Dear Francois,<div><br></div><div><div>this is really good news, thanks!</div><div><br></div><div>I have tested the Process > Sources > Fieldtrip: ft_prepare_leadfield on different MEG data (always recorded from an Elekta 306 sensors system), and I get an error "cannot work on balanced gradiometer definition" (see the warnings below). I have tried to debug this but I am a bit lost since I am not very familiar with manipulating source data.</div><div><br></div><div>I also have a basic question on the data to put in the process: my understanding is that I should feed the process with the segmented anatomy, that I identify with (for the default anatomy) the "Cortex_15002V" in the anatomy tab. However, I cannot drag it to the Process window (I understand that the sensor configuration is also needed). I therefore drag in the Process window any data associated with the subject. Is this correct? Does the program then automatically process the segmented anatomy?</div><div><br></div><div>Can you please shed light on this, or advice me on how to debug it?</div><div><br></div><div>Thanks a lot,</div><div><br></div><div>Marco </div><div><br></div><div><br></div><div><div>BST> FieldTrip install: C:\Users\marco.buiatti\Documents\software\fieldtrip-20161107</div><div>the input is volume data with dimensions [181 217 181]</div><div>Converting the coordinate system from ctf to spm</div><div>Rescaling NIFTI: slope = 0.00342945, intercept = 0</div><div>Smoothing by 0 & 8mm..</div><div>Coarse Affine Registration..</div><div>Fine Affine Registration..</div><div>performing the segmentation on the specified volume</div><div>creating brainmask</div><div>smoothing brainmask with a 5-voxel FWHM kernel</div><div>thresholding brainmask at a relative threshold of 0.500</div><div>the call to "ft_volumesegment" took 52 seconds</div><div>Warning: assuming that planar MEG channel units are T/m </div><div>> In ft_chanunit at 173</div><div>  In ft_datatype_sens at 392</div><div>  In ft_datatype_sens at 158</div><div>  In ft_checkconfig at 232</div><div>  In utilities\private\ft_preamble_trackconfig at 37</div><div>  In ft_preamble at 56</div><div>  In ft_prepare_headmodel at 148</div><div>  In process_ft_prepare_leadfield>Run at 249</div><div>  In process_ft_prepare_leadfield at 24</div><div>  In bst_process>Run at 229</div><div>  In bst_process at 36</div><div>  In panel_process1>RunProcess at 141</div><div>  In panel_process1 at 27</div><div>  In gui_brainstorm>CreateWindow/ProcessRun_Callback at 707</div><div>  In bst_call at 28</div><div>  In gui_brainstorm>@(h,ev)bst_call(@ProcessRun_Callback) at 261 </div><div>Warning: please specify cfg.method='projectmesh', 'iso2mesh' or 'isosurface' </div><div>> In ft_prepare_mesh at 137</div><div>  In ft_prepare_headmodel at 348</div><div>  In process_ft_prepare_leadfield>Run at 249</div><div>  In process_ft_prepare_leadfield at 24</div><div>  In bst_process>Run at 229</div><div>  In bst_process at 36</div><div>  In panel_process1>RunProcess at 141</div><div>  In panel_process1 at 27</div><div>  In gui_brainstorm>CreateWindow/ProcessRun_Callback at 707</div><div>  In bst_call at 28</div><div>  In gui_brainstorm>@(h,ev)bst_call(@ProcessRun_Callback) at 261 </div><div>Warning: using 'projectmesh' as default </div><div>> In ft_prepare_mesh at 138</div><div>  In ft_prepare_headmodel at 348</div><div>  In process_ft_prepare_leadfield>Run at 249</div><div>  In process_ft_prepare_leadfield at 24</div><div>  In bst_process>Run at 229</div><div>  In bst_process at 36</div><div>  In panel_process1>RunProcess at 141</div><div>  In panel_process1 at 27</div><div>  In gui_brainstorm>CreateWindow/ProcessRun_Callback at 707</div><div>  In bst_call at 28</div><div>  In gui_brainstorm>@(h,ev)bst_call(@ProcessRun_Callback) at 261 </div><div>triangulating the outer boundary of compartment 1 (brain) with 3000 vertices</div><div>the call to "ft_prepare_mesh" took 1 seconds</div><div>the call to "ft_prepare_headmodel" took 1 seconds</div><div><br></div><div>***************************************************************************</div><div>** Error: [process_ft_prepare_leadfield]  Sources > FieldTrip: ft_prepare_leadfield</div><div>** Line 228:  ft_plot_sens (line 228)</div><div>** cannot work with balanced gradiometer definition</div><div>** </div><div>** Call stack:</div><div>** >ft_plot_sens.m at 228</div><div>** >process_ft_prepare_leadfield.m>Run at 255</div><div>** >process_ft_prepare_leadfield.m at 24</div><div>** >bst_process.m>Run at 229</div><div>** >bst_process.m at 36</div><div>** >panel_process1.m>RunProcess at 141</div><div>** >panel_process1.m at 27</div><div>** >gui_brainstorm.m>CreateWindow/ProcessRun_Callback at 707</div><div>** >bst_call.m at 28</div><div>** >gui_brainstorm.m>@(h,ev)bst_call(@ProcessRun_Callback) at 261</div><div>** </div><div>** </div><div>** File: 150505/@raw19900812VTTN_01run4/data_0raw_19900812VTTN_01run4.mat</div><div>** </div><div>***************************************************************************</div></div><div><br></div><div><br></div><div><img src="cid:ii_1584dd661ac3d160" alt="Inline images 2" width="503" height="499"><br></div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 5 November 2016 at 15:33, Francois Jean Tadel, Mr <span dir="ltr"><<a href="mailto:francois.tadel@mcgill.ca" target="_blank">francois.tadel@mcgill.ca</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">
<div id="m_-1193317570601204861divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Jeff, Marco:</p>
<p><br>
</p>
<p>Good timing, I've been working on similar topics this week. I added processes in Brainstorm to use the forward models in FieldTrip, using ft_volumesegment, ft_prepare_headmodel and ft_prepare_leadfield. For now it is not possible to use the Brainstorm BEM
 surfaces to compute the leadfield with FieldTrip, but if you think this is useful, we could probably add this.</p>
<p><br>
</p>
<p>Before the end of the month, I hope to have all the inverse models available as well. We will have the possibility to call them either with Brainstorm or FieldTrip forward solutions.</p>
<p><br>
</p>
I you want to help me with the debugging, or if you want to start working on the inverse/DICS part next week, it's all on github:<br>
<a href="https://github.com/brainstorm-tools/brainstorm3/blob/master/toolbox/process/functions/process_ft_volumesegment.m" class="m_-1193317570601204861OWAAutoLink" id="m_-1193317570601204861LPlnk34634" target="_blank">https://github.com/brainstorm-<wbr>tools/brainstorm3/blob/master/<wbr>toolbox/process/functions/<wbr>process_ft_volumesegment.m</a><br>
<a href="https://github.com/brainstorm-tools/brainstorm3/blob/master/toolbox/process/functions/process_ft_prepare_leadfield.m" class="m_-1193317570601204861OWAAutoLink" id="m_-1193317570601204861LPlnk581091" target="_blank">https://github.com/brainstorm-<wbr>tools/brainstorm3/blob/master/<wbr>toolbox/process/functions/<wbr>process_ft_prepare_leadfield.m</a><br>
<br>
You could create a new process to call the FieldTrip function you want, there are already many other examples of wrappers available:<br>
<span>process_ft_channelrepair.m</span><br>
<span><span>process_ft_dipolefitting.m</span><br>
<span>process_ft_<wbr>scalpcurrentdensity.m</span><br>
<span>process_ft_timelockstatistics.<wbr>m</span><br>
<span>process_ft_sourcestatistics.m</span><br>
<span>process_ft_freqstatistics.m</span><br>
<br>
If you need help with the plugin API in Brainstorm:<br>
<a href="http://neuroimage.usc.edu/brainstorm/Tutorials/TutUserProcess" class="m_-1193317570601204861OWAAutoLink" id="m_-1193317570601204861LPlnk582807" target="_blank">http://neuroimage.usc.edu/<wbr>brainstorm/Tutorials/<wbr>TutUserProcess</a><br>
</span><br>
Functions to convert Brainstorm files into FieldTrip structures:<br>
brainstorm3/toolbox/io/out_<wbr>fieldtrip_*.m<br>
<br>
<span>Cheers,<br>
Francois<br>
</span><br>
<br>
<div style="color:rgb(0,0,0)">
<div class="m_-1193317570601204861PlainText">
<hr style="display:inline-block;width:98%">
<br>
Hi Marco,<br>
<br>
Sorry to say I was not successful, yet. I have shifted to other tasks at this point. I am using 256 channel EEG, and want to use the FreeSurfer cortical ribbon as my source model (I would prefer source/headmodels to be FEM as well). I found that a lot of FieldTrip
 is based on regular dipole grids, and also it is more oriented to MEG than EEG. I do  not have the time right now to try to put all the pieces together in FieldTrip to do what I want, but might get back to it in a month or two.<br>
<br>
Sorry I could not be of more help to you right now.<br>
<br>
-Jeff<br>
<br>
<br>
<br>
From: Marco Buiatti [<a href="mailto:marco.buiatti@gmail.com" target="_blank">mailto:marco.buiatti@gmail.<wbr>com</a>]<br>
Sent: Friday, November 04, 2016 3:08 AM<br>
To: FieldTrip discussion list; K Jeffrey Eriksen<br>
Subject: Re: [FieldTrip] importing Brainstorm head and source models and leftfields<br>
<br>
Dear all,<br>
<br>
I have Jeff's same question. I have anatomies ready in Brainstorm: segmented data imported, co-registration with MEG sensor space, computation of head model with overlapping spheres. Now I would like to import all this into Fieldtrip for source reconstruction
 of oscillatory sources (DICS).<br>
What's the best way to do this?<br>
<br>
And is there any difference between Brainstorm and Fieldtrip in these steps that I should be aware of?<br>
<br>
Jeff, did you manage to solve the problem?<br>
<br>
Thanks a lot,<br>
<br>
Marco<br>
<br>
</div>
<font size="2"><span style="font-size:10pt"></span></font></div>
</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><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Marco Buiatti<br><br><span style="font-size:small">Neonatal Neurocognition Lab</span><br><span style="font-size:small">Center for Mind/Brain Sciences</span><br style="font-size:small"><span style="font-size:small">University of Trento,</span></div><div>Piazza della Manifattura 1,<span style="font-size:12.8px"> 38068 Rovereto (TN), Italy</span></div><div>E-mail: <a href="mailto:marco.buiatti@unitn.it" target="_blank">marco.buiatti@unitn.it</a></div><div><span style="font-size:12.8000001907349px">Phone: </span>+39 0464-808178</div><div><a href="https://sites.google.com/a/unitn.it/marcobuiatti/" target="_blank">https://sites.google.com/a/unitn.it/marcobuiatti/</a></div><div><br>***********************************************</div></div></div></div></div></div></div></div></div></div>
</div>