<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none"><!-- p { margin-top: 0px; margin-bottom: 0px; }--></style>
</head>
<body dir="ltr">
<div id="OWAFontStyleDivID" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<style type="text/css" style="">
<!--
p
        {margin-top:0px;
        margin-bottom:0px}
-->
</style>
<div id="OWAFontStyleDivID" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
<p style="">Hello fieldtrip,<br>
</p>
<p style=""><br>
</p>
<p style="">I just wanted to thank the following people for helping me with my beamformer issues:</p>
<p style=""> Eelke Spaak, Roey Schurr, Matt craddock, Julian Keil and of course Jorn Horschig.<br>
</p>
<p style=""><br>
</p>
<p style="">For the sake of helping other, I want to collate the help so that it is all in one place.<br>
</p>
<p style=""><br>
</p>
<p style="">--------------------------------------<br>
</p>
<p style="">With the help of Roey Schurr and Matt craddock I calculated the headmodel as follows:<br>
</p>
<div style=""></div>
<div style=""><br>
</div>
<div style="">% % load in template files<br>
</div>
<div>temp = load( fullfile( matlabrootpath, 'Matlab', 'fieldtrip', ...</div>
<div>    'template', 'headmodel', 'standard_mri.mat'));</div>
<div style="">mri = temp.mri; clear temp<br>
</div>
<div style=""><br>
</div>
<div style="">
<div>% segment MRI (return probabilistic tissue maps of gray/white/csf</div>
<div>% compartments</div>
<div>cfg = [];</div>
<div>cfg.write = 'no';</div>
<div>cfg.coordsys = 'spm';</div>
<div>cfg.output = { 'scalp', 'skull', 'brain'};</div>
<div>segmentedmri = ft_volumesegment(cfg, mri);</div>
<div><br>
</div>
<div>cfg = [];</div>
<div>cfg.method = 'iso2mesh';</div>
<div>cfg.numvertices = 10000;</div>
<div>bnd = ft_prepare_mesh( cfg, segmentedmri);</div>
<div><br>
</div>
<div>% fix mesh</div>
<div>[ bnd( 1).pnt, bnd( 1).tri] = meshresample( bnd( 1).pnt, bnd( 1).tri, 1000/size( bnd( 1).pnt, 1));</div>
<div>[ bnd( 2).pnt, bnd( 2).tri] = meshresample( bnd( 2).pnt, bnd( 2).tri, 2000/size( bnd( 2).pnt, 1));</div>
<div>[ bnd( 3).pnt, bnd( 3).tri] = meshresample( bnd( 3).pnt, bnd( 3).tri, 3000/size( bnd( 3).pnt, 1));</div>
<div>for ii = 1:size( bnd),</div>
<div>    [ bnd( ii).pnt, bnd( ii).tri] = meshcheckrepair( bnd( ii).pnt, bnd( ii).tri, 'dup');</div>
<div>    [ bnd( ii).pnt, bnd( ii).tri] = meshcheckrepair( bnd( ii).pnt, bnd( ii).tri, 'isolated');</div>
<div>    [ bnd( ii).pnt, bnd( ii).tri] = meshcheckrepair( bnd( ii).pnt, bnd( ii).tri, 'deep');</div>
<div>    [ bnd( ii).pnt, bnd( ii).tri] = meshcheckrepair( bnd( ii).pnt, bnd( ii).tri, 'meshfix');</div>
<div>end</div>
<div><br>
</div>
<div>% calculate headmodel % reordered to brain skull scalp</div>
<div>cfg = [];</div>
<div style="">cfg.method = 'bemcp'; <br>
</div>
<div style="">vol = ft_prepare_headmodel(cfg, bnd);<br>
</div>
<div style="">clear bnd<br>
</div>
<div style=""><br>
</div>
<div style=""><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">-------------------------------</span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">-</span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">------</span><br>
</div>
<br>
</div>
<p style="">The electrode positions were fixed from literally taking the electrode positions from the template, at first I interpreted Matt's suggestions as using a function to do it. It is very clear that just copying the positions are the way to go.<br>
</p>
<p style=""><br>
</p>
<div>% Get electrode positions from template</div>
<div>temp_electrodes = ft_read_sens( fullfile( matlabrootpath, 'Matlab', 'fieldtrip', ...</div>
<div>    'template', 'electrode', 'standard_1005.elc'));</div>
<div>match = ismember( temp_electrodes.label, data.elec.label);</div>
<div>temp_pos = temp_electrodes.chanpos( match, :);</div>
<div>data.elec.label = temp_electrodes.label( match);</div>
<div>data.elec.chanpos = temp_pos;</div>
<div>data.elec.elecpos = data.elec.chanpos;</div>
<div><br>
</div>
<div>% add LPA RPA and Nasian labels</div>
<div>data.elec.label{ end+1} = temp_electrodes.label{ 1};</div>
<div>data.elec.label{ end+1} = temp_electrodes.label{ 2};</div>
<div>data.elec.label{ end+1} = temp_electrodes.label{ 3};</div>
<div><br>
</div>
<div>% add LPA RPA and Nasian positions</div>
<div>data.elec.chanpos( end+1, :) = temp_electrodes.chanpos( 1, :);</div>
<div>data.elec.chanpos( end+1, :) = temp_electrodes.chanpos( 2, :);</div>
<div>data.elec.chanpos( end+1, :) = temp_electrodes.chanpos( 3, :);</div>
<div style="">data.elec.elecpos = data.elec.chanpos;<br>
</div>
<p style=""><br>
</p>
<div>
<p style=""><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">-------------------------------</span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">-</span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">------</span>
</p>
<p style=""><br>
</p>
<p style="">Then finally the sourcemodel can be calculated:<br>
</p>
<p style=""><br>
</p>
<div>% calculate sourcemodel</div>
<div>cfg = [];</div>
<div>cfg.mri = mri;</div>
<div>cfg.vol = vol;</div>
<div>cfg.grid.warpmni = 'yes';</div>
<div>cfg.grid.template = template.sourcemodel;</div>
<div>cfg.grid.nonlinear = 'yes';</div>
<div>cfg.moveinward = 1; % actually uses vol mesh</div>
<div>cfg.inwardshift = 0; % needs to be expressed to work with moveinward</div>
<div style=""><span style="font-size: 12pt;">cfg.elec = timelock.elec;</span><br>
</div>
<div style="">sourcemodel = ft_prepare_sourcemodel( cfg);<br>
</div>
<p style=""><br>
</p>
<p style=""><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">-------------------------------</span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">-</span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">------</span><br>
</p>
<p style=""><br>
</p>
<p style="">Thank you to everyone that has helped me. I gladly appreciate it.<br>
</p>
<p style="">Im really sorry for all the emails as well.<br>
</p>
<p style=""><br>
</p>
<p style="">There will be another coming because the beamformer technique works for 2 datasets (out of four) and I cant work out why it isnt working for two datasets.<br>
</p>
<p style=""><br>
</p>
<p style="">Kind regards,<br>
</p>
<p style=""><br>
</p>
<p style="">Tyler<br>
</p>
<p><br>
</p>
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-size:13px">*************************
<div style="font-family:Tahoma"><br>
</div>
<div><font face="Arial"><i>Tyler Grummett ( BBSc, BSc(Hons I))</i></font></div>
<div><font face="Arial"><i>PhD Candidate</i></font></div>
<div><font face="Arial"><i>Brain Signals Laboratory</i></font></div>
<div><font face="Arial"><i>Flinders University</i></font></div>
<div><font face="Arial"><i>Rm 5A301</i></font></div>
<div><font face="Arial"><i>Ext 66124</i></font></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>