To ensure that the functions implemented in the FieldTrip toolbox can be mixed and matched, we always try to keep a small number of data structures.
The general principle is that a data structure should be as small as possible, but nevertheless contain enough information to fully understand its contents.
Information on the data in a structure should not be replicated. If there is replication, there would be the risk of one function might use one version of the information whereas another function would use the other version. Changing the data in a structure should only require changing the information once.
Wherever possible, use one of the existing data representations. If needed, these can be extended with additional information. The use of an existing data structure allows the reuse of existing functions for plotting and further analysis. E.g. you can do freqanalysis on the output of componentanalysis, because the IC timeseries are represented just as raw data that comes out of preprocessing.
If you give a structure as input to an existing function, the type of the input structure will be determined using the datatype helper-function.
This is in general the output of the preprocessing, appenddata and resampledata functions. It is characterised by
data.trial = cell-array (1 X Ntrials), each cell contains a single trial represented as Nchan X Nsamples matrix data.time = cell-array (1 X Ntrials), each cell contains a time vector data.channel = cell-array (Nchan X 1), each cell contains a string with the name of that channel
Usually the raw data on disk will be read, filtered and segmented on the fly, resulting in multiple trials. It is possible to represent non-segmented raw data as a single trial and with a time-axis that corresponds to the full acquisition time.
This contains the spectral estimate of power at multiple frequencies. The power can represent the complete trial, or it can be estimated (e.g. using wavelets) for multiple time points within each trial, resulting in a time-frequency representation (TFR).
This contains an average over multiple trials as a matrix or multiple trials that are represented as a 3-D array. Optionally, it can contain the estimated covariance matrix (again averaged over trials or for each trial in a 3-D array).
This is represented just as raw data, except that an additional matrix is added describing the spatial topographies of the components. The original channel labels are replaced by strings like 'ica001', 'ica002', … After ft_componentanalysis, you can call any function that can work with raw data. The topoplotIC function can be used to visualize the component topographies.
This represents data on a regular 3-D grid, like an anatomical MRI, a functional MRI. It can also represent a source reconstructed estimate of the activity measured with MEG in case the source reconstruction is done on a regular 3-D dipole grid (like a box).
This represents data that corresponds to locations in 3-D space. Compared to volume data, this representation is more general and also supports irregular source locations, e.g. a folded cortical sheet. It is always possible to convert volume data to source data. If the source data represents a regular 3-D grid (i.e. like a box), it is also possible to convert source data back to volume data
This is characterised as a sparse point-process, i.e. each neuronal firing is only represented as the time at which the firing happened. Optionally, the spike waveform can also be represented. Using the spike waveform, the neuronal firing events can be sorted into their single units.