Skip to content

Feature storage format

Benjamin Ultan Cowley edited this page Sep 27, 2017 · 6 revisions

Feature storage format

Extracted features are stored using a custom data structure. The structure consists of Matlab structs residing in a mat file. Such a file contains following structs:

  • INFO -- metadata related to the whole measurement

  • SEGMENT -- metadata related to calculation segments

  • DataStruct#1 -- Feature data for all channels and calculation segments

There can be several DataStruct structures.

Data structure description

INFO

Metadata structure that contains subject or measurement related information.

Field Type Size Description
.anyname string not restricted Subject or measurement related text metadata. Could be e.g. sex, subject group, ... Field name can be anything that Matlab accepts.
.anyname numeric [1, 1] Subject or measurement related numeric metadata. Could be e.g. age, subject number, ...Field name can be anything that Matlab accepts.

FACTORS

Metadata structure that contains calculation segment related information. Examples of this kind of information would be measurement block, workload, etc.

Field Type Size Description
.data cell of strings / numerics [m, s] Classifier variable values, dim1: time (calculation segments), dim2: variable
.labels cell of strings [1, s] Classifier variable names
.units cell of strings [1, s] Classifier variable measurement units

Feature data struct (1 sublevel i.e. channels)

Feature data struct description for data variables that have one sublevel, in this case the channels. This data structure is typically used for variables of multichannel measurements, where there exists one variable value per channel and calculation segment. Examples include EEG and ERP measurements.

Field Type Size Description
.labels cell of strings [1, p] Data variable names
.units cell of strings [1, p] Data variable measurement units
.parameters struct [1,1] Calculation parameters in struct form.Field names and content not specified.
.sublevels struct [1,1] See next section
.datafield_n struct [1,1] Sublevel data (e.g. ERP.Fz)

Contents of .datafield_n

Field Type Size Description
.data numeric [m, p] Data variable values, dim1: time (calculation segments), dim2: variable

Contents of .sublevels

Field Type Size Value Description
.n integer [1,1] 1 Number of sublevels in the result variable. In result variables of type "sublevel 1" this value should be 1.
.labels cell of strings [1, 1] any string Sublevel name. In result variables of type "sublevel 1" this value should be a single string (e.g. 'channel').

Matlab functions

dataexport.m

Batch converts several identical format result files into one data array. Used in exporting study results into array form.

data2array.m

Converts a whole result file with data structures into array form. Note that sublevel 0 and sublevel 1 result variable structures should not be converted into the same array. See function documentation for details.

datacat0.m and datacat1.m

Convert result variable structures into array form. Own m-file for each result variable type.

A more detailed function documentation for all CTAP functions can be found in the functions themselves (m-files).

Formats not present in CTAP

Feature data struct -- no sublevels

Result data structure for data variables with no sublevels. Single channel measurements and measurements that provide only onle signal typically produce data variables that fit into this simple data structure.

Examples include ECG, plethysmograph and breathing measurements and their result variablse HRV, BRS, BPV. However, if one decides to measure e.g. ECG from several channels, the results might need to be stored in a more complex result data structure. See section .1.4.

var

Field Type Size Description
.labels cell of strings [1, p] Data variable names
.units cell of strings [1, p] Data variable measurement units
.data numeric [m, p] Data variable values
dim1: time (calculation segments)
dim2: variable
.parameters struct [1,1] Calculation parameters in struct form.Field names and content not specified.
.sublevels struct [1,1] See next section
  2. <var>.sublevels
Field Type Size Value Description
.n integer [1,1] 0 Number of sublevels in the result variable .
In result variables of type "sublevel 0" this value should be 0.

Feature data struct -- k sublevels

In some rare cases a result variable with several sublevels might be needed. This section describes the result variable structure in such case.

Note that currently the functions used in manipulating data structures do not support result variables with 2 or more sublevels. This is just an option that might be implemented in future.

  1. <var>
Field Type Size Description
.labels cell of strings [1, p] Data variable names
.units cell of strings [1, p] Data variable measurement units
.parameters struct [1,1] Calculation parameters in struct form.Field names and content not specified.
.sublevels struct [1,1] See next section
. struct [1,1] Sublevel data.Sublevels will be nested e.g. ....data
  2. <var>.<sub1>.<sub2>.<sub3>. ...
Field Type Size Description
.data numeric [m, p] Data variable valuesdim1: time (calculation segments)
dim2: variable
  3. <var>.sublevels
Field Type Size Value range Description
.n integer [1,1] [0,1,2,...] Number of sublevels in the result variable .
.labels cell of strings [1, .sublevels.n] any string Sublevel name(s)
In this case k different sublevel names needs to be specified.