Back to the main page.
Bug 3405 - Unable to execute ft_prepare_headmodel due to MEX bug "Library not loaded"
Status |
CLOSED FIXED |
Reported |
2018-01-29 02:46:00 +0100 |
Modified |
2019-08-10 12:37:02 +0200 |
Product: |
FieldTrip |
Component: |
external |
Version: |
unspecified |
Hardware: |
Macintosh |
Operating System: |
Mac OS |
Importance: |
P3 blocker |
Assigned to: |
Robert Oostenveld |
URL: |
|
Tags: |
|
Depends on: |
|
Blocks: |
|
See also: |
|
Josh Diamond - 2018-01-29 02:46:30 +0100
I am attempting to replicate the steps given in:
http://www.fieldtriptoolbox.org/tutorial/headmodel_meg
My code is:
mri = ft_read_mri('
/mr_pre.nii');
mri.coordsys='ras';
cfg = [];
cfg.output = 'brain';
segmentedmri = ft_volumesegment(cfg, mri);
cfg = [];
cfg.method='singleshell';
vol = ft_prepare_headmodel(cfg, segmentedmri);
The error is:
Error using ft_notification (line 340)
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')
If I instead execute:
mri = ft_read_mri('/mr_pre.nii');
mri.coordsys='ras';
cfg = [];
cfg.output = 'brain';
segmentedmri = ft_volumesegment(cfg, mri);
cfg = [];
cfg.method='singleshell';
cfg.tissue='brain';
vol = ft_prepare_headmodel(cfg, segmentedmri);
The error is:
Invalid MEX-file '/Users/diamondjm/Documents/MATLAB/Utilities/fieldtrip-20180123/external/spm8/spm_bwlabel.mexmaci64':
dlopen(/Users/diamondjm/Documents/MATLAB/Utilities/fieldtrip-20180123/external/spm8/spm_bwlabel.mexmaci64, 6): Library not loaded: @loader_path/libmex.dylib
Referenced from: /Users/diamondjm/Documents/MATLAB/Utilities/fieldtrip-20180123/external/spm8/spm_bwlabel.mexmaci64
Reason: image not found.
Error in volumethreshold (line 34)
[cluster, n] = spm_bwlabel(output, 6);
Error in prepare_mesh_segmentation (line 143)
seg = volumethreshold(seg, 0.5, tissue);
Error in ft_prepare_mesh (line 149)
bnd = prepare_mesh_segmentation(cfg, mri);
Error in ft_prepare_headmodel (line 337)
geometry = ft_prepare_mesh(tmpcfg, data);
The code works when I use the sample subject01 MRI instead.
</p>
Josh Diamond - 2018-01-29 02:51:43 +0100
Actually, as a follow up, I was mistaken. it does NOT work with the sample MRI. I get the same error.
Robert Oostenveld - 2018-01-29 13:21:58 +0100
Hi Josh,
This is due to a mex error with an external mex file, not with something from fieldtrip itself. Please download the latest copy of spmXX that you want to use and put that on your path prior to adding fieldtrip on your path.
You may want to search here on bugzilla for similar reports and possibly helpful comments. The error is likely due to an incompatibility between the (~8 year old) spm version, your matlab version and your operating system.
best
Robert
Robert Oostenveld - 2019-08-10 12:37:02 +0200
This closes a whole series of bugs that have been resolved (either FIXED/WONTFIX/INVALID) for quite some time.
If you disagree, please file a new issue on https://github.com/fieldtrip/fieldtrip/issues.