Back to the main page.
Bug 3474 - eeglab2fieldtrip function needs to be updated with more fields
Status | CLOSED WORKSFORME |
Reported | 2019-03-11 18:06:00 +0100 |
Modified | 2019-08-10 12:43:48 +0200 |
Product: | FieldTrip |
Component: | external |
Version: | unspecified |
Hardware: | PC |
Operating System: | Windows |
Importance: | P5 normal |
Assigned to: | |
URL: | |
Tags: | |
Depends on: | |
Blocks: | |
See also: |
AB - 2019-03-11 18:06:06 +0100
Link to EEG dataset: https://www.dropbox.com/s/x06gabg335iyjbg/Sample%20EEG%20dataset.zip?dl=0 ----------------------- Dear community, Please see the forwarded message below. It seems as if eeglab2fieldtrip needs to be updated in order to return data structures that are robustly compatible with the fieldtrip code. I suspect that some necessary fields need to be adjusted/added. No doubt some of you have run into this and I would appreciate if you could contribute a solution with an updated version of eeglab2fieldtrip through a pull request on github. Best wishes and happy computing, Jan-Mathijs J.M.Schoffelen, MD PhD Associate PI, VIDI-fellow - PI, language in interaction Telephone: +31-24-3614793 Physical location: room 00.028 Donders Centre for Cognitive Neuroimaging, Nijmegen, The Netherlands ---------------------------------------------------------------------------- Dear Fieldtrip community, I'm using an EEG data structure and want to use the fieldtrip toolbox to perform the LCMV Beamformer algorithm as outlined in this tutorial: http://www.fieldtriptoolbox.org/tutorial/beamformer_lcmv/ I converted the EEG data to fieldtrip using: data=eeglab2fieldtrip(EEG,'preprocessing','none'); Then, I tried to compute the covariance matrix using: cfg = []; cfg.covariance = 'yes'; timelock = ft_timelockanalysis(cfg, data); Note, that in order to use ft_timelockanalysis function, the data has to be organized in a structure obtained from ft_preprocessing but that function is built for fieldtrip data and I had already sent 'preprocessing' as one of the arguments to eeglab2fieldtrip. In any case, as soon as I call ft_timelockanalysis, I get the following error: Reference to non-existent field 'dimord'. Error in dimlength (line 74) elseif strcmp(data.(fld), 'rpt_pos') Error in fixsampleinfo (line 49) ntrial = dimlength(data, 'rpt'); Error in ft_datatype_timelock (line 146) timelock = fixsampleinfo(timelock); Error in ft_checkdata (line 270) data = ft_datatype_timelock(data, 'hassampleinfo', hassampleinfo); Error in ft_timelockanalysis (line 101) data = ft_checkdata(data, 'datatype', {'raw+comp', 'raw'}, 'feedback', 'yes', 'hassampleinfo', 'yes'); All of this works with the dataset included as part of the tutorial. I've tried to compare the structure of the two data sets and I've noticed that the data obtained from eeglab2fieldtrip is missing several fields. The data in these fields is already in the eeglab data but it wasn't added which is why the ft_timelockanalysis is failing since those fields don't exist. Hence, I was wondering if you could please know what the problem could be or if there is a way to fix this. All I am trying to do is this LCMV Beamformer analysis which I have only been able to find in fieldtrip. My data is in eeglab. Sincerely, Aiyush
Robert Oostenveld - 2019-03-11 20:41:19 +0100
Why did you assign this to me? And why did you include the email of Jan-Mathijs, instead of providing an example script how to reproduce your problem? I downloaded the fdt file, but don't know what to do with it. Do you expect me to download EEGLAB first?
AB - 2019-03-11 22:55:16 +0100
Hi, The script is the eeglab2fieldtrip function located here: https://github.com/fieldtrip/fieldtrip/blob/master/external/eeglab/eeglab2fieldtrip.m The email beneath Jan-Mathijs is my email which explains how to reproduce the bug and the error. Since the problem originates with the conversion of the EEGlab set data to the fieldtrip, unfortunately, I think EEGlab is required to understand the data structure and how to convert it to fieldtrip such that the necessary fields are added. data=eeglab2fieldtrip(EEG,'preprocessing','none'); Then, I tried to compute the covariance matrix using: cfg = []; cfg.covariance = 'yes'; timelock = ft_timelockanalysis(cfg, data); Note, that in order to use ft_timelockanalysis function, the data has to be organized in a structure obtained from ft_preprocessing but that function is built for fieldtrip data and I had already sent 'preprocessing' as one of the arguments to eeglab2fieldtrip.
AB - 2019-03-11 22:57:07 +0100
Also, I'm sorry I'm new to the fieldtrip community. I did not mean to assign this to you. I just added you to the CC list so that you get a notification. You had asked me to open this bug report so I tried to follow those instructions. Sorry if I made any mistake.
Jan-Mathijs Schoffelen - 2019-03-12 07:40:41 +0100
It's no problem being a beginner, but it would be good then to set some expectations: we are not a service company that fixes your problems (this is not our job: we are scientists that share our code and knowledge for the benefit of the community). Rather, we see ourselves as a big community in which we are helping out each other. Ideally, you solve the problem yourself (because it's your problem), and we are happy to provide guidance. If problems are just 'thrown' at us the way you have done (by first e-mailing me on a personal basis, and then by e-mailing Robert on a personal basis because you apparently felt that things were not moving fast enough to your taste), this typically does not work well in order (actually counterproductive) to get other people's sympathy. More constructively, you could help yourself already by looking into the specific details of what goes wrong in your case. The matlab debugger (dbstop if error) and graphical breakpoints are useful in this context, because they allow you to inspect the data variables that cause problems. Once you understand a bit better what is going on, you can either give a more detailed description of your problem, or you could already provide a solution yourself. Just uploading a link to a legacy format requires other people to do extra work in order to get the data loaded into matlab to begin with is also not a good idea. If anything (once you have investigated the problem a bit more yourself) you should provide a link to a variable that contains the 'EEG' variable which you use to convert into a fieldtrip structure (i.e. the input to eeglab2fieldtrip), which more specifically can be easily obtained by just typing the load(datafile) command in matlab.
AB - 2019-03-13 17:21:30 +0100
Thanks for your feedback. I again apologize for my approach and it won't happen again. I wasn't trying to treat this as a IT service. I appreciate any help or advice I can get. If I had been told to provide the EEG data variable from the beginning, I would have done so. I did not know how to report a bug or an issue previously and hence, I went to the github first which prompted me to email you on a personal basis. After I was guided to this forum and community, I realize what the proper protocol is. In any case, I have re-read the tutorial for LCMV Beamforming and found another bug page here: http://bugzilla.fieldtriptoolbox.org/show_bug.cgi?id=1718 I was able to perform the analysis using the dataset provided. I then updated the dipfit plugin in EEGlab to 3.0 and re-used the eeglab2fieldtrip function. I then was able to perform the ft_timelockanalysis without any errors. I'm now following the pipeline and I think I can do the rest. I have attached a test_data that is the variable after conversion with eeglab2fieldtrip. Link: https://www.dropbox.com/s/pqqtqq24rppb15e/AG_HCL004_eeglab2fieldtrip.mat?dl=0 I'm really sorry again for the inconvenience.
AB - 2019-03-13 17:29:36 +0100
Created attachment 882 My Pipeline for LCMV analysis using eeglab2fieldtrip I've attached a script of the pipeline I'm using now. In the step of calculating the planar gradients, it requires the 'ctf275_neighb.mat' file which is not included in the SubjectSEF.ds example data. Hence, the ft_checkdata outputs an error: Error using ft_checkdata (line 574) This function requires data with an 'ctf151', 'ctf275', 'bti148', 'bti248', 'itab153', 'yokogawa160' or 'yokogawa64' sensor array.
AB - 2019-03-13 17:34:06 +0100
I think I have found the template. Seems to be working! https://github.com/fieldtrip/fieldtrip/tree/master/template/layout/ I will mark this as resolved. Thank you!