# issue with cfg.interplimits

Stanley Klein sklein at BERKELEY.EDU
Mon May 31 21:43:49 CEST 2010

```On Reyna Gordon's comment about interpolation between electrodes. A
number of years ago we modified a topo plot so that rather than
showing a smooth interpolation it plotted each electrode as a tiny
disk with the voltage shown as the color of the disk The disks were
made large enough so that with a dense electrode array they would
overlap maybe 40%. Three close electrodes could have triple overlap as
I recall. The cute thing about the algorithm is that in the overlap
regions we would plot the mean of the overlapping electrodes. It
produced a very nice plot with cute smoothing and yet one could
identify the location of each electrode. I'm sorry I haven't been able
to locate that old topoplot code. But here is a crude matlab
simulation similar to what we did for the interpolation.

elec=[0 1 1 1 1 0 0 0 0 0 ; 0 0 1 1 1 1 0 0 0 0; 0 0 0 0 1 1 1 1 0 0];
V = [1 3 5]
[Nelec,Npix]=size(elec)
topo=zeros(1,Npix);
for i=1:Npix
for j=1:Nelec;
topo(i)=topo(i)+V(j)*elec(j,i);
N=sum(elec(:,i)~=0);
end
if N>0, topo(i)=topo(i)/N;end
end
topo

where elec is the topographic image where '1' indicates the electrode
locations and V is the voltages on the electrodes. The "interpolated"
topoplot is topo. As I recall the algorithm we had only worried about
2 electrode overlaps  in which case there was a really simple way to
do the algorithm without any FOR loops, using a set intersect command
from Matlab.

I think it would be nifty if this type of option could be included in
Fieldtrip so that one sees the electrode locations as well as getting
good enough interpolation/smoothing.
Stan

On Mon, May 31, 2010 at 1:43 AM, Roemer van der Meij
<r.vandermeij at donders.ru.nl> wrote:
>
> Hi Reyna,
>
> Sorry for my late reply. I added your bug to our new bug-database, you can track it here if you wish:
> http://bugzilla.fcdonders.nl/show_bug.cgi?id=86
>
> I'll try to work out a fix in the following days. It probably doesn't have anything to do with your specific ft_prepare_layout options. There has been a reorganization of the plotting-functions several months back, which may have caused this problem.
> Are you by the way using the most recent fieldtrip version?
>
> Best,
> Roemer
>
>
>
> On 5/21/2010 8:50 PM, Reyna L. Gordon wrote:
>>
>> Dear Fieldtrippers,
>>
>> I am having an issue with creating topoplots of time-frequency data acquired on an EGI system and processed in Fieldtrip, and I was wondering if anyone could help.
>>
>> Everything works great (this toolbox has been wonderful to use in general!) except that the colors that represent power are not interpolating to electrodes that are lower than the origin. Unfortunately, using the default option for cfg.projection = 'orthographic' for ft_prepare_layout, seems to greatly distort the layout for these data, probably because I have too few electrodes. A better option for me seems to be cfg.projection = 'polar', and I am fine with those few electrodes appearing outside of the head.
>>
>> However, the data corresponding to those electrodes is not there - I suspect that there is a problem at the level of cfg.interplimits.
>> This is the code I'm using:
>>
>> cfg = [];
>> cfg.rotate = 0;
>> cfg.projection = 'polar';
>> newlay=ft_prepare_layout(cfg, bin1);
>> cfg = [];
>>
>> cfg.layout  = newlay;
>> cfg.yparam = 'freq';
>> cfg.xlim= [0.150 0.150];
>> cfg.ylim= [13 30];
>> cfg.zlim = [-0.10 0.10];
>> cfg.highlight          = 'on';
>> cfg.baseline = 'no';
>> cfg.commentpos = 'title';
>> cfg.shading    = 'interp';
>> cfg.interplimits = 'electrodes'; %Should work here?
>> cfg.style = 'straight';
>> cfg.zparam   = 'powspctrm';
>> cfg.fontsize = 12;
>> cfg.gridscale = 100;
>> ft_topoplotTFR(cfg, bin1);
>>
>> According to the documentation,  specifying cfg.interplimits = 'electrodes' should achieve what I want here, but it still does not interpolate the plot outside of the head.
>> Attached are some images generated with different cfg.interplimits and cfg.projection options. I have tried upgrading to the most recent release of FT, but it doesn't change the outcome.
>>
>> Any and all insight would be greatly appreciated.
>> Best,
>> Reyna
>>
>> -----------------------
>> Reyna L. Gordon
>> PhD Candidate
>> Center for Complex Systems & Brain Sciences
>> Florida Atlantic University
>> gordon at ccs.fau.edu
>>
>>
>>
>>
>>
>>
>> ----------------------------------
>> The aim of this list is to facilitate the discussion between users of the FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip.
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> ----------------------------------
>> The aim of this list is to facilitate the discussion between users of the FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip.
>
> --
> Roemer van der Meij MSc
> Scientific Programmer&  Data-Analyst
> Donders Institute for Brain, Cognition and Behaviour
> Centre for Cognition
> P.O. Box 9104
> 6500 HE Nijmegen
> The Netherlands
> Tel: +31(0)24 3612631
> E-mail: r.vandermeij at donders.ru.nl
>
> ----------------------------------
> The aim of this list is to facilitate the discussion between users of the FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip.

----------------------------------
The aim of this list is to facilitate the discussion between users of the FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip.

```