[Eeglablist] Preprocess a Group Study
Cedric Cannard
ccannard at protonmail.com
Tue Sep 7 21:11:22 PDT 2021
Dear Chanda,
Looks like it should do what you want when you do:
Eyes_Closed = strmatch('EyesClosed', {EEG.event.type}, 'exact');
EEG = pop_selectevent(EEG, 'event', Eyes_Closed, 'deletepochs', 'on', 'deleteevents', 'on');
Did you epoch your data before that? e.g., EEG = pop_epoch(EEG, [], [-1 2])
Doesn't this keep only your "Eyes_Closed" events of interest?
Note that you can keep them all, and in STUDY create a design with the event of interest only for analysis. But you'll save time computing ERSP if you remove them before group level.
Use this filter instead (and 2 different passes instead of one bandpass):
EEG = pop_eegfiltnew(EEG, 'locutoff', 0.5);
EEG = pop_eegfiltnew(EEG, 'hicutoff', 50);
> 3. I would like to save all the time-frequency ERSP images from each channel at the same time in a folder, e.g if I have 19 channels, from each channel I plot the ERSP in a loop and save all the 19 images in a folder.
any Matlab pop_functions lines of codes I can use with a loop?
Create a STUDY, precompute ERSP in STUDY mode, it will save the files automatically, and you can analyze your group results easily in STUDY (or LIMO).
Cedric
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Tuesday, September 7th, 2021 at 6:58 PM, Chanda Steven <chandaelizabeth94 at gmail.com> wrote:
> Dear Cedric,
>
> Thank you so much for your reply, the hit helped me but I have few more questions.
>
> 1. I managed to extract only the event of interest by using those two lines of codes you recommended but I would like to cut off the epoch without the events and only remain with epochs containing the events we are interested in, I have given a link with Matlab code of the image showing the event of interest Eyes_Closed but I will get rid of the highlighted filed and only extract epochs with EyesClosed.
>
> Image: https://urldefense.proofpoint.com/v2/url?u=https-3A__ibb.co_rc9zLCQ&d=DwIGaQ&c=-35OiAkTchMrZOngvJPOeA&r=kB5f6DjXkuOQpM1bq5OFA9kKiQyNm1p6x6e36h3EglE&m=wFwo9EjhZ--ywsYRdUpgkBm_mdFp8dOwU0QDaN9XjnY&s=9Tf3h8UGd6BnS3aSyPCr1fvsELmFpKGlfWwPM7Nfl5Q&e=
>
> Matlab Code:
> %Open EEGLAB
> [ALLEEG, EEG, CURRENTSET, ALLCOM] = eeglab;
>
> %Load the EEG dataset
> EEG = pop_biosig('C:\Users\IBM\Desktop\Normal_Subjects\Eyes_Closed\00029426_020817\00029426_020817.EDF');
>
> %Load events from .txt file
> filepath = 'C:\Users\IBM\Desktop\Normal_Subjects\Eyes_Closed\00029426_020817\00029426_020817.txt';
>
> %Merge events with EEG data
> EEG = pop_importevent(EEG, 'event', filepath, 'fields', {'latency', 'type'}, 'append', 'no', 'align', NaN, 'timeunit', 1E-3);
>
> % Select the specific event of interest
> Eyes_Closed = strmatch('EyesClosed', {EEG.event.type}, 'exact');
>
> EEG = pop_selectevent(EEG, 'event', Eyes_Closed, 'deletepochs', 'on', 'deleteevents', 'on');
> pop_eegplot(EEG)
>
> 2. I ran the low pass filter and high pass filter code to eliminate the noise signs between low = 50HZ and high=0.5 but unfortunately the output EEG data seems not to be responsible in filtering compared to when I run it in EEGLAB GUI. See the output EEG data and please advise if the data was filtered accordingly.
>
> Image: https://urldefense.proofpoint.com/v2/url?u=https-3A__ibb.co_fQ1q2nC&d=DwIGaQ&c=-35OiAkTchMrZOngvJPOeA&r=kB5f6DjXkuOQpM1bq5OFA9kKiQyNm1p6x6e36h3EglE&m=wFwo9EjhZ--ywsYRdUpgkBm_mdFp8dOwU0QDaN9XjnY&s=BM-WGp37RvtoLSYJvHnhb9RO9kN9pyEW8KvTi0v83u8&e=
>
> Continue Matlab Code:
> %Apply high-pass and low-pass filter
> EEG = pop_eegfilt( EEG, 0.5, 50,[], 0);
>
> pop_eegplot(EEG)
>
> 3. I would like to save all the time-frequency ERSP images from each channel at the same time in a folder, e.g if I have 19 channels, from each channel I plot the ERSP in a loop and save all the 19 images in a folder.
> any Matlab pop_functions lines of codes I can use with a loop?
>
> Thank You,
> Chanda Simfukwe.
>
> On Sat, Sep 4, 2021 at 2:03 AM Cedric Cannard <ccannard at protonmail.com> wrote:
>
>> Hi Chanda,
>>
>> I developed a function recently to import EDF data into EEGLAB: https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_amisepa_import-5FEDF&d=DwIGaQ&c=-35OiAkTchMrZOngvJPOeA&r=kB5f6DjXkuOQpM1bq5OFA9kKiQyNm1p6x6e36h3EglE&m=wFwo9EjhZ--ywsYRdUpgkBm_mdFp8dOwU0QDaN9XjnY&s=SnS2zVqF7f5kyGTXaIR7cSwlUo1qDXz-aYnMRI2jbsU&e=
>> You need Matlab 2020a or later and the signal processing toolbox to be able to use it. You can try to see if it eases your process by avoiding having to merge your events from the text file.
>>
>> Regarding your problem, there are many ways to process large quantities of files.
>> It sounds you just need to rename some events so that they are the same across subjects? You can do so with:
>> event_to_rename = strmatch('name_of_event_to_rename', { EEG.event.type }, 'exact');
>> EEG = pop_selectevent(EEG,'event', event_to_rename,'renametype','new_name','deleteevents','off');
>>
>> Once your events are homogenous across subjects, you can do any kind of standard EEGLAB pipeline on your large sample.
>>
>> I also invite you to check out these new great recent tools developed by the EEGLAB team for database management for computation automation and facilitating data sharing and compatibility across laboratories:
>> - HED (events): https://urldefense.proofpoint.com/v2/url?u=https-3A__www.hedtags.org_&d=DwIGaQ&c=-35OiAkTchMrZOngvJPOeA&r=kB5f6DjXkuOQpM1bq5OFA9kKiQyNm1p6x6e36h3EglE&m=wFwo9EjhZ--ywsYRdUpgkBm_mdFp8dOwU0QDaN9XjnY&s=gLyiPcHTEi6BA9LlfZbP6FRyP5xF1jNXjL7YpP-jAQI&e=
>> - BIDS (data structure): https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_bids-2Dstandard_bids-2Dspecification&d=DwIGaQ&c=-35OiAkTchMrZOngvJPOeA&r=kB5f6DjXkuOQpM1bq5OFA9kKiQyNm1p6x6e36h3EglE&m=wFwo9EjhZ--ywsYRdUpgkBm_mdFp8dOwU0QDaN9XjnY&s=IWTSxFWgCg-2r1DMZN3OJmPRJQ_W1iRvhwdfr-hxLkY&e=
>> - LIMO (advanced methods to analyze your data): https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_LIMO-2DEEG-2DToolbox_limo-5Ftools_wiki&d=DwIGaQ&c=-35OiAkTchMrZOngvJPOeA&r=kB5f6DjXkuOQpM1bq5OFA9kKiQyNm1p6x6e36h3EglE&m=wFwo9EjhZ--ywsYRdUpgkBm_mdFp8dOwU0QDaN9XjnY&s=hAQrFi7NBHgwLv_K5YVvxr4hOfSraK_pmCh5h8CoJbQ&e=
>>
>> Hoe this helps,
>>
>> Cedric Cannard
>>
>> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
>>
>> On Thursday, September 2nd, 2021 at 8:25 PM, Chanda Steven via eeglablist <eeglablist at sccn.ucsd.edu> wrote:
>>
>>> Dear All,
>>>
>>> I am preprocessing a lot (1000+) of qeeg data in edf format with eeglab on
>>>
>>> Matlab, each subject has a unique file with events in the .txt file that I
>>>
>>> am merging with the subjects edf file and preprocesses the data to obtain
>>>
>>> the time-frequency plot (ERSP and ITC) for developing a machine learning
>>>
>>> model.
>>>
>>> The problem is that I can not create a group study due to subjects having
>>>
>>> different events and that is causing an error "Some datasets have only one
>>>
>>> trial, cannot compute ERPimages" when plotting the time-frequency (ERSP and
>>>
>>> ITC). Is there a way that I can use to preprocess a group of subjects at
>>>
>>> the same time and plot the time-frequency in Matlab or any python
>>>
>>> algorithm that I can use in MNE, I tried using MNE with python but
>>>
>>> importing events file and merge it with the edf and select only events of
>>>
>>> interest was a bit challenging. Any advice on this problem would be
>>>
>>> appreciated?
>>>
>>> Thank You,
>>>
>>> Chanda Simfukwe.
>>>
>>>
>>> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>>>
>>> Chanda Simfukwe
>>>
>>> Ph.D. Candidate
>>>
>>> Artificial Intelligence and Data Science,
>>>
>>> Chung-Ang University Dept. Medicine,
>>>
>>> The Korea Republic of.
>>>
>>> ..........................................
>>>
>>> Eeglablist page: http://sccn.ucsd.edu/eeglab/eeglabmail.html
>>>
>>> To unsubscribe, send an empty email to eeglablist-unsubscribe at sccn.ucsd.edu
>>>
>>> For digest mode, send an email with the subject "set digest mime" to eeglablist-request at sccn.ucsd.edu
>
> --
>
> Chanda Simfukwe
> Ph.D. Candidate
> Artificial Intelligence and Data Science,
> Chung-Ang University Dept. Medicine,
> The Korea Republic of.
> ..........................................
More information about the eeglablist
mailing list