[FieldTrip] problems using fieldtrip for source reconstruction EEG

Alexis Pérez alexisperezbellido at gmail.com
Mon Jan 7 12:01:32 CET 2019


Hi,

On Mon, Jan 7, 2019 at 11:30 AM Irene Varela Leniz <
irene.varela at alumni.mondragon.edu> wrote:

> Hello Alex,
>
> I have tried the tutorial you mention, but as I stated above, I get error
> related with the definition of the structure (This function requires
> 'timelock' or 'freq' data as input, see ft_datatype_timelock or
> ft_datatype_freq.). We dont really know how to obtain this from data. Do
> we have to add something more to obtain timelock and freq?
>

What I was suggesting is, first as a learning practice, you can run the
different fieldtrip examples (on fieldtrip example data) just to understand
how the plotting functions work. Because these examples must work, you can
play around with the different parameters in order to understand how the
data should be organized and what manipulations you can apply to your
plots. Second, once that you feel confident in plotting the fieldtrip
example data (for instance, make sure that you understand what each of the
fields in your data structure variable contain), you can try to find out
what is the problem when you try to plot your own dataset.

Example:
>
> EEG=load(filename);
> data=EEG.data;
> cfg = [];
> cfg.xlim = [-0.2 1.0];
> cfg.ylim = [-1e-13 3e-13];
> cfg.channel = 'A1';
> figure; ft_singleplotER(cfg,data);
>
>
> Thank you in advance,
> Irene
>
> Probably you can share with us what is the content of your data struct
variable. Otherwise it is difficult to tell where the problem might be.




>
>
>
> El lun., 7 ene. 2019 a las 11:20, Alexis Pérez (<
> alexisperezbellido at gmail.com>) escribió:
>
>> Hi Irene,
>>
>> here you have different examples on how you can plot data in fieldtrip.
>> http://www.fieldtriptoolbox.org/tutorial/plotting/
>>
>> I recommend you to follow the tutorial by running the little snippets of
>> code and trying to understand:
>> 1 what are the fields that your data structure should contain in order to
>> be plotted (e.g. if you want to plot timefrequency amplitide
>> representations you must have a power representation).
>> 2 how each of the cfg. arguments modify your plot (you can also use the
>> matlab help command in each plotting function to see a description of the
>> different plot features that you can modify).
>> 3 what different types of data you can find and what are the different
>> ways to plot them.
>>
>> Once you have understood how yo plot the data in the fieldtrip examples,
>> then you can start to generalize and customize those functions to your own
>> needs.
>>
>> In your particular example, if you want to plot the topology then you
>> must use ft_topoplotER (and not ft_singleplotER). Remember to indicate
>> what is your helmet sensor/electrodes layout otherwise you will get errors
>> or incorrect representation of your data.
>>
>> Good luck and patience.
>>
>> alex
>>
>> On Mon, Jan 7, 2019 at 10:36 AM Irene Varela Leniz <
>> irene.varela at alumni.mondragon.edu> wrote:
>>
>>> Hi Julian,
>>>
>>> I have read about them in Fieldtrip documentation but I still dont
>>> manage to do nothing. I am looking for a topographic visualization of data
>>> and I am interesed in using Fieldtrip. Moreover, whenever I try different
>>> command I get the following error:
>>>
>>> Error using ft_checkdata (line 525)
>>> This function requires 'timelock' or 'freq' data as input, see
>>> ft_datatype_timelock or ft_datatype_freq.
>>> Error in ft_singleplotER (line 133)
>>>   varargin{i} = ft_checkdata(varargin{i}, 'datatype', {'timelock',
>>> 'freq'});
>>>
>>> The data comes from eeglab using eeglab2fieldtrip function, so that we
>>> have the data stored in a struct.
>>>
>>> Thank you in advance,
>>> Irene
>>>
>>> El lun., 7 ene. 2019 a las 10:27, Julian Keil (<julian.keil at gmail.com>)
>>> escribió:
>>>
>>>> Hi Irene,
>>>>
>>>> it helps if you describe exactly what you want to do (I don’t mean to
>>>> be rude or patronizing, but check here for suggestions:
>>>> https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1002202
>>>> ).
>>>>
>>>> There are many ways to visualize resting state EEG signals, and you
>>>> don’t need fieldtrip for all of them.
>>>> E.g., if you just want to plot the timecourse of the data, you can use
>>>> the matlab built-in „plot“ function (e.g. use something like
>>>> "plot(data.time{1},data.trial{1})“ to plot one trial). If you want to
>>>> explore your data, ft_databrowser is your friend
>>>> http://www.fieldtriptoolbox.org/faq/how_can_i_use_the_databrowser/
>>>>
>>>> Best,
>>>>
>>>> Julian
>>>>
>>>> ________________
>>>> Prof. Dr. Julian Keil
>>>>
>>>> Biological Psychology
>>>> Olshausenstrasse 62 - R. 306
>>>> 24118 Kiel, Germany
>>>>
>>>> +49 - 0431 - 880 - 4872
>>>> http://www.biopsych.uni-kiel.de/en
>>>>
>>>>
>>>> Am 07.01.2019 um 09:57 schrieb Irene Varela Leniz <
>>>> irene.varela at alumni.mondragon.edu>:
>>>>
>>>> Good morning Julian,
>>>>
>>>> Can you help me with plotting some resting state EEG signals? I am new
>>>> in Fieldtrip and I dont find clear information about this topic and I dont
>>>> really know how to do plottings in Fieldtrip. I feel like the fieldtrip
>>>> documentation is a little bit weak....
>>>>
>>>> Thank you in advance,
>>>> Best regards,
>>>>
>>>> Irene Varela
>>>>
>>>> El vie., 4 ene. 2019 a las 14:08, Julian Keil (<julian.keil at gmail.com>)
>>>> escribió:
>>>>
>>>>> Hi Irene,
>>>>>
>>>>> what is the reason to use the extra checkdata step?
>>>>> The function checks if the input data has the correct „datatype“ field.
>>>>> Since you probably don’t have that field, the function will throw an
>>>>> error.
>>>>>
>>>>> Also, I’d recommend using the eeglab2fieldtrip-function to get from
>>>>> EEGlab .set to a fieldtrip-like structure.
>>>>>
>>>>> Best,
>>>>>
>>>>> Julian
>>>>>
>>>>>
>>>>> Am 04.01.2019 um 12:47 schrieb Irene Varela Leniz <
>>>>> irene.varela at alumni.mondragon.edu>:
>>>>>
>>>>> Hi,
>>>>>
>>>>> I am a researcher in Mondragon University working on source
>>>>> reconstruction of EEG data. I am new at fieldtrip and I feel a little bit
>>>>> lost about this software. I have some errors in a code I have developed but
>>>>> I do not manage to solve them. Could you please help me?
>>>>>
>>>>> I want to plot EEG data of a channel called 'A1' which is the first
>>>>> row in a 2D matrix variable called data, which is inside EEG structure. The
>>>>> code I have developed is below and I get the following error:
>>>>>
>>>>> *Error using ft_checkdata (line 525)*
>>>>> *This function requires 'timelock' or 'freq' data as input, see
>>>>> ft_datatype_timelock or ft_datatype_freq.*
>>>>>
>>>>> The code is the following:
>>>>> *clc; clear all; close all;*
>>>>> *clear variables*
>>>>> *restoredefaultpath;  % set a clean path*
>>>>> *main='E:\';*
>>>>> *cd='E:\fieldtrip-20181217'; % change this*
>>>>> *addpath(cd);*
>>>>>
>>>>> *ft_defaults;*
>>>>> *filename = "E:\PBLdata\O200_RS1_final.set"; %cambiar aqui y poner
>>>>> vuestro directorio*
>>>>> *load(filename, '-mat'); %Create EEG struct*
>>>>> *location = EEG.chanlocs;*
>>>>> *data = EEG.data; *
>>>>>
>>>>> *cfg = [];*
>>>>> *cfg.xlim = [-0.2 1.0];*
>>>>> *cfg.ylim = [-1e-13 3e-13];*
>>>>> *cfg.channel = 'A1';*
>>>>> *datos = data(1,:);*
>>>>> *Ndata = numel(datos);*
>>>>> *for i=1:Ndata*
>>>>> *  % check if the input data is valid for this function*
>>>>> *  datos(i) = ft_checkdata(datos(i), 'datatype', {'timelock',
>>>>> 'freq'});*
>>>>> *end*
>>>>>
>>>>> *figure; ft_singleplotER(cfg,datos);*
>>>>>
>>>>> Thank you in advance,
>>>>>
>>>>> Irene
>>>>>
>>>>> _______________________________________________
>>>>> fieldtrip mailing list
>>>>> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>>>> https://doi.org/10.1371/journal.pcbi.1002202
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> fieldtrip mailing list
>>>>> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>>>> https://doi.org/10.1371/journal.pcbi.1002202
>>>>>
>>>> _______________________________________________
>>>> fieldtrip mailing list
>>>> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>>> https://doi.org/10.1371/journal.pcbi.1002202
>>>>
>>>>
>>>> _______________________________________________
>>>> fieldtrip mailing list
>>>> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>>> https://doi.org/10.1371/journal.pcbi.1002202
>>>>
>>> _______________________________________________
>>> fieldtrip mailing list
>>> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>> https://doi.org/10.1371/journal.pcbi.1002202
>>>
>>
>>
>> --
>> Alexis Pérez-Bellido, PhD
>> Donders Institute for Brain, Cognition and Behavior, Nijmegen, Netherlands
>> Prediction & Attention group
>> web: https://www.predictivebrainlab.com/ <http://www.predatt.com/>
>> gmail: alexisperezbellido at gmail.com
>> skype: alexisperezbellido
>>
>>
>> _______________________________________________
>> fieldtrip mailing list
>> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>> https://doi.org/10.1371/journal.pcbi.1002202
>>
> _______________________________________________
> fieldtrip mailing list
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> https://doi.org/10.1371/journal.pcbi.1002202
>


-- 
Alexis Pérez-Bellido, PhD
Donders Institute for Brain, Cognition and Behavior, Nijmegen, Netherlands
Prediction & Attention group
web: https://www.predictivebrainlab.com/ <http://www.predatt.com/>
gmail: alexisperezbellido at gmail.com
skype: alexisperezbellido
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20190107/29f2964a/attachment-0002.html>


More information about the fieldtrip mailing list