[FieldTrip] plotting events from ft_read_event in ft_databrowser
Schoffelen, J.M. (Jan Mathijs)
janmathijs.schoffelen at donders.ru.nl
Tue Mar 25 18:52:14 CET 2025
Hi Roy,
A warning is not an error, so that in itself shouldn’t be the issue.
What is the issue, though, is that one of the following will work:
put your my_events in the cfg, rather than the data, i.e. cfg.event = my_events, and supply this cfg to ft_databrowser(cfg,data);
put your my_events in data.cfg, rather than in data, i.e. data.cfg.event = my_events
Best wishes,
Jan-Mathijs
On 21 Mar 2025, at 12:44, Roy Cox via fieldtrip <fieldtrip at science.ru.nl> wrote:
hi all,
Likely I'm missing something obvious, but I'm trying to figure out how to pass an event structure read in by ft_read_event on to ft_databrowser in order to visualize events.
Reading in a Brainvision file using ft_preprocessing, followed by explicitly reading in the events and adding them to the dataset, like so:
%read continuous (single-trial) data
cfg=[];
cfg.dataset='some_path';
cfg.readbids = 'no';
data=ft_preprocessing(cfg);
%read the events
my_events=ft_read_event(cfg.dataset,'eventformat','brainvision_vhdr','readbids','no');
%add to data
data.event=my_events;
%looks ok:
struct2table(data.event)
ans =
6×5 table
type value sample duration offset
_______________ _______________________________________ __________ ________ ____________
{'Time 0' } {0×0 double } 1 0 {0×0 double}
{'Stimulus' } {'recordingtime: 10-Mar-2025 22:49:30'} 1 0 {0×0 double}
{'Time 0' } {0×0 double } 1 0 {0×0 double}
{'New Segment'} {0×0 double } 1 0 {0×0 double}
{'Stimulus' } {'sync_Amp time' } 265 5e+05 {0×0 double}
{'Stimulus' } {'LOFF_Lights off' } 2.1014e+05 5e+05 {0×0 double}
ans =
When I call ft_databrowser on this data strcuture, I get multiple instances of the following warning and no event markers are plotted:
Warning: could not determine dimord of "event" in:
hdr: [1×1 struct]
label: {264×1 cell}
time: {[0 0.0040 0.0080 0.0120 0.0160 0.0200 0.0240 0.0280 0.0320 0.0360 0.0400 0.0440 0.0480 0.0520 0.0560 0.0600 0.0640 0.0680 0.0720 … ]}
trial: {[264×1571182 double]}
fsample: 250
sampleinfo: [1 1571182]
cfg: [1×1 struct]
event: [1×6 struct]
Dove in a bit, and it looks like getdimord is called on data.event, which is probably not what should happen.
Any suggestions? Thanks!
Roy
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20250325/238b53ab/attachment.htm>
More information about the fieldtrip
mailing list