[FieldTrip] ft_selectdata - automatic channels sorting

jan-mathijs schoffelen jan.schoffelen at donders.ru.nl
Wed Jun 25 08:55:08 CEST 2014


Hi Martina,

I agree that the sorting of the channels is somewhat annoying, and an unexpected feature in the coding. Presently we are looking into how to address this.

Yet, the sorting that is applied to the list of channels is consistently applied to all fields that contain numeric data. In your case I don’t understand your statement that the mask stays unsorted. Is there any way you are able to verify that? If I run the following simple simulation everything is reordered, also the ‘mask’-field.

stat.label={‘B’;’A’;’C’};
stat.stat=repmat([1:3]’,[1 2]);
stat.mask=stat.stat;
stat.prob=stat.stat;
stat.time=[1 2];
stat.dimord=‘chan_time’;

stat2=ft_selectdata([],stat);

If I now do:

stat2.label

I get 

ans = 

  ‘A’
  ‘B’
  ‘C’

and when I do:

stat2.stat

I get

ans = 

  2 2
  1 1
  3 3

and when I do:

stat2.mask

I get

ans = 

  2 2 
  1 1
  3 3

Conslusion: the mask is also re-ordered. In other words, the rows in the numeric data fields are still consistent with respect to one another.

If you want to stay informed about this issue, I suggest you to create an account on bugzilla.fcdonders.nl, and add yourself to the cc-list of bug #2597.


Best wishes,
Jan-Mathijs


On Jun 23, 2014, at 4:14 PM, Martina Postorino <martina.postorino at gmail.com> wrote:

> Dear all,
> 
> I recently encountered a problem using the function ft_selectdata to select a subset of channels from my EEG dataset.
>  
> I found out that in the output of the function ft_selectdata, channels are sorted alphabetically. For me, that represents a problem since I would like to plot the results from a cluster based permutation test using the information stored in stat.mask (in which the order of channels is in line with the original order of channels, i.e. not alphabetically) on the ERP grandaverage of specific electrodes selected with ft_selectdata, to see which time points are significantly different between my experimental conditions. Due to the different orders of the channels, the mask is plotted over the wrong channels.
>  
> Is there a way to avoid that the function automatically sorts the labels of the channels alphabetically?
>  
> I have already tried the different versions of ft_selectdata (ft_selectdata, ft_selectdata_old, ft_selectdata_new) and updated my Fieldtrip version to the last one available. Nothing changed.
> 
> This is the code I use:
> 
> [stat] = ft_timelockstatistics(cfg, ERP_pain_bp_GA, ERP_buttonpress_GA);
> 
>  %plotting
> 
> cfgp = [];
> cfgp.channel = {'Cz'; 'CPz', 'Pz', 'CP1'. 'CP3', 'CP2', 'CP4'};
> cfgp.avgoverchan = 'no';
> cfgp.latency = [-1 1];
> ERP_pain_bp_GA_red = ft_selectdata_new(cfgp, ERP_pain_bp_GA);
> ERP_buttonpress_GA_red = ft_selectdata_new(cfgp, ERP_buttonpress_GA);
>  
> % average data across subjects
> 
> cfgp = [];
> cfgp.keepindividual = 'no';
> ERP_pain_bp_GA_avg = ft_timelockanalysis (cfgp, ERP_pain_bp_GA_red);
> ERP_buttonpress_GA_avg = ft_timelockanalysis (cfgp, ERP_buttonpress_GA_red);
> % ERP_pain_GA_avg = ft_timelockanalysis (cfg, ERP_pain_GA_red);
> 
> ERP_pain_bp_GA_avg.mask = stat.mask;
> ERP_buttonpress_GA_avg.mask = stat.mask;
> % ERP_pain_GA_avg.mask = stat.mask;
> 
> % do the plotting
> 
> cfgp = [];
> cfgp.maskparameter = 'mask';
> cfgp.maskstyle = 'box';
> cfgp.layout = layout_easycap_painlabmunich;
> 
> ft_multiplotER(cfgp,ERP_pain_bp_GA_avg, ERP_buttonpress_GA_avg); 
> 
> Thanks in advance!
> 
> ___________________________________________
> 
> Martina Postorino, M.Sc
> Phd program in Medical Life Science and Technology
> 
> Neuroimaging Center (TUM-NIC)
> Technische Universität München, Klinikum Rechts der Isar
> 
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip

Jan-Mathijs Schoffelen, MD PhD 

Donders Institute for Brain, Cognition and Behaviour, 
Centre for Cognitive Neuroimaging,
Radboud University Nijmegen, The Netherlands

Max Planck Institute for Psycholinguistics,
Nijmegen, The Netherlands

J.Schoffelen at donders.ru.nl
Telephone: +31-24-3614793

http://www.hettaligebrein.nl

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20140625/8b45492a/attachment.html>


More information about the fieldtrip mailing list