<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" id="owaParaStyle">P {margin-top:0;margin-bottom:0;}</style>
</head>
<body dir="auto" fpstyle="1" ocsi="0">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">Hi Arjen and JM,<br>
<br>
Arjen - thanks for the golden tip! <br>
<br>
As suggested, I explicitly added the SPM12 toolbox and called it in the cfg.<br>
<br>
<i>[status] = ft_hastoolbox('SPM12', 1, 0);<br>
<br>
cfg                = [];<br>
cfg.grid.warpmni   = 'yes';<br>
cfg.grid.template  = template_grid;<br>
cfg.grid.nonlinear = 'yes'; % use non-linear normalization<br>
cfg.spmversion     = 'SPM12';<br>
cfg.mri                = mri;<br>
sourcemodel        = ft_prepare_sourcemodel(cfg);<br>
<br>
</i>However, this didn't totally solve the problem. At one point in ft_prepare_sourcemodel (line 636) ft_volumenormalise is called with a new cfg ('tmpcfg'). The choice to use SPM12 doesn't propagate to tmpcfg so fieldtrip adds SPM8 anyway when it calls ft_volumenormalise.<br>
<br>
I fixed this by adding the following to ft_prepare_sourcemodel at line 633...<br>
<br>
<i>tmpcfg.spmversion = cfg.spmversion;<br>
</i><br>
...and voila! A nice warped source model :)<br>
<br>
Should I file this as a bug?<br>
<br>
Best and thanks for the help,<br>
Tom<br>
<i></i><i></i><br>
<i></i>
<div style="font-family: Times New Roman; color: #000000; font-size: 16px">
<hr tabindex="-1">
<div id="divRpF497203" style="direction: ltr;"><font size="2" face="Tahoma" color="#000000"><b>From:</b> fieldtrip-bounces@science.ru.nl [fieldtrip-bounces@science.ru.nl] on behalf of Arjen Stolk [a.stolk8@gmail.com]<br>
<b>Sent:</b> 10 January 2018 16:16<br>
<b>To:</b> FieldTrip discussion list<br>
<b>Subject:</b> Re: [FieldTrip] error in ft_prepare_headmodel<br>
</font><br>
</div>
<div></div>
<div>
<div></div>
<div>Hi Tom, </div>
<div><br>
</div>
<div>As another work around, you could try using spm12 functionality. cfg.spmversion = ‘spm12’ if the function supports it, or by manually putting it on the path with ft_hastoolbox. There may be differences in the algorithm/outcome between versions, so you
 may want to be consistent in its use across subjects.</div>
<div><br>
</div>
<div>Best,</div>
<div>Arjen</div>
<div><br>
On Jan 10, 2018, at 12:36 AM, Schoffelen, J.M. (Jan Mathijs) <<a href="mailto:jan.schoffelen@donders.ru.nl" target="_blank">jan.schoffelen@donders.ru.nl</a>> wrote:<br>
<br>
</div>
<blockquote type="cite">
<div>Dear Tom,
<div class=""><br class="">
</div>
<div class="">To me, this looks like a platform/MATLAB version specific issue with the compiled mex-files. Anecdotally, MATLAB2017a on a Mac suffers from not knowing to handle the precompiled stuff that comes with FieldTrip/SPM. Either you could use a lower
 matlab version (e.g. 2016b, which as far as I know does not suffer from this), or you could try and recompile the affected mex-files from the original c-code with the matlab mex-command. See <a href="http://bit.ly/2DeuNlX" class="" target="_blank">http://bit.ly/2DeuNlX</a> for
 more info.</div>
<div class=""><br class="">
</div>
<div class="">Best wishes,</div>
<div class="">JM</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
<div>
<blockquote type="cite" class="">
<div class="">On 9 Jan 2018, at 17:27, Tom Marshall <<a href="mailto:tom.marshall@psy.ox.ac.uk" class="" target="_blank">tom.marshall@psy.ox.ac.uk</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div class="" style="font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; direction:ltr; font-family:Tahoma; font-size:10pt">
Howdy 'Trippers,<br class="">
<br class="">
I got a weird error when trying to create a template headmodel using ft_prepare_headmodel (basically just following the steps in the tutorial 'Creating a sourcemodel for source-reconstruction of MEG or EEG data').<br class="">
<br class="">
After loading and segmenting the template brain I called ft_prepare_headmodel using the suggested parameters.<br class="">
<br class="">
<i class="">cfg          = [];<br class="">
cfg.method   = 'singleshell';<br class="">
template_headmodel = ft_prepare_headmodel(cfg, template_seg);</i><br class="">
<br class="">
This gave the following error.<br class="">
<br class="">
<i class="">Error using ft_notification (line 314)<br class="">
please specificy cfg.tissue and pass an appropriate segmented MRI as input data<br class="">
<br class="">
Error in ft_error (line 39)<br class="">
  ft_notification(varargin{:});<br class="">
<br class="">
Error in ft_prepare_headmodel (line 354)<br class="">
          ft_error('please specificy cfg.tissue and pass an appropriate segmented<br class="">
          MRI as input data')</i><br class="">
<br class="">
So I added cfg.tissue...<br class="">
<br class="">
<i class="">cfg          = [];<br class="">
cfg.method   = 'singleshell';<br class="">
cfg.tissue   = 'brain';<br class="">
template_headmodel = ft_prepare_headmodel(cfg, template_seg);</i><br class="">
<br class="">
...and this upset fieldtrip. After printing<span class="Apple-converted-space"> </span><i class="">'smoothing brain with a 5-voxel FWHM kernel'</i>, it hung for 10-15 minutes, then threw an error with lots of 'Missing symbol' statements (see below - there are
 a few hundred more, I just copypasted the last two).<br class="">
<br class="">
<i class="">Missing symbol '_vm_allocate' required by<br class="">
'/usr/lib/closure/libclosured.dylib->/usr/lib/system/libdyld.dylib->/usr/lib/system/libsystem_platform.dylib->/usr/lib/system/libsystem_pthread.dylib->/usr/lib/system/libcache.dylib->/usr/lib/libgcc_s.1.dylib->/Users/marshall/Documents/MATLAB/fieldtrip-20170726/external/spm8/spm_conv_vol.mexmaci64'<br class="">
Missing symbol '_vm_deallocate' required by<br class="">
'/usr/lib/closure/libclosured.dylib->/usr/lib/system/libdyld.dylib->/usr/lib/system/libsystem_platform.dylib->/usr/lib/system/libsystem_pthread.dylib->/usr/lib/system/libcache.dylib->/usr/lib/libgcc_s.1.dylib->/Users/marshall/Documents/MATLAB/fieldtrip-20170726/external/spm8/spm_conv_vol.mexmaci64'.<br class="">
<br class="">
Error in spm_smooth>smooth1 (line 105)<br class="">
spm_conv_vol(P,Q,x,y,z,-[i,j,k]);<br class="">
<br class="">
Error in spm_smooth (line 40)<br class="">
    smooth1(P,Q,s,dtype);<br class="">
<br class="">
Error in volumesmooth (line 18)<br class="">
spm_smooth(output, output, fwhm);<br class="">
<br class="">
Error in ft_datatype_segmentation (line 229)<br class="">
          brain = volumesmooth(brain,    smooth,    'brain');<br class="">
<br class="">
Error in prepare_mesh_segmentation (line 95)<br class="">
    mri = ft_datatype_segmentation(mri, 'segmentationstyle', 'probabilistic',<br class="">
    'hasbrain', 'yes');<br class="">
<br class="">
Error in ft_prepare_mesh (line 147)<br class="">
    bnd = prepare_mesh_segmentation(cfg, mri);<br class="">
<br class="">
Error in ft_prepare_headmodel (line 337)<br class="">
        geometry = ft_prepare_mesh(tmpcfg, data);<br class="">
</i><br class="">
It seems like the problem is somewhere deep down in spm commands that fieldtrip is calling, so maybe nobody has a clue. I'm hoping somebody has seen this before and knows of a fix...<br class="">
<br class="">
In case it's relevant: I'm running fieldtrip-20170726 in matlab R2017a on a mac.<br class="">
<br class="">
And ideas?<br class="">
<br class="">
Best,<br class="">
Tom<br class="">
<i class=""></i></div>
<span class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; float:none; display:inline!important">_______________________________________________</span><br class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px">
<span class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; float:none; display:inline!important">fieldtrip
 mailing list</span><br class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px">
<a href="mailto:fieldtrip@donders.ru.nl" class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px" target="_blank">fieldtrip@donders.ru.nl</a><br class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px">
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px" target="_blank">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a></div>
</blockquote>
</div>
<br class="">
</div>
</div>
</blockquote>
<blockquote type="cite">
<div><span>_______________________________________________</span><br>
<span>fieldtrip mailing list</span><br>
<span><a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a></span><br>
<span><a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a></span></div>
</blockquote>
</div>
</div>
</div>
</body>
</html>