[FieldTrip] error in ft_prepare_headmodel

Tom Marshall tom.marshall at psy.ox.ac.uk
Wed Jan 10 19:42:29 CET 2018


Hi Arjen and JM,

Arjen - thanks for the golden tip!

As suggested, I explicitly added the SPM12 toolbox and called it in the cfg.

[status] = ft_hastoolbox('SPM12', 1, 0);

cfg                = [];
cfg.grid.warpmni   = 'yes';
cfg.grid.template  = template_grid;
cfg.grid.nonlinear = 'yes'; % use non-linear normalization
cfg.spmversion     = 'SPM12';
cfg.mri                = mri;
sourcemodel        = ft_prepare_sourcemodel(cfg);

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.

I fixed this by adding the following to ft_prepare_sourcemodel at line 633...

tmpcfg.spmversion = cfg.spmversion;

...and voila! A nice warped source model :)

Should I file this as a bug?

Best and thanks for the help,
Tom

________________________________
From: fieldtrip-bounces at science.ru.nl [fieldtrip-bounces at science.ru.nl] on behalf of Arjen Stolk [a.stolk8 at gmail.com]
Sent: 10 January 2018 16:16
To: FieldTrip discussion list
Subject: Re: [FieldTrip] error in ft_prepare_headmodel

Hi Tom,

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.

Best,
Arjen

On Jan 10, 2018, at 12:36 AM, Schoffelen, J.M. (Jan Mathijs) <jan.schoffelen at donders.ru.nl<mailto:jan.schoffelen at donders.ru.nl>> wrote:

Dear Tom,

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 http://bit.ly/2DeuNlX for more info.

Best wishes,
JM


On 9 Jan 2018, at 17:27, Tom Marshall <tom.marshall at psy.ox.ac.uk<mailto:tom.marshall at psy.ox.ac.uk>> wrote:

Howdy 'Trippers,

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').

After loading and segmenting the template brain I called ft_prepare_headmodel using the suggested parameters.

cfg          = [];
cfg.method   = 'singleshell';
template_headmodel = ft_prepare_headmodel(cfg, template_seg);

This gave the following error.

Error using ft_notification (line 314)
please specificy cfg.tissue and pass an appropriate segmented MRI as input data

Error in ft_error (line 39)
  ft_notification(varargin{:});

Error in ft_prepare_headmodel (line 354)
          ft_error('please specificy cfg.tissue and pass an appropriate segmented
          MRI as input data')

So I added cfg.tissue...

cfg          = [];
cfg.method   = 'singleshell';
cfg.tissue   = 'brain';
template_headmodel = ft_prepare_headmodel(cfg, template_seg);

...and this upset fieldtrip. After printing 'smoothing brain with a 5-voxel FWHM kernel', 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).

Missing symbol '_vm_allocate' required by
'/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'
Missing symbol '_vm_deallocate' required by
'/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'.

Error in spm_smooth>smooth1 (line 105)
spm_conv_vol(P,Q,x,y,z,-[i,j,k]);

Error in spm_smooth (line 40)
    smooth1(P,Q,s,dtype);

Error in volumesmooth (line 18)
spm_smooth(output, output, fwhm);

Error in ft_datatype_segmentation (line 229)
          brain = volumesmooth(brain,    smooth,    'brain');

Error in prepare_mesh_segmentation (line 95)
    mri = ft_datatype_segmentation(mri, 'segmentationstyle', 'probabilistic',
    'hasbrain', 'yes');

Error in ft_prepare_mesh (line 147)
    bnd = prepare_mesh_segmentation(cfg, mri);

Error in ft_prepare_headmodel (line 337)
        geometry = ft_prepare_mesh(tmpcfg, data);

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...

In case it's relevant: I'm running fieldtrip-20170726 in matlab R2017a on a mac.

And ideas?

Best,
Tom
_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl>
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip

_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl>
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20180110/0f1477ae/attachment.html>


More information about the fieldtrip mailing list