Back to the main page.

Bug 1948 - ft_datatype cannot detect several vol-structures as volumes

Status CLOSED FIXED
Reported 2013-01-23 15:05:00 +0100
Modified 2014-01-29 13:40:33 +0100
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P3 normal
Assigned to: Roemer van der Meij
URL:
Tags:
Depends on:
Blocks:
See also:

Roemer van der Meij - 2013-01-23 15:05:10 +0100

This is the case for, and possibly others: - singlespheres - singleshell - localspheres As found under /data/test/vol/*.*. Currently, the only check performed in ft_datatype to check if input is a volume is: isvolume = isfield(data, 'transform') && isfield(data, 'dim'); Which yields a false for the volumes above, and possibly others.


Roemer van der Meij - 2013-01-23 15:18:06 +0100

As an in between fix, ft_voltype (bug 1940) now checks whether the input explicitly is a grad or sens structure, and skips the first volumness-check. When ft_dataype is updated, an explicit check should be made for volumeminity of the input in ft_voltype (and the isgrad and iselec reference should be removed).


Roemer van der Meij - 2013-06-05 12:11:33 +0200

Setting as fixed


Roemer van der Meij - 2013-06-05 12:14:50 +0200

Closing time


Jan-Mathijs Schoffelen - 2013-06-05 13:36:46 +0200

1 there is an essential difference between a volume structure and a vol structure. the latter is the volume conduction model, which has a specific type that can be recovered with ft_voltype. The former is a 3D numeric matrix containing data defined in 3D space, always with a dim and transform field. 2 the original bug probably still is a bug. solution: adjust ft_transform_geometry to first check what type of data is in the input, and only call ft_voltype when the input is a vol-structure. this is related to bug 1940, reported by Vladimir. Also checkrotation was by majority vote considered to not be well-named.


Roemer van der Meij - 2013-06-05 17:26:01 +0200

I changed my changes to ft_voltype to be less confusing. The isgrad/issens check was appropriate there, but the documentation was confusing/confused. The original bug (bug 1940, error when rescaling a sens) was (indirectly) fixed by my previous changes. I think. The confusing bit is that in the doc of ft_transform_geometry it is stated that an electrode structure (e.g. 'sens') should not be rescaled. Yet, inside, only a check for ft_senstype(input,'meg') is done. So, which is it? Are electrode arrays allowed to be rescaled? Ft_transform_sens also says, only MEG should be rigid body, EEG is fine. If yes, than the original bug was fixed. If the answer to the above is yes, I propose to change the check in ft_transform_geometry to the following: ************ % flg rescaling check allowscaling = ~ft_senstype(input, 'meg'); ... if ~allowscaling if abs(det(rotation)-1)>100*eps % allow for some numerical imprecision error('only a rigid body transformation without rescaling is allowed'); end end if allowscaling % FIXME build in a check for uniform rescaling probably do svd or so % FIXME insert check for nonuniform scaling, should give an error end ************ Confusingly, the current code states ~strcmp(ft_voltype(input),'unknown')) ---> don't allow rescaling If I understand it correctly, volume conductor models should be rescalable (last sentence of documentation)...


Roemer van der Meij - 2013-09-24 13:37:49 +0200

JM approved, change commited.


Roemer van der Meij - 2014-01-29 13:40:33 +0100

Closing time http://www.youtube.com/watch?v=7-0lV5qs1Qw