read events

Nicolas Robitaille nicolas.robitaille at UMONTREAL.CA
Sat Feb 27 14:55:18 CET 2010


Dear Karl, dear Robert,

I would suggest, alternatively, to modify the trialfun_general (or wathever trialfun you are using, Karl), in order to use the event definition found in the cfg structure, if any. This would have the advantage of allowing multiple call to definetrial (for multiple conditions; I once had 30 of them) without having to read all the events in the datafile over and over again. I think such change in behavior could be incorporated in the normal distribution of FT, according that it's already the case of the trial definition (i.e. if there is already a .trl field, definetrial.m just use it). 

This would look like:

starting at line 49 of trialfun_general:

% read the header and event information
hdr = read_header(cfg.headerfile);
try
  event = read_event(cfg.headerfile);
catch
  event = [];
end

should become something like:

% read the header and event information
hdr = read_header(cfg.headerfile);

if isfield(cfg, 'event')
  event = cfg.event;
  else
try
  event = read_event(cfg.headerfile);

catch

  event = [];

end
end

Karl, note that I haven't test that. 

Best,

Nicolas

*************************
Nicolas Robitaille, Ph.D.
Stagiaire post-doctoral
Brams
*************************




> Date: Sat, 27 Feb 2010 14:21:03 +0100
> From: r.oostenveld at FCDONDERS.RU.NL
> Subject: Re: [FIELDTRIP] read events
> To: FIELDTRIP at NIC.SURFNET.NL
> 
> Dear Karl,
> 
> Definetrial is usually called before preprocessing, not after preprocessing. Definetrial determines the trial structure, i.e. the segments that subsequently are read with the preprocessing function. Often the interesting data segments (the trials) are much shorter than the complete continuous data, so reading only the trials saves memory.
> 
> Since you have already read in all data into memory, you should use "redefinetrial" to segment your data into the trials. That also requires the trial definition to be specified in cfg.trl. The only purpose of definetrial function is t oconstruct this cfg.trl field based on the events. 
> 
> Since you manually added the triggers after reading the data in memory, you have to emulate the behaviour of definetrial. You should look at it's help and manually construct a cfg.trl field which you can hand over to redefinetrial together with the data.
> 
> best,
> Robert
> 
> 
> 
> 
> 
> On 25 Feb 2010, at 18:35, Karl Doron wrote:
> 
> > My apologies if this is redundant - I believe I sent to it the megcommunity
> > list and meant to send it here, so I am reposting.
> > 
> > Hello,
> > 
> > I've recently collect MEG data and had to edit trigger values. I've read in
> > my BTi data using preprocessing() and inserted triggers at appropriate times
> > in sub1.trial{1}(1,:).
> > 
> > Now I would like to use definetrial. However, the cfg file references the
> > original data, with the incorrect trigger onsets and information. What
> > should I list as cfg.dataset to have my imported data read?
> > 
> > Thanks for any help.
> > 
> > karl doron
> > Ph.D. Candidate
> > UC, Santa Barbara
> > 
> > ----------------------------------
> > The aim of this list is to facilitate the discussion between users of the FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip.
> > 
> 
> ----------------------------------
> The aim of this list is to facilitate the discussion between users of the FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip.
 		 	   		  
_________________________________________________________________


----------------------------------
The aim of this list is to facilitate the discussion between users of the FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20100227/f5b261b2/attachment-0001.html>


More information about the fieldtrip mailing list