[Eeglablist] interpolating electrode using topoplot
Natasa Kovacevic
nkovacev at rotman-baycrest.on.ca
Tue Sep 12 09:12:31 PDT 2006
I run into a problem when trying to interpolate values for one electrode
using other electrodes based on the following the logic:
eeg = original data set where time series for electrode Q needs to be
replaced by interpolated values
tmp_eeg = pop_select(eeg,'nochannel',Q); % remove bad electrode
use topoplot on tmp_eeg with 'noplot' option to get interpolated value
for coordinates corresponding to Q
insert interpolated values back into eeg
- it reports 'out of bound' error for many values of Q. I believe that
there is a bug in topoplot function when using 'noplot' option and it
has to do with mapping of electrode coordinates (theta and radius) into
the rectangular grid of interpolated values.
I believe that the following portion of topoplot.m (starting at line
~1260)
%%%%%%%%%% Return interpolated value at designated scalp location %%%%%%
%%%%
%
if exist('chanrad') % optional first argument to 'noplot'
chantheta = (chantheta/360)*2*pi;
chancoords =
round(ceil(GRID_SCALE/2)+GRID_SCALE/2*2*chanrad*[cos(-chantheta),...
-sin(-chantheta)]);
if chancoords(1)<1 ...
| chancoords(1) > GRID_SCALE ...
| chancoords(2)<1 ...
| chancoords(2)>GRID_SCALE
error('designated ''noplot'' channel out of bounds')
else
chanval = Zi(chancoords(1),chancoords(2));
grid = Zi;
Zi = chanval; % return interpolated value instead of Zi
end
end
%%%%%%%%%%%%%%%%%%%%%%%%
should be replaced by :
%%%%%%%%%% Return interpolated value at designated scalp location %%%%%%
%%%%
%
if exist('chanrad') % optional first argument to 'noplot'
chantheta = (theta(i)/180)*pi;
chanrad = rad(i);
[chanx chany] = pol2cart(chantheta,chanrad);
chanx = chanx * squeezefac;
chany = chany * squeezefac;
chancoords = round(GRID_SCALE/2 + GRID_SCALE/2*[chanx chany]);
if chancoords(1)<1 ...
| chancoords(1) > GRID_SCALE ...
| chancoords(2)<1 ...
| chancoords(2)>GRID_SCALE
error('designated ''noplot'' channel out of bounds')
else
chanval = Zi(chancoords(1),chancoords(2));
grid = Zi;
Zi = chanval; % return interpolated value instead of Zi
end
end
%%%%%%%%%%%%%%%%%%%%%%%%
Can anyone confirm that this is correct. Thanks,
Natasa
--
Natasa Kovacevic, PhD
Rotman Research Institute
Baycrest Centre
Toronto
(416) 858-8095
nkovacev at rotman-baycrest.on.ca
More information about the eeglablist
mailing list