Back to the main page.

Bug 1854 - spm fieldtrip integration fails

Status CLOSED FIXED
Reported 2012-11-27 09:57:00 +0100
Modified 2019-08-10 11:56:07 +0200
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Mac OS
Importance: P3 normal
Assigned to:
URL:
Tags:
Depends on:
Blocks:
See also:

Robert Oostenveld - 2012-11-27 09:57:54 +0100

there is a script test_spm_ft_integration.m which performs a bunch of tests to see whether the FT API as being used by SPM is still working. I detected that it failed on line 43 vol = ft_prepare_headmodel(cfg); due to Error using ft_headmodel_concentricspheres (line 65) a conductivity value should be specified for each compartment Error in ft_prepare_headmodel (line 231) vol = ft_headmodel_concentricspheres(geometry,'conductivity',cfg.conductivity,'fitind',cfg.fitind); Error in test_spm_ft_integration (line 43) vol = ft_prepare_headmodel(cfg); This pertains to a change in ft_headmodel_concentricspheres in which the default 4-shell conductivity was removed because of the potential mistakes of an inconsistency in the order of the conductivity and the geometries. See http://code.google.com/p/fieldtrip/source/list?path=/trunk/forward/ft_headmodel_concentricspheres.m&start=6864 Again looking at the code, I realize that further down (after fitting the spheres) the order is well-defined and that there a 3 and 4-shell conductivity default can be specified. So I changed it into if isempty(vol.c) % it being empty indicates that the user did not specify a conductivity, use a default instead if length(vol.r)==3 vol.c = [0.3300 0.0042 0.3300]; % brain, skull, skin elseif length(vol.r)==4 vol.c = [0.3300 1 0.0042 0.3300]; % brain, csf, skull, skin else error('conductivity values should be specified for each tissue type'); end else % the conductivity as specified by the user should be in the same order as the geometries % sort the spheres from the smallest to the largest ('insidefirst' order) vol.c = vol.c(indx); end This should restore old default functionality. The test_spm_ft_integration now runs further.


Robert Oostenveld - 2012-11-27 09:59:00 +0100

(In reply to comment #0) this is the fix mbp> svn commit ft_headmodel_concentricspheres.m Sending ft_headmodel_concentricspheres.m Transmitting file data . Committed revision 6994.


Robert Oostenveld - 2012-11-27 09:59:20 +0100

Although it runs further, it now stops at Error using set Value must be numeric Error in ft_plot_mesh (line 170) set(hs, 'FaceVertexCData', vertexcolor, 'FaceColor', 'interp'); Error in ft_headmodel_localspheres (line 134) ft_plot_mesh(geometry(shapesel,:), 'vertexcolor', 'g'); Error in ft_prepare_headmodel (line 247) vol = ft_headmodel_localspheres(geometry,cfg.grad,'feedback',cfg.feedback,'radius' Error in test_spm_ft_integration (line 108) vol = ft_prepare_headmodel(cfg);


Robert Oostenveld - 2012-11-27 10:12:31 +0100

(In reply to comment #2) that is due to 170 set(hs, 'FaceVertexCData', vertexcolor, 'FaceColor', 'interp'); where vertexcolor = g First I though this has to do with http://code.google.com/p/fieldtrip/source/detail?r=5673&path=/trunk/plotting/ft_plot_mesh.m But a closer inspection shows that the bug must also have happened before. It appears that in the calling code % find the headshape points that are close to this channel dist = sqrt(sum((geometry-repmat(thispnt,Nshape,1)).^2, 2)); shapesel = find(dist<radius); if feedback ft_plot_mesh(geometry(shapesel,:), 'vertexcolor', 'g'); drawnow end the number of selected points is precisely one. That is unusual, as multiple points would be expected here. It ain't a problem for the sphere fitting, but it triggers this bug.


Robert Oostenveld - 2012-11-27 10:13:16 +0100

(In reply to comment #3) it can simply be reproduced with >>ft_plot_mesh([1 2 3], 'vertexcolor', 'r') Error using set Value must be numeric Error in ft_plot_mesh (line 170) set(hs, 'FaceVertexCData', vertexcolor, 'FaceColor', 'interp'); This is supposed to work.


Robert Oostenveld - 2012-11-27 10:21:01 +0100

Created attachment 378 screenshot of figure it is supposed to allow for a figure like this


Robert Oostenveld - 2012-11-27 11:14:39 +0100

(In reply to comment #5) I fixed it by explicitly going through all possible specifications of the vertex colors. mbp> svn commit ft_plot_mesh.m Sending ft_plot_mesh.m Transmitting file data . Committed revision 6995.


Robert Oostenveld - 2012-11-27 11:17:45 +0100

the test_spm_ft_integration script now runs through.


Robert Oostenveld - 2019-08-10 11:52:12 +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 describing the issue on https://github.com/fieldtrip/fieldtrip/issues.


Robert Oostenveld - 2019-08-10 11:56:07 +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 describing the issue on https://github.com/fieldtrip/fieldtrip/issues.