Back to the main page.

Bug 1932 - prepare_mesh_headshape may create NaN pnt values

Reported 2013-01-16 16:10:00 +0100
Modified 2013-06-06 15:11:49 +0200
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P3 normal
Assigned to: Johanna
Depends on:
See also:

Johanna - 2013-01-16 16:10:53 +0100

Created attachment 406 test_fairsurface.m I ran into this problem by calling ft_prepare_mesh with a headshape of 21285 .pnt but no .tri and with a cfg.numvertices 3000. See attached script test_fairsurface.m. On line 241 of prepare_mesh_headshape (which is actually a line within the subfunction fairsurface), the difference between desired and existing points is computed, which if 0, then the weighting param w_i is NaN and the new points created into XYZmm_o are NaN rather than adjusted.

Johanna - 2013-01-17 10:18:06 +0100

suggested change: if sum(d_i)==0 w_i = zeros(size(d_i)); else w_i = d_i/sum(d_i); end both for line 241 and 249 of prepare_mesh_headshape.m. Is this ok with the intended output? I tried finding the original file on which fairsurface was based in SPM8, to see if that file had any updates, but coudln't find it.

Johanna - 2013-01-23 14:26:29 +0100

enacted suggested change in previous comment, svn 7381.