[FieldTrip] ft_rejectvisual channel selection

Eelke Spaak eelke.spaak at donders.ru.nl
Tue May 17 09:28:36 CEST 2011


Hi Diego,

Indeed, it is probably a good idea to check for artifacts before
performing any resampling. The sample indices that are stored in trl
(or sampleinfo) matrices, should always correspond to sample indices
in the *original* dataset (on disk), and do not necessarily have any
direct relation to sample indices in the data you have in memory.
Therefore, if you resample the data, the samples in your data in
memory do not directly correspond to samples in the dataset on disk
anymore; so therefore trl or sampleinfo fields would not make sense,
and might even lead to inconsistencies. This is the reason that
ft_resampledata removes any such fields, if present, from your
(in-memory) dataset.

We are currently in the process of thinking hard about the trl and
sampleinfo matrices, and might revise how these are handled in the
future. In any case, it should become possible (already on our
todo-list) to use the artifact detection functions on in-data memory
without explicit sample indices.

But, for now, your solution is the quickest one :)

Best,
Eelke

2011/5/17 Lozano Soldevilla, D. (Diego) <d.lozanosoldevilla at fcdonders.ru.nl>:
> Hi Stan,
>
> You're right. It seems that my problem lies in the lack of trl because I previously resample my data and this last function do not creates a new trl with the updated begin and end samples. If I create a new trl = round(data.cfg.previous.trl(:,1:3) * (1/data.cfg.origfs) *data.fsample);, I get the same error but not with the original data (without resampling). Then I'll use data without resampling to check my artifacts.
>
> Thanks again,
>
> Diego
>
>
>
> ----- "Stan van Pelt" <stan.vanpelt at fcdonders.ru.nl> wrote:
>
>> From: "Stan van Pelt" <stan.vanpelt at fcdonders.ru.nl>
>> To: "Email discussion list for the FieldTrip project" <fieldtrip at donders.ru.nl>
>> Sent: Monday, 16 May, 2011 9:40:11 PM
>> Subject: Re: [FieldTrip] ft_rejectvisual channel selection
>>
>> Hi Diego,
>>
>> Hm, sounds odd to me. Is your trial-definition output from
>> ft_definetrial
>> correct? So a cfg.trl that is not empty?
>>
>> Otherwise, you might try starting with an empty cfg again before
>> calling
>> ft_preprocessing?
>>
>> cfg=ft_definetrial(cfg);
>> trials=cfg.trl;
>>
>> cfg=[];
>> cfg.trl=trials;
>> cfg.dataset                     = [direc d(rr,1).name];
>> cfg.channel                     = {'MEG' 'EEG057' 'EEG058'};
>> cfg.continuous                  = 'yes';
>> etc..
>> data                            = ft_preprocessing(cfg);
>>
>> That should give you an output with a trial-structure, I'd say.
>>
>> Best,
>> Stan
>>
>> -----Original Message-----
>> From: fieldtrip-bounces at donders.ru.nl
>> [mailto:fieldtrip-bounces at donders.ru.nl] On Behalf Of Lozano
>> Soldevilla,
>> D. (Diego)
>> Sent: Monday, May 16, 2011 4:25 PM
>> To: Email discussion list for the FieldTrip project
>> Subject: Re: [FieldTrip] ft_rejectvisual channel selection
>>
>> Hi Stan,
>>
>> Thanks for your quickly answer. I get this error:
>>
>> Warning: the data does not contain a trial definition, assuming that
>> the
>> trials are consecutive segments of a continuous recording
>> > In utilities/private/warning_once at 81
>>   In utilities/private/fixtrialdef at 52
>>   In ft_datatype_raw at 91
>>   In ft_checkdata at 161
>>   In ft_databrowser at 120
>> redrawing with viewmode butterfly
>> ??? Improper index matrix reference.
>>
>> Error in ==> ft_databrowser>redraw_cb at 910
>>   evtsample = [event(:).sample];
>>
>> Error in ==> ft_databrowser at 419
>> redraw_cb(h);
>>
>> I don't know why my data have no trial definition when I'm sure that
>> is
>> epoched... Any ideas?
>>
>> Thanks in advance,
>>
>> Diego
>>
>>
>>
>> ----- "Stan van Pelt" <stan.vanpelt at fcdonders.ru.nl> wrote:
>>
>> > From: "Stan van Pelt" <stan.vanpelt at fcdonders.ru.nl>
>> > To: "Email discussion list for the FieldTrip project"
>> <fieldtrip at donders.ru.nl>
>> > Sent: Monday, 16 May, 2011 4:16:16 PM
>> > Subject: Re: [FieldTrip] ft_rejectvisual channel selection
>> >
>> > Hi Diego,
>> >
>> > You could try using ft_databrowser instead of ft_rejectvisual
>> > (followed by
>> > ft_rejectartifact), so:
>> >
>> > cfg            = [];
>> > cfg.continuous = 'no';
>> > cfg.channel    = {'EEG057','EEG058'};
>> > cfg            = ft_databrowser(cfg,data);
>> >
>> > I think it should work like this.
>> >
>> > Best,
>> > Stan
>> >
>> > -----Original Message-----
>> > From: fieldtrip-bounces at donders.ru.nl
>> > [mailto:fieldtrip-bounces at donders.ru.nl] On Behalf Of Lozano
>> > Soldevilla,
>> > D. (Diego)
>> > Sent: Monday, May 16, 2011 4:00 PM
>> > To: fieldtrip at donders.ru.nl
>> > Subject: [FieldTrip] ft_rejectvisual channel selection
>> >
>> > Dear Fieldtrippers,
>> >
>> > I'm using ft_rejectvisual function to reject visually EOG artifacts
>> > of
>> > epoched trials. My problem consist that I'm not able to plot only
>> the
>> > EOG
>> > channels even when I explicitly select them ignoring the 'MEG'
>> > channels (I
>> > get a plot with all channels MEG + EOG).
>> >
>> > I directly used rejectvisual_channel (used in line 263
>> > offt_rejectvisual)
>> > function selecting the EOG channels but I'm getting again all
>> > channels.
>> > Somebody could tell me what I'm doing wrong?
>> >
>> > Thanks in advance,
>> >
>> > Diego
>> >
>> >
>> >
>> > PS: Code
>> >
>> > %epoching
>> > cfg = [];
>> > cfg.dataset                     = [direc d(rr,1).name];
>> > cfg.trialdef.eventtype          = 'frontpanel trigger';
>> > cfg.trialdef.eventvalue         = 4;
>> > cfg.trialdef.prestim            = 1; % in seconds
>> > cfg.trialdef.poststim           = 4; % in seconds
>> > cfg.trialdef.epochmoving        = 'inbackward';
>> > cfg.trialdef.pivoteventvalue    = 2;% cue stimulus
>> > cfg.trialdef.jumps              = 1;
>> > cfg.trialfun                    = 'trialselec';
>> >
>> > cfg = ft_definetrial(cfg);
>> >
>> > cfg.channel                     = {'MEG' 'EEG057' 'EEG058'};
>> > cfg.lpfilter                    = 'yes';
>> > cfg.lpfreq                      = 250;
>> > cfg.baselinewindow              = [-1 0];
>> > cfg.keeptrials                  = 'yes';
>> > cfg.demean                      = 'yes';
>> > cfg.continuous                  = 'yes';
>> >
>> > data    = ft_preprocessing(cfg);
>> >
>> > %..............
>> >
>> >
>> > %visual data rejection
>> > cfg             = [];
>> > cfg.channel     = {'EEG057' 'EEG058'};
>> > cfg.method      = 'channel';
>> > cfg.keepchannel = 'yes';
>> > data_c          = ft_rejectvisual(cfg,data);
>> >
>> >
>> >
>> > --
>> > PhD Student
>> > Donders Institute for Brain, Cognition and Behaviour
>> > Centre for Cognitive Neuroimaging
>> > Trigon, room 0.83
>> > Kapittelweg 29
>> > Radboud University Nijmegen
>> > NL-6500 HB Nijmegen
>> > The Netherlands
>> > E-Mail: d.lozanosoldevilla at fcdonders.ru.nl
>> > Tel:      +31-(0)24-36-66274
>> > Web:    http://www.neuosc.com/
>> > _______________________________________________
>> > fieldtrip mailing list
>> > fieldtrip at donders.ru.nl
>> > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>> > _______________________________________________
>> > fieldtrip mailing list
>> > fieldtrip at donders.ru.nl
>> > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>
>> --
>> PhD Student
>> Donders Institute for Brain, Cognition and Behaviour
>> Centre for Cognitive Neuroimaging
>> Trigon, room 0.83
>> Kapittelweg 29
>> Radboud University Nijmegen
>> NL-6500 HB Nijmegen
>> The Netherlands
>> E-Mail: d.lozanosoldevilla at fcdonders.ru.nl
>> Tel:      +31-(0)24-36-66274
>> Web:    http://www.neuosc.com/
>>
>>
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>




More information about the fieldtrip mailing list