1XDF_SET_CONF(3) xdffileio library manual XDF_SET_CONF(3)
2
3
4
6 xdf_set_conf, xdf_get_conf - set or get the configuration of xDF file
7
9 #include <xdfio.h>
10
11 int xdf_set_conf(struct xdf* xdf, enum xdffield field, ...);
12 int xdf_get_conf(const struct xdf* xdf, enum xdffield field, ...);
13
15 xdf_set_conf() sets the configuration (usually one of the field file
16 header) of a xDF file referenced by xdf according to the variable list
17 of arguments. This list is composed of successive couple grouping one
18 variable of type enum xdffield defining the feature to be set and a
19 value whose type depends on the previous field type. The list must fin‐
20 ish by XDF_NOF.
21
22 xdf_get_conf() gets the configuration of the channel referenced by xdf
23 according to the variable list of argument. The variable list is the
24 same list terminated by XDF_NOF as for xdf_set_conf() excepting that
25 the second part of the couple is not that value but a pointer to the
26 value.
27
28 Both functions process the argument list from left to right. This means
29 that if a particular field request provokes an error, none of the field
30 requests on its right will be processed. The order of processing is
31 also important for field requests that influences the value of other
32 fields (like XDF_F_REC_NSAMPLE or XDF_F_SAMPLING_FREQ).
33
34 The functions accepts two types of field value. The first one are file
35 configuration field (XDF_F_*) which set different aspects of the gen‐
36 eral configuration of the file. The second type are the channel config‐
37 uration fields (XDF_CF_*). When used in xdf_set_conf(), those fields
38 set the default values that will be used for the creation of the next
39 channel (see xdf_add_channel(3)). The list of channel configuration
40 fields and their meaning are specified in the documentation of
41 xdf_set_chconf(3).
42
43 If the file is opened for writing, each field is initialized to sensi‐
44 ble or non-informative values in case of optional field or incorrect
45 values in the case of "must be set" field (only XDF_F_REC_NSAMPLE or
46 XDF_F_SAMPLING_FREQ). The default value are specified in squared
47 bracked in the list.
48
49 Here is the list of file configuration field value. The type of value
50 expected is provided in the parenthesis (the expected type of the value
51 for xdf_set_conf(), or a pointer to this type for xdf_get_conf()). If
52 a list of data formats is specified in curl brackets, it means that the
53 field is supported only in those formats (no list means that all for‐
54 mats support the field):
55
56 XDF_F_REC_DURATION (double) [1]
57 Specify the duration of one record. The value should be posi‐
58 tive.
59
60 XDF_F_REC_NSAMPLE (int) [0]
61 Specify the number of time points contained in each record. The
62 value should be positive. Setting the number of sample per
63 record modifies the sampling frequency (field XDF_SAM‐
64 PLING_FREQ).
65
66 XDF_F_SAMPLING_FREQ (int) [0]
67 Get or set the sampling frequency of the recording. Setting the
68 sampling frequency modifies the number of sample per record
69 (field XDF_F_REC_NSAMPLE).
70
71 XDF_F_NCHANNEL (int) (get function only)
72 Get the number of channel in the file.
73
74 XDF_F_NEVTTYPE (int) (get function only)
75 Get the number of different event types.
76
77 XDF_F_NEVENT (int) (get function only)
78 Get the number of events.
79
80 XDF_F_FILEFMT (int) (get function only)
81 Get the file format type (one of the value defined by the enu‐
82 meration xdffiletype other than XDF_ANY)
83
84 XDF_F_RECTIME (double) [current time] {EDF BDF GDF}
85 Date and time of recording. It is expressed as number of seconds
86 elapsed since the Epoch, 1970-01-01 00:00:00 +0000 (UTC). This
87 number is the convertion to double of the value returned by the
88 function time(3) of the standard C library. On file creation,
89 this field is initialized to the current time.
90
91 XDF_F_SUBJ_DESC (const char*) [""] {EDF BDF GDF}
92 Specify the string describing the subject.
93
94 XDF_F_SESS_DESC (const char*) [""] {EDF BDF GDF}
95 Specify the string describing the session of recording.
96
97 XDF_F_ADDICTION (unsigned int) [0] {GDF}
98
99 XDF_F_BIRTHDAY (double) [0] {GDF}
100 Birthday of the patient using the same format as specified for
101 field XDF_F_RECTIME.
102
103 XDF_F_HEIGHT (double) [0] {GDF}
104 Height of the subject in centimeters.
105
106 XDF_F_WEIGHT (double) [0] {GDF}
107 Weight of the subject in kilograms.
108
109 XDF_F_GENDER (unsigned int) [0] {GDF}
110 Sex of the subject. Use 1 for male, 2 for female and 0 if
111 unknown.
112
113 XDF_F_HANDNESS (unsigned int) [0] {GDF}
114 Handness of the subject. Use 0 if unknown, 1 if right, 2 if left
115 and 3 if ambidextrious.
116
117 XDF_F_VISUAL_IMP (unsigned int) [0] {GDF}
118 Visual impairment. Use 0 if unknown, 1 if no impairment, 2 if
119 impaired and 3 if impaired but corrected.
120
121 XDF_F_HEART_IMP (unsigned int) [0] {GDF}
122 Heart impairment. Use 0 if unknown, 1 if no impairment, 2 if
123 impaired and 3 if the subject wear a pacemaker.
124
125 XDF_F_LOCATION (double[3]) [0,0,0] {GDF}
126 Location of the recording. The first 2 component specify the
127 latitude and longitude in degrees, the third specifies the alti‐
128 tude in meters.
129
130 XDF_F_ICD_CLASS (char[6]) [0x000000000000] {GDF}
131 Patient classification according to the International Statisti‐
132 cal Classification of Diseases and Related Health Problems
133 (ICD).
134
135 XDF_F_HEADSIZE (double[3]) [0,0,0] {GDF}
136 Size of the subject's head (circumference, distance nasion –
137 inion, left to right mastoid) expressed in millimeters.
138
139 XDF_F_REF_POS (double[3]) [0,0,0] {GDF}
140 X, Y, Z coordinates of the reference electrode.
141
142 XDF_F_GND_POS (double[3]) [0,0,0] {GDF}
143 X, Y, Z coordinates of the ground electrode.
144
146 The two functions returns 0 in case of success. Otherwise -1 is
147 returned and errno is set appropriately.
148
150 EINVAL xdf is NULL or field is not a proper value of the enumeration
151 xdffield accepted by the function (for example XDF_F_NCHANNEL
152 and xdf_set_conf() )
153
154 EPERM The request submitted to xdf_set_conf() is not allowed for this
155 type of xDF file or is not supported with the mode XDF_READ.
156
158 Example of usage of xdf_set_conf() and xdf_get_conf():
159
160 /* Assume xdfr and xdfw reference 2 XDF files opened respectively
161 * for reading and for writing */
162 const char *subjstr, *sessstr;
163
164 xdf_get_conf(xdfr, XDF_F_SUBJ_DESC, &subjstr,
165 XDF_F_SESS_DESC, &sessstr,
166 XDF_NOF);
167
168 printf("subject: %s\nrecording: %s\n", subjstr, sessstr);
169
170 xdf_set_conf(xdfw, XDF_F_SUBJ_DESC, subjstr,
171 XDF_F_SESS_DESC, sessstr,
172 XDF_NOF);
173
175 xdf_copy_conf(3), xdf_set_chconf(3), xdf_add_channel(3)
176
177
178
179
180
181
182EPFL 2010 XDF_SET_CONF(3)