[FieldTrip] quick fieldtrip question

Eelke Spaak eelke.spaak at donders.ru.nl
Mon Sep 26 17:07:07 CEST 2011


Hi Tom,

ft_preprocessing will try to convert your data structure into raw data
before applying any preprocessing (which includes channel selection).
Since you are providing output of ft_freqanalysis ('freq structures')
as input, this will fail if the dimensionality of the freq data
indicates that this would not make sense.

You'll probably want to have a look at the ft_selectdata function,
which also supports selecting subregions of freq/timelock structures,
rather than only raw data:

goodchans = intersect(freq1.label, freq2.label);
freq1 = ft_selectdata(freq1, 'channel', goodchans);
freq2 = ft_selectdata(freq2, 'channel', goodchans);

Note by the way the use of Matlab's builtin 'intersect' function,
which you will probably also find useful :)

If the ft_selectdata approach fails, you might also take a look at the
low-level fieldtrip utility function 'match_str'.

Good luck,
Eelke


2011/9/26 Marshall, T.R. (Tom) <t.marshall at fcdonders.ru.nl>:
> Thanks Eelke. This seems like what I want, but I can't seem to actually implement it.
>
> To provide a little more detail, what I currently have are two data sets on which I have performed frequency analysis. One of them has a bunch of channels missing that I had to throw out. Now I want to have a look at the difference between the two. Of course it only makes sense to do this for the channels that are common to both datasets.
>
> In order to do my subtraction, I have this:
>
> ***
> %find channels that exist in both datasets
> common_channels=tdcs_low{1}.label(ismember(tdcs_low{1}.label,notdcs_low{1}.label));
>
> %throw away channels that are unique to the notdcs dataset
> cfg=[];
> cfg.channels=common_channels;
>
> notdcs_fewer_channels{1}=ft_preprocessing(cfg,notdcs_low{1});
> ***
>
> ...which gives the following error
>
> ***
> ??? Error using ==> ft_checkdata>freq2raw at 1583
> this only works for dimord='rpt_chan_freq_time'
>
> Error in ==> ft_checkdata at 257
>        data = freq2raw(data);
>
> Error in ==> ft_preprocessing at 284
>  data = ft_checkdata(data, 'datatype', 'raw', 'hassampleinfo', 'yes');
> ***
>
> In the above datasets, the 'dimord', looks like channels x frequencies x time. Not sure what 'rpt' stands for in the error message, nor why there should be a 4th dimension.
>
> Best,
> Tom
>
> ----- Original Message -----
> From: "Eelke Spaak" <eelke.spaak at donders.ru.nl>
> To: "T.R. Marshall (Tom)" <t.marshall at fcdonders.ru.nl>, "Email discussion list for the FieldTrip project" <fieldtrip at donders.ru.nl>
> Sent: Monday, 26 September, 2011 2:22:56 PM
> Subject: Re: quick fieldtrip question
>
> Hi Tom,
>
> I'm forwarding my response, and your question, to the FieldTrip
> mailing list, so that anyone who in the future might wonder the same
> thing will benefit. BTW, if you're not subscribed to the list yet, you
> really should (see http://fieldtrip.fcdonders.nl/discussion_list for
> instructions).
>
> The easiest way to select channels to remove or retain is by using the
> cfg.channel option which is understood by ft_preprocessing:
>
> cfg = [];
> cfg.channel = {'chan1', 'chan2'}; % this will *keep* only those channels
> data = ft_preprocessing(cfg, data);
>
> or:
>
> cfg = [];
> cfg.channel = {'all', '-chan1', '-chan2'}; % this will *remove* those channels
> data = ft_preprocessing(cfg, data);
>
> For more information, type 'doc ft_channelselection' into Matlab, or
> see http://fieldtrip.fcdonders.nl/reference/ft_channelselection .
>
> Hope this helps!
>
> Best,
> Eelke
>
>
> 2011/9/26 Marshall, T.R. (Tom) <t.marshall at fcdonders.ru.nl>:
>> Hi Eelke,
>>
>> So I have a very quick question about channel selection in fieldtrip.
>>
>> I want to plot a contrast of my tDCS and no-tDCS data. My problem is that I had to throw away a lot more channels in the tDCS condition than in the no-tDCS condition, so datasets comprise different channels. I spent a few minutes trying to write fiddly code to compare the entries in the 'labels' field of the data structure, but surely fieldtrip has some general purpose function just to keep some channels and throw away others? I can't find exactly this on the wiki...
>>
>> Hope you can help. Thanks in advance.
>> Tom
>>
>> --
>> Tom Marshall, MSc.
>> Neuronal Oscillations Group, Donders Centre for Cognitive Neuroimaging
>> tel: +31(0)243668487
>> email: t.marshall at fcdonders.ru.nl
>> postal: PO Box 9101, 6500HB, Nijmegen, The Netherlands
>> visiting: Kapittelweg 29, 6525EN, Nijmegen, The Netherlands
>>
>
> --
> Tom Marshall, MSc.
> Neuronal Oscillations Group, Donders Centre for Cognitive Neuroimaging
> tel: +31(0)243668487
> email: t.marshall at fcdonders.ru.nl
> postal: PO Box 9101, 6500HB, Nijmegen, The Netherlands
> visiting: Kapittelweg 29, 6525EN, Nijmegen, The Netherlands
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>




More information about the fieldtrip mailing list