Scroll to navigation

XDF_SET_CONF(3) xdffileio library manual XDF_SET_CONF(3)

NAME

xdf_set_conf, xdf_get_conf - set or get the configuration of xDF file

SYNOPSIS

#include <xdfio.h>

int xdf_set_conf(struct xdf* xdf, enum xdffield field, ...);
int xdf_get_conf(const struct xdf* xdf, enum xdffield field, ...);

DESCRIPTION

xdf_set_conf() sets the configuration (usually one of the field file header) of a xDF file referenced by xdf according to the variable list of arguments. This list is composed of successive couple grouping one variable of type enum xdffield defining the feature to be set and a value whose type depends on the previous field type. The list must finish by XDF_NOF.

xdf_get_conf() gets the configuration of the channel referenced by xdf according to the variable list of argument. The variable list is the same list terminated by XDF_NOF as for xdf_set_conf() excepting that the second part of the couple is not that value but a pointer to the value.

Both functions process the argument list from left to right. This means that if a particular field request provokes an error, none of the field requests on its right will be processed. The order of processing is also important for field requests that influences the value of other fields (like XDF_F_REC_NSAMPLE or XDF_F_SAMPLING_FREQ).

The functions accepts two types of field value. The first one are file configuration field (XDF_F_*) which set different aspects of the general configuration of the file. The second type are the channel configuration fields (XDF_CF_*). When used in xdf_set_conf(), those fields set the default values that will be used for the creation of the next channel (see xdf_add_channel(3)). The list of channel configuration fields and their meaning are specified in the documentation of xdf_set_chconf(3).

If the file is opened for writing, each field is initialized to sensible or non-informative values in case of optional field or incorrect values in the case of "must be set" field (only XDF_F_REC_NSAMPLE or XDF_F_SAMPLING_FREQ). The default value are specified in squared bracked in the list.

Here is the list of file configuration field value. The type of value expected is provided in the parenthesis (the expected type of the value for xdf_set_conf(), or a pointer to this type for xdf_get_conf()). If a list of data formats is specified in curl brackets, it means that the field is supported only in those formats (no list means that all formats support the field):

Specify the duration of one record. The value should be positive.
Specify the number of time points contained in each record. The value should be positive. Setting the number of sample per record modifies the sampling frequency (field XDF_SAMPLING_FREQ).
Get or set the sampling frequency of the recording. Setting the sampling frequency modifies the number of sample per record (field XDF_F_REC_NSAMPLE).
Get the number of channel in the file.
Get the number of different event types.
Get the number of events.
Get the file format type (one of the value defined by the enumeration xdffiletype other than XDF_ANY)
Date and time of recording. It is expressed as number of seconds elapsed since the Epoch, 1970-01-01 00:00:00 +0000 (UTC). This number is the convertion to double of the value returned by the function time(3) of the standard C library. On file creation, this field is initialized to the current time.
Specify the string describing the subject.
Specify the string describing the session of recording.
Birthday of the patient using the same format as specified for field XDF_F_RECTIME.
Height of the subject in centimeters.
Weight of the subject in kilograms.
Sex of the subject. Use 1 for male, 2 for female and 0 if unknown.
Handness of the subject. Use 0 if unknown, 1 if right, 2 if left and 3 if ambidextrious.
Visual impairment. Use 0 if unknown, 1 if no impairment, 2 if impaired and 3 if impaired but corrected.
Heart impairment. Use 0 if unknown, 1 if no impairment, 2 if impaired and 3 if the subject wear a pacemaker.
Location of the recording. The first 2 component specify the latitude and longitude in degrees, the third specifies the altitude in meters.
Patient classification according to the International Statistical Classification of Diseases and Related Health Problems (ICD).
Size of the subject's head (circumference, distance nasion – inion, left to right mastoid) expressed in millimeters.
X, Y, Z coordinates of the reference electrode.
X, Y, Z coordinates of the ground electrode.

RETURN VALUE

The two functions returns 0 in case of success. Otherwise -1 is returned and errno is set appropriately.

ERROR

xdf is NULL or field is not a proper value of the enumeration xdffield accepted by the function (for example XDF_F_NCHANNEL and xdf_set_conf() )
The request submitted to xdf_set_conf() is not allowed for this type of xDF file or is not supported with the mode XDF_READ.

EXAMPLES

Example of usage of xdf_set_conf() and xdf_get_conf():


/* Assume xdfr and xdfw reference 2 XDF files opened respectively

* for reading and for writing */ const char *subjstr, *sessstr; xdf_get_conf(xdfr, XDF_F_SUBJ_DESC, &subjstr,
XDF_F_SESS_DESC, &sessstr,
XDF_NOF); printf("subject: %s\nrecording: %s\n", subjstr, sessstr); xdf_set_conf(xdfw, XDF_F_SUBJ_DESC, subjstr,
XDF_F_SESS_DESC, sessstr,
XDF_NOF);

SEE ALSO

xdf_copy_conf(3), xdf_set_chconf(3), xdf_add_channel(3)

2010 EPFL