Back to the main page.

Bug 982 - headsurface and head_surf seem to have largely overlapping functionality

Status CLOSED FIXED
Reported 2011-09-22 14:14:00 +0200
Modified 2012-02-03 22:01:16 +0100
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Mac OS
Importance: P1 normal
Assigned to: Eelke Spaak
URL:
Tags:
Depends on:
Blocks:
See also:

Jan-Mathijs Schoffelen - 2011-09-22 14:14:56 +0200

look if they can be merged together


Jan-Mathijs Schoffelen - 2011-10-05 09:39:48 +0200

plan: -investigate where they are used -investigate the functionality of both functions -merge into 1 function if possible


Eelke Spaak - 2011-11-23 09:47:40 +0100

I examined the two functions; headsurface seems to be the more general one. Furthermore, it seems that head_surf is actually never really used. Where is headsurface used? bash-3.2$ grep headsurface **/*.m compat/ft_headmodelplot.m:% cfg.plotheadsurface = 'yes' or 'no', is constructed from head model compat/ft_headmodelplot.m:if ~isfield(cfg, 'plotheadsurface'), cfg.plotheadsurface = 'yes'; end compat/ft_headmodelplot.m: if strcmp(cfg.plotheadsurface, 'yes') && ~isempty(vol) compat/ft_headmodelplot.m: [pnt, tri] = headsurface(vol, sens); compat/ft_headmodelplot.m: end % plotheadsurface compat/ft_headmodelplot.m: if strcmp(cfg.plotheadsurface, 'yes') && ~isempty(vol) compat/ft_headmodelplot.m: [pnt, tri] = headsurface(vol, sens); compat/ft_headmodelplot.m: end % plotheadsurface private/headsurface.m:function [pnt, tri] = headsurface(vol, sens, varargin); private/headsurface.m:% [pnt, tri] = headsurface(vol, sens, ...) private/headsurface.m:% $Id: headsurface.m 4510 2011-10-18 18:53:15Z roboos $ Where is head_surf used? bash-3.2$ grep head_surf **/*.m private/head_surf.m:function [pnt,tri]=head_surf(vol,grad,flag); private/head_surf.m:% [pnt, tri] = head_surf(vol, grad, flag) private/head_surf.m:% $Id: head_surf.m 4510 2011-10-18 18:53:15Z roboos $ private/prepare_brain_surface.m: [pnt, tri] = head_surf(vol, grad, 0); Hmm, so basically only in prepare_brain_surface. Where is that one used, then? bash-3.2$ grep prepare_brain_surface **/*.m private/prepare_brain_surface.m:function [pnt] = prepare_brain_surface(cfg, grad, vol); private/prepare_brain_surface.m:% $Id: prepare_brain_surface.m 952 2010-04-21 18:29:51Z roboos $ Nowhere... Proposed action: delete prepare_brain_surface.m and head_surf.m. Before I destroy anything, I thought it wise to consult :)


Johanna - 2011-11-23 10:02:29 +0100

I haven't used either (but might soon!) but just wondering: where is headsurface used? The ft_headmodelplot is in 'compat' which I thought meant 'deprecated'. Even if not, it's still only a plotting tool, not a higher function calling it. Is there not any (higher) function that calls headsurface in order to generate the actual head surface?


Eelke Spaak - 2011-11-23 10:04:09 +0100

Good point Johanna, indeed it's only used in compat/ft_headmodelplot. I guess we should discuss this today at the meeting.


Jörn M. Horschig - 2011-11-23 12:55:47 +0100

Heya, I found the same uselessness of head_surf and prepare_brain_surface in bug 1132 Since the big bosses do not respond, maybe we should just delete and see whether someone notices? That's how my mother is doing it with unnecessary stuff from my dad, which he wants to keep for no reason. She just throws it away without asking, and he never noticed so far


Eelke Spaak - 2011-11-23 16:18:52 +0100

bash-3.2$ svn commit Deleting private/head_surf.m Deleting private/prepare_brain_surface.m Committed revision 4808.


Eelke Spaak - 2011-11-23 16:20:40 +0100

Oh yes, for future reference; I made a grep syntax error in my comment above. It turns out headsurface *is* used in functions other than ft_headmodelplot: bash-3.2$ grep headsurface *.m **/*.m ft_headmodelplot.m:% cfg.plotheadsurface = 'yes' or 'no', is constructed from head model ft_headmodelplot.m:if ~isfield(cfg, 'plotheadsurface'), cfg.plotheadsurface = 'yes'; end ft_headmodelplot.m: if strcmp(cfg.plotheadsurface, 'yes') && ~isempty(vol) ft_headmodelplot.m: [pnt, tri] = headsurface(vol, sens); ft_headmodelplot.m: end % plotheadsurface ft_headmodelplot.m: if strcmp(cfg.plotheadsurface, 'yes') && ~isempty(vol) ft_headmodelplot.m: [pnt, tri] = headsurface(vol, sens); ft_headmodelplot.m: end % plotheadsurface ft_megplanar.m: pos = headsurface(vol, axial.grad, 'surface', 'cortex', 'inwardshift', cfg.inwardshift, 'npnt', cfg.spheremesh); ft_megplanar.m: pos = headsurface([], [], 'headshape', headshape, 'inwardshift', cfg.inwardshift, 'npnt', cfg.spheremesh); ft_megrealign.m:% sometimes some of the dipole positions are nan, due to problems with the headsurface triangulation ft_prepare_sourcemodel.m: grid.pos = headsurface([], [], 'headshape', headshape, 'inwardshift', cfg.inwardshift, 'npnt', cfg.spheremesh); ft_prepare_sourcemodel.m: grid.pos = headsurface(vol, sens, 'inwardshift', cfg.inwardshift, 'npnt', cfg.spheremesh); ft_prepare_sourcemodel.m: [pnt, tri] = headsurface(vol, sens, 'headshape', cfg.headshape, 'inwardshift', cfg.inwardshift, 'surface', 'skin'); ft_prepare_sourcemodel.m: [pnt, tri] = headsurface(vol, sens, 'inwardshift', cfg.inwardshift, 'surface', 'skin'); ft_prepare_sourcemodel.m: [pnt, tri] = headsurface(vol, sens, 'inwardshift', cfg.inwardshift, 'surface', 'brain'); compat/ft_headmodelplot.m:% cfg.plotheadsurface = 'yes' or 'no', is constructed from head model compat/ft_headmodelplot.m:if ~isfield(cfg, 'plotheadsurface'), cfg.plotheadsurface = 'yes'; end compat/ft_headmodelplot.m: if strcmp(cfg.plotheadsurface, 'yes') && ~isempty(vol) compat/ft_headmodelplot.m: [pnt, tri] = headsurface(vol, sens); compat/ft_headmodelplot.m: end % plotheadsurface compat/ft_headmodelplot.m: if strcmp(cfg.plotheadsurface, 'yes') && ~isempty(vol) compat/ft_headmodelplot.m: [pnt, tri] = headsurface(vol, sens); compat/ft_headmodelplot.m: end % plotheadsurface private/headsurface.m:function [pnt, tri] = headsurface(vol, sens, varargin); private/headsurface.m:% [pnt, tri] = headsurface(vol, sens, ...) private/headsurface.m:% $Id: headsurface.m 4510 2011-10-18 18:53:15Z roboos $


Robert Oostenveld - 2011-11-29 10:28:47 +0100

(In reply to comment #5) Hey wife, where did my favorite T-shirt go? ... Yes, the one that is a bit worn down. ... No, even with the holes in it I can still wear it. ... What, you threw it away?!?!


Boris Reuderink - 2012-02-03 22:01:16 +0100

Since the shirts are gone now anyways, I think I can close this issue ;-).