Back to the main page.

Bug 1908 - ensure consistent units for the headmodel functions

Status ASSIGNED
Reported 2012-12-19 21:34:00 +0100
Modified 2013-01-23 13:07:34 +0100
Product: FieldTrip
Component: forward
Version: unspecified
Hardware: PC
Operating System: Mac OS
Importance: P4 normal
Assigned to: Robert Oostenveld
URL:
Tags:
Depends on:
Blocks:
See also:

Robert Oostenveld - 2012-12-19 21:34:02 +0100

The following change breaks three test scripts on the dashboard. http://code.google.com/p/fieldtrip/source/diff?spec=svn7233&r=7232&format=side&path=/trunk/forward/ft_headmodel_localspheres.m&old_path=/trunk/forward/ft_headmodel_localspheres.m&old=7123 because vol is still empty on line 65. I changed the unit handling in the code into -------- if isempty(unit) geometry = ft_convert_units(geometry); % ensure that the geometry has units unit = geometry.unit; % also use these units for the volume conductor else % convert the input geometry to the desired units geometry = ft_convert_units(geometry, unit); end % ensure that all defaults have the same user-defined units radius = ft_getopt(varargin, 'radius', scalingfactor('cm', unit) * 8.5); maxradius = ft_getopt(varargin, 'maxradius', scalingfactor('cm', unit) * 20); baseline = ft_getopt(varargin, 'baseline', scalingfactor('cm', unit) * 5);


Robert Oostenveld - 2012-12-19 21:35:35 +0100

This contains the fix: mbp> svn commit Sending forward/ft_headmodel_localspheres.m Transmitting file data . Committed revision 7234.


Robert Oostenveld - 2012-12-19 21:55:31 +0100

I made another change to make the three functions behave the same. With the previous commit there was a conversion of the input geometry, whereas with the other two there was (is) not. Now in all three there is no conversion. mbp> svn commit Sending forward/ft_headmodel_concentricspheres.m Sending forward/ft_headmodel_localspheres.m Sending forward/ft_headmodel_singlesphere.m Transmitting file data ... Committed revision 7235. We should together have a look at the unit handling in these functions, as I think it is still not perfect. E.g. if the input geometry has units, and the user specifies something else, the result is inconsistent. I don't know whether the input will or can always have units. Is it always a struct? I also notice that fns use units rather than unit. And that quite a few are not fully documented, e.g. ft_headmodel_localspheres does not have unit in the help. I suggest we sit down together and make the changes such that we both agree to the documentation and implementation. Not urgent, though.


Johanna - 2012-12-21 13:04:27 +0100

Thanks again for fixing the bug I introduced. Yes, I'm happy to meet to discuss further how unit should be handled and if a conflict exists of geometry.unit versus user-specified unit.


Robert Oostenveld - 2012-12-21 13:08:40 +0100

*** Bug 1912 has been marked as a duplicate of this bug. ***


Robert Oostenveld - 2012-12-22 23:41:35 +0100

the units were not copied from of the input geometry, nor estimated. This commit below fixes it, and also allows ft_convert_units to work on a struct array (needed for concentric spheres). roboos@mentat001> svn commit Sending forward/ft_convert_units.m Sending forward/ft_headmodel_concentricspheres.m Sending forward/ft_headmodel_localspheres.m Sending forward/ft_headmodel_singlesphere.m Transmitting file data .... Committed revision 7258.