Create events/annotations on EEGLAB?
14 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Maanasi Garg
le 4 Oct 2016
Commenté : Vinay Elkoori Ghantala Karnam
le 6 Fév 2020
Can I manually create events/annotations in .set EEG files on EEGLAB without previously importing epoch info or event info? The EEGs which I want to analyze with EEGLAB have files with respective event annotations, but those files are in .edf.seizures format, which I can't figure out how to open on EEGLAB.
0 commentaires
Réponse acceptée
Aylin
le 14 Oct 2016
Hello Maanasi,
I understand that you want to import ‘ .edf.seizures ’ files into MATLAB for processing by EEGLAB. Please refer to the EEGLAB documentation for more information:
Since ‘ .edf.seizures ’ seems to be a non-standard file format, it is possible to write your own MATLAB function to import event annotations from these files. The following MATLAB Answers page provides more information about this:
Building on the above answer, assuming that you want to read more than one seizure event, you can use the following MATLAB function:
function [ number_of_seizures, seizure_start_time_offsets, seizure_lengths ] = get_seizure_periods( annotation_file_location )
file_descriptor = fopen(annotation_file_location);
byte_array = fread(file_descriptor);
number_of_seizures = (sum(byte_array == hex2dec('ec')) - 1) / 2;
for i=1:number_of_seizures
seizure_start_time_offsets(i) = bin2dec(strcat(dec2bin(byte_array(23 + (i*16))),dec2bin(byte_array(26 + (i*16)))));
seizure_lengths(i) = byte_array(34 + (i*16));
end
end
The above function provides the number of seizure events, the seizure start time offsets (from the previous event), and the duration of the seizures. In the above function, I have assumed that the seizure data stays at the same byte positions in each ‘ .edf.seizures ’ file. I also used the publicly-available ‘ .edf.seizures ’ data from the CHB-MIT Scalp EEG Database to test the above function:
If you are getting your ‘ .edf.seizures ’ files from a different source, you may want to write your own data import function. Also, since EEGLAB may want the data in the form of a matrix, you may want to reshape the above arrays into a matrix before importing it into EEGLAB.
In order to import this data from the MATLAB workspace into EEGLAB, you might want to use the “Import Epoch Info” feature of EEGLAB. Please refer to the EEGLAB documentation for more information about importing epoch information:
3 commentaires
Itaf BEN SLIMEN
le 20 Juin 2018
please have you a solution for this problem !! i can't open the file .edf.seizures !!
Vinay Elkoori Ghantala Karnam
le 6 Fév 2020
Hi, I tried using your snippet but looks like it does not return the righ value for all the annotation files. Ex:chb04_28 has two annotations. The first one is returned correctly at 1679sec but the second one is returned incorrectly as 2001sec which should be 3782sec according to the summary file of the patient chb04. Could you please look into this matter?
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur EEG/MEG/ECoG dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!