Back to the main page.

Bug 1432 - ft_prepare_singleshell and ft_prepare_headmodel give different results

Status CLOSED FIXED
Reported 2012-04-17 13:55:00 +0200
Modified 2012-06-12 12:59:45 +0200
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P3 normal
Assigned to: Cristiano Micheli
URL:
Tags:
Depends on:
Blocks:
See also:

Eelke Spaak - 2012-04-17 13:55:27 +0200

Whereas the test script test_ft_prepare_singleshell prescribes they should produce identical results. This part of the test script runs fine (note that I added (and committed) the rmfield() calls to remove the cfg): % with an MRI in the input cfg = []; cfg.method = 'singleshell'; vol1 = ft_prepare_headmodel(cfg, mri); cfg = []; vol1b = ft_prepare_singleshell(cfg, mri); % the following needs to be done to be able to make the comparison vol1 = rmfield(vol1, 'cfg'); vol1b = rmfield(vol1b,'cfg'); success = success && isequal(vol1, vol1b); if ~success error('ft_prepare_singleshell and ft_prepare_headmodel gave different outputs'); end But this then fails (vol2 and vol2b are not equal): % with a filename in the input cfg = []; cfg.method = 'singleshell'; cfg.hdmfile = hdmfile; vol2 = ft_prepare_headmodel(cfg); cfg = []; cfg.headshape = hdmfile; vol2b = ft_prepare_singleshell(cfg); % the following needs to be done to be able to make the comparison vol2 = rmfield(vol2, 'cfg'); vol2b = rmfield(vol2b,'cfg'); success = success && isequal(vol2, vol2b); if ~success error('ft_prepare_singleshell and ft_prepare_headmodel gave different outputs'); end See: >> vol2 vol2 = bnd: [1x1 struct] type: 'nolte' unit: 'cm' >> vol2b vol2b = bnd: [1x1 struct] type: 'nolte' unit: 'cm' So far so good, but: >> vol2.bnd ans = pnt: [21285x3 double] fid: [1x1 struct] unit: 'cm' >> vol2b.bnd ans = pnt: [21285x3 double] tri: [42566x3 double] And I don't know what the desired/best behaviour is, or if both are equally good. I checked out ft_datatype_headmodel for clues, but could not find any.


Cristiano Micheli - 2012-05-02 16:03:47 +0200

(In reply to comment #0) The problem was given by ft_prepare_mesh, not allowing input strings as filenames containing the boundaries to be read correctly. This is changed here: 1003 $ svn commit ft_prepare_mesh.m Sending ft_prepare_mesh.m Transmitting file data . Committed revision 5726. and here: 1006 $ svn commit ft_prepare_mesh.m ./forward/ft_fetch_headshape.m Sending forward/ft_fetch_headshape.m Sending ft_prepare_mesh.m Transmitting file data .. Committed revision 5727. Accordingly the test file works correctly. Most of the errors occurred because of a recently introduced function (ft_fetch_headshape) that handles the boundary inputs efficiently. The absence of this function in ft_prepare_singleshell.m caused the problems since the management of the boundary input was still done explicitly inside the function (and not efficiently). Actually, ft_prepare_singleshell should be deprecated at some pointbecause ft_prepare_heamodel takes over its functionality. Best, Cristiano