Back to the main page.

Bug 2501 - databrowser displays old events after appending data

Status CLOSED FIXED
Reported 2014-03-17 11:49:00 +0100
Modified 2015-01-12 09:23:02 +0100
Product: FieldTrip
Component: plotting
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P5 normal
Assigned to: Jan-Mathijs Schoffelen
URL:
Tags:
Depends on:
Blocks:
See also:

Phyllis - 2014-03-17 11:49:06 +0100

%note: as discussed in the mailinglist, this issue can be resolved by clearing the cfg field before calling the databrowser EEG = rmfield(EEG, 'cfg') _________ %after reading in and re-referencing two separate EEG recordings (with ft_preprocessing), I define the trials in each dataset(data_pt1 and data_pt2): cfg = []; cfg.dataset = 'data_pt1.vhdr'; cfg.trialdef.eventtype = 'Stimulus'; cfg.trialfun = 'my_trialfun'; cfg.trialdef.prestim = 1.25; cfg.trialdef.poststim = 3.55; cfg.trialdef.eventvalue = {'S 11', 'S 12', 'S 13', 'S14'}; cfg = ft_definetrial(cfg); EEG_pt1 = ft_redefinetrial(cfg, data_pt1); %(analogous for data_pt2, i.e. EEG_pt2) %append 1st and 2nd half of experiment cfg = []; EEG = ft_appenddata(cfg, EEG_pt1, EEG_pt2); %when looking at the data all event triggers are displayed throughout the data cfg = []; cfg.continuous = 'no'; ft_databrowser(cfg, EEG);


Robert Oostenveld - 2014-03-17 12:36:12 +0100

Getting the events from the provenance information (data.cfg.previous.previous...) is the problem here. I suspect that it also causes problems if data were downsampled, e.g. cfg = ... data = ft_preprocessing(cfg) cfg = ... resampled = ft_resampledata(cfg, data) cfg = ... ft_databrowser(cfg, resampled) In this case ft_databrowser would also get the events from the cfg.previous, without taking into account that the samples don't match. Removing the provenance (i.e. cfg) works, but is not the desired way to go about. Perhaps we should noty use ft_findcfg, but only use data.cfg.event if the events are at the present level and not deeper down in the history.


Jörn M. Horschig - 2014-03-25 16:59:48 +0100

see http://mailman.science.ru.nl/pipermail/fieldtrip/2014-March/007676.html


Jörn M. Horschig - 2014-03-25 17:00:22 +0100

and http://mailman.science.ru.nl/pipermail/fieldtrip/2014-March/007680.html


Robert Oostenveld - 2014-03-25 17:14:08 +0100

I guess that ft_findcfg shoudl not be used to dig all the way through the provenance (cfg.previous.previous), but that only data.cfg.event is to be considered (if present).


Jan-Mathijs Schoffelen - 2014-09-11 11:55:00 +0200

Robert's suggestion sounds like a good one. bash-4.1$ svn diff ft_databrowser.m Index: ft_databrowser.m =================================================================== --- ft_databrowser.m (revision 9790) +++ ft_databrowser.m (working copy) @@ -262,12 +262,16 @@ % don't use the events in case the data has been resampled warning('the data has been resampled, not showing the events'); event = []; + elseif isfield(data, 'cfg') && isfield(data.cfg, 'event') + % use the event structure from the data as per bug #2501 + event = data.cfg.event; elseif ~isempty(cfg.event) % use the events that the user passed in the configuration event = cfg.event; else % fetch the events from the data structure in memory - event = ft_fetch_event(data); + %event = ft_fetch_event(data); + evnet = []; end cfg.channel = ft_channelselection(cfg.channel, hdr.label); bash-4.1$ svn commit -m "enhancement - only use event info from data if it is in data.cfg.event, #2501" ft_databrowser.m Sending ft_databrowser.m Transmitting file data . Committed revision 9793.