How can I import my own dataformat?

There are two approaches for importing your own dataformat.

The first and preferred way of implementing a new dataformat is by extending the ft_read_header, ft_read_data and ft_read_event functions. These functions are wrappers around many different fileformats and provide a common interface. Probably you will also have to add your fileformat to fileformat function so that the files are properly recognized. You could even replace the read_xxx functions completely by your own functions, as long as their interface stays the same. Depending on the complexity of your experimental design (e.g. conditional trigger sequences), you might want to write a custom function for the trialdefinition. Contact us if you need help.

Alternatively, if you already are able to read the data into Matlab, you can reformat that data within Matlab into a datastructure that is compatible with FieldTrip. Raw data that is comparable with the output of preprocessing should consist of a structure with the fields

data.label   % cell-array containing strings, Nchan X 1
data.fsample % sampling frequency in Hz, single number
data.trial   % cell-array containing a data matrix for each trial (1 X Ntrial), each data matrix is Nchan X Nsamples 
data.time    % cell-array containing a time axis for each trial (1 X Ntrial), each time axis is a 1 X Nsamples vector 

Each trial can have a different number of samples (i.e. variable length), that is why all samples in each trial have to be described with an individual time axis. If your data consists of trials with a fixed length, then each vector data.time{i} is equal to data.time{1}.

The second approach for importing data is relevant if you do not want to read the raw data from file, i.e. you do not want to do everything (starting with preprocessing) using FieldTrip, but only the final stages of your analysis. This is the approach for example taken in the besa2fieldtrip and eeglab2fieldtrip functions.

faq/how_can_i_import_my_own_dataformat.txt · Last modified: 2010/04/15 10:53 by timeng
Back to top
chimeric.de = chi`s home Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0