Difference between revisions of "AnyWave:ADES"
(→The header file (.ades)) |
(→The marker file (.mrk)) |
||
Line 29: | Line 29: | ||
==The marker file (.mrk)== | ==The marker file (.mrk)== | ||
− | It is possible to have a third optional file describing markers in the data. This file is an AnyWave marker file. The name must be the same than the header file but with extension .mrk<br> | + | It is possible to have a third optional file describing markers in the data. This file is an AnyWave marker file. The name must be the same than the header file but with extension '''.mrk'''<br> |
This is a text file with a simple format: | This is a text file with a simple format: |
Revision as of 10:40, 12 March 2014
ADES stands for AnyWave DEScriptive format.
ADES format is composed of at least two files but a third file can be used for markers.
The most important file is the header file for which extension is .ades
Contents
The header file (.ades)
This is a text file using a very simple syntax. Let's have a look:
#ADES header file
samplingRate = 1000
numberOfSamples = 4000
A1 = EEG
A2 = EEG
A3 = EEG
Line 1 begins with # which is the starting character for comments. However, this first line is mandatory and defines the header file as ADES header.
The next line defines the sampling rate of the data. This parameter is mandatory and must be expressed in Hertz.
The third line defines the total number of samples per channel in the data file.
The following lines describe the channels present in the data file. In our example, there are 3 channels, A1, A2, A3.
The channels are defined to be EEG channels but could be defined as SEEG, MEG, EMG, ECG, or even Trigger.
It is also possible to omit the channel's type; AnyWave will consider channels as EEG by default in that case.
The data file (.dat)
Data are stored in a binary file which name is exactly the same than the header file except the extension: .dat
The samples are stored as float, 4 bytes per sample, little endian. The channels are multiplexed.
The marker file (.mrk)
It is possible to have a third optional file describing markers in the data. This file is an AnyWave marker file. The name must be the same than the header file but with extension .mrk
This is a text file with a simple format:
// AnyWave Marker File
Start -1 0.957031 0
Section -1 0.960938 2
Marker1 -1 150.957 0
CRISE -1 213.023 0
Marker2 -1 300.957 0
Marker3 -1 450.957 0
Marker4 -1 578.707 0
Special -1 600.957 0 A1
END -1 621.582 0
The first line must be // AnyWave Marker File. AnyWave will then recognize the file as a marker file.
Next come the markers, one marker by line.
Attributes must be separated by tabulations.
The first attribute is the marker's label.
The second attribute is the integer value associated with the marker. -1 means that there is no value.
The third attribute is the position in seconds, from the begining of the data file.
The fourth parameter is the duration in seconds, 0 means no duration.
There is an optional fifth parameter : the channels or sensors targeted by the marker; AnyWave can handle markers which concern specific channels or sensors.
If no channel names are specified, AnyWave will consider the marker as a general marker.
To specify channel names, simply add the names of the channels separated by a coma ','
The marker named Special is an example of a marker which targets the A1 channel.
The duration attribute is only necessary to define markers of type Selection in AnyWave. Those are markers which mark a segment of data.
In our example, we have a total of 9 markers. One of them is a Selection marker, called Section and has a duration of 2 seconds. The first marker is called Start and the last one is called END.
Depending on the acquisition system used to record data or if the file was exported by AnyWave, markers can have different labels.
Building your own ADES file
It is quite simple to build a ADES file from Matlab for example. Suppose you have data stored in a Matlab matrix that you would like to export to ADES format:
function mat2awv(data,fileName,FS,labels,labelType) % write in the current folder ADES and DAT files from matrix in MATLAB workspace % data = matrix of data (nbchannel * time points) - the data have to be in % microVolt % fileName = string of the output files without extension ; the ades and % dat files will have the same name % FS = sampling rate % labels = cell array with channel labels % labelType : 'EEG' or 'MEG' % Sophie Chen - January 2014 %% generate the ADES file adesFile = [fileName '.ades']; fid = fopen(adesFile,'wt'); fprintf(fid,'%s\r\n','#ADES header file '); fprintf(fid,'%s','samplingRate = '); fprintf(fid,'%d\r\n',FS); fprintf(fid,'%s','numberOfSamples = '); fprintf(fid,'%d\r\n',size(data,2)); for lab = 1:length(labels) fprintf(fid,'%s\r\n',[labels{lab} ' = ' labelType]); end fclose(fid); %% generate the DAT file datFile = [fileName '.dat']; fad = fopen(datFile,'wb'); fwrite(fad, data, 'float32'); fclose(fad); end