Back to the main page.

Bug 1788 - ft_electroderealign doesn't work with option cfg.elec

Status CLOSED FIXED
Reported 2012-10-23 16:31:00 +0200
Modified 2019-08-10 11:56:36 +0200
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Linux
Importance: P3 normal
Assigned to:
URL:
Tags:
Depends on:
Blocks:
See also:

Lilla Magyari - 2012-10-23 16:31:53 +0200

Created attachment 351 vol When I do elec = ft_read_sens('/home/common/matlab/fieldtrip/template/electrode/standard_1020.elc'); and cfg=[]; cfg.method='interactive'; cfg.headshape = vol.bnd(1); % find vol attached cfg.elec=elec; % this option allowed in the help elec=ft_electroderealign(cfg); The figure doesn't show any electrodes. This is because in the script of ft_electroderealign I can find the following in line 138-151 : if nargin==1 try % try to get the description from the cfg elec = ft_fetch_sens(cfg); catch lasterr % start with an empty set of electrodes, this is useful for manual positioning elec = []; elec.pnt = zeros(0,3); elec.label = cell(0,1); elec.unit = 'mm'; warning(lasterr.message, lasterr.identifier); end elseif nargin>1 % the input electrodes were specified as second input argument end This part returns an empty electrode structure, because ft_fetch_sens doesn't exist. Moreover, it is also not possible put elec as a second argument after the cfg: elec=ft_electroderealign(cfg,elec) because ft_eletroderealign accepts only 1 input argument at the moment. My question is how to fix this? - is there plan to have ft_fetch_sens? - or can I change try % try to get the description from the cfg elec = ft_fetch_sens(cfg); catch lasterr to try % try to get the description from the cfg elec = cfg.elec; catch lasterr - could ft_electroderealign have a second input argument? Lilla


Lilla Magyari - 2012-10-24 15:59:57 +0200

(In reply to comment #0) I have found ft_fetch_sens. I do not know how it got deleted before. Lilla


Lilla Magyari - 2012-10-24 17:52:53 +0200

(In reply to comment #1) ft_electrorealign doesn't read the content of cfg.elec when elec doesn't contain an "elecpos" field. In this case, ft_fetch_sens gives an error but in the ft_electroderealign script it is embedded in a try - catch context, therefore, it doesn't lead to an error in ft_electrorealign. the problem is that ft_fetch_sens contains the following code at more places in the script: sens.elecpos = dum.elecpos; sens.chanpos = dum.chanpos; I changed it to: if isfield(dum,'elecpos') sens.elecpos = dum.elecpos; end if isfield(dum,'chanpos') sens.chanpos = dum.chanpos; end


Lilla Magyari - 2012-10-24 17:57:20 +0200

see r6787


Robert Oostenveld - 2019-08-10 11:56:36 +0200

This closes a whole series of bugs that have been resolved (either FIXED/WONTFIX/INVALID) for quite some time. If you disagree, please file a new issue describing the issue on https://github.com/fieldtrip/fieldtrip/issues.