[FieldTrip] Help with definetrial for EGI .mff file

Varghese Mathew 1881002 varghese.mathew at res.christuniversity.in
Wed Apr 26 20:20:16 CEST 2023


Thank you so much. I was able to find out the eventtype and event value and
this has helped in proceeding with the analysis.
Looking forward to the analysis.

Sincerely


On Mon, Apr 24, 2023 at 6:13 PM Schoffelen, J.M. (Jan Mathijs) via
fieldtrip <fieldtrip at science.ru.nl> wrote:

> apologies for the multiple postings: i made a typo in my previous message:
> the line that reads ’ft_trialfun_general’, should of course read
> ’ft_trialfun_show’.
>
> Best wishes,
> Jan-Mathijs
>
>
> On 24 Apr 2023, at 14:31, Jan Mathijs Schoffelen <
> janmathijs.schoffelen at donders.ru.nl> wrote:
>
> Hi Mathew,
>
> Thanks for the additional information.
>
> Note that ft_definetrial/ft_trialfun_general will only work according to
> expectation if eventtype and eventvalue are correctly specified. Their
> correct specification depends on how the events and their values are
> represented in the data file. This is something I don’t know for the format
> you use, but it could be that ’stim’ should read ’Stim’, and/or that the
> event values ahould be numeric( e.g., [1 2 3 4], rather than {’01’ ’02’
> ’03’ ’04’}. If you are unsure about how values/types should be defined for
> your data, you should use the ft_trialfun_show function:
>
>
> datapath='E:\FT\OFP1.mff'
> EGIformat= 'egi_mff_v3'
> cfg = [];
> cfg.dataset = datapath;
> cfg.dataformat = EGIformat
> cfg.headerformat = EGIformat
> cfg.trialfun = 'ft_trialfun_general’;
> cfg=ft_definetrial(cfg);
>
>
> This will give you some feedback on the screen, which you can use for a
> properly formatted call to ft_definetrial with trialfun
> = ‘ft_trialfun_general’
>
> Good luck,
> Jan-Mathijs
>
> On 22 Apr 2023, at 06:33, Varghese Mathew 1881002 <
> varghese.mathew at res.christuniversity.in> wrote:
>
> Thank you so much for the response.
> I have tried using ft_trialfun_general in the following code
> datapath='E:\FT\OFP1.mff'
> EGIformat= 'egi_mff_v3'
> cfg = [];
> cfg.dataset = datapath;
> cfg.dataformat = EGIformat
> cfg.headerformat = EGIformat
> cfg.trialdef.eventtype = 'stim';
> cfg.trialdef.prestim = 1;
> cfg.trialdef.poststim =1;
> cfg.trialdef.eventvalue = {'01''02''03''04'};
> cfg.trialfun = 'ft_trialfun_general';
> cfg = ft_definetrial(cfg)
>
> I am getting a following response
>
> Error using ft_definetrial
> no trials were defined, see FT_DEFINETRIAL for help
>
> This made me think if I should change the trialfun_general. Is there
> something I have missed and also is there any standard format to define
> trials on Netstation files (.mff)?
>
> Thank you again for the response.
>
> Sincerely
> Varghese Mathew
>
>
> On Wed, Apr 19, 2023 at 11:12 PM Schoffelen, J.M. (Jan Mathijs) via
> fieldtrip <fieldtrip at science.ru.nl> wrote:
>
>> Hi Mathew,
>>
>> I am a bit surprised that you think that you need to adjust the
>> ft_trialfun_general. The idea is that this function is quite generic, and
>> given the scenario that you sketch, you probably don’t need to change any
>> fieldtrip function. The partial error that you report is difficult to
>> evaluate, since it’s only partial. Right now it’s just random guessing as
>> to what might be going on. The error looks as if MATLAB tries to access a
>> structure’s field called headerfile, but for some reason in does not exist
>> in the struct that it is evaluating.
>>
>> for instance, if you define on the matlab command line the following
>> struct:
>>
>> x.a = 1;
>>
>> and then query x.b, you get the error you report.
>>
>> What is the full error stack, i.e. which line in which matlab function is
>> throwing the error?  And what is the code that you try to execute (i.e. the
>> specification of the cfg, and the fieldtrip function you are calling).
>>
>> Good luck,
>> Jan-Mathijs
>>
>>
>> On 19 Apr 2023, at 16:27, Varghese Mathew 1881002 via fieldtrip <
>> fieldtrip at science.ru.nl> wrote:
>>
>> Hi
>> I am doing analysis on Netstation EGI .mff file using Fieldtrip, I have
>> tried using .mff file directly and after converting to EDF. However, I am
>> getting error in defining trials. Mostly I get an error message  Unrecognized
>> field name "headerfile"  .
>> I would like to know how to go about this in EDF or .mff format.
>> It will also be helpful if someone can help with how to modify
>> ft_trialfun_general for .mff file as well.
>> I am pasting the code I used, below.
>> cfg=[]
>> cfg.dataset = 'E:\FT\OP17.mff';
>> cfg.dataformat = 'egi_mff_v3'
>> cfg.headerformat = 'egi_mff_v3'
>> cfg.trialdef.eventtype = 'stim';
>> cfg.trialdef.prestim = 1;
>> cfg.trialdef.poststim =1;
>> cfg.trialdef.eventvalue = {'01''02''03''04'};
>> cfg.trialfun = 'ft_trialfun_general_stimmod';
>> cfg = ft_definetrial(cfg)
>>
>>
>> For modifying trialfun_general
>>
>> function [trl, event] = ft_trialfun_general_stimmod(cfg)
>> event = ft_read_event(cfg.dataset, 'headerformat', 'egi_mff_v3');
>> % Find trigger values
>> trigger = [event(strcmp('stim', {event.type})).value]';
>> % Note: Replace 'STI101' with the label of the trigger channel that
>> % contains the trigger values for your data
>> % Define trial segments
>> trl = [];
>> for j = 1:length(trigger)
>> if any(trigger(j) == [01 02 03 04])
>> trlbegin = event(j).sample;
>> trlend = trlbegin + 1000; % define trial length as 1 second
>> offset = 0; % no offset
>> newtrl = [trlbegin trlend offset trigger(j)];
>> trl = [trl; newtrl];
>> end
>> end
>> Please help with the issue, as I am trying to pick up analysis using
>> Fieldtrip and I do not have a coding background.
>> Looking forward for a response,
>>
>> Sincerely
>> --
>> Varghese Mathew
>>
>> _______________________________________________
>> fieldtrip mailing list
>> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>
>> https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!8eNI3v7br-aNv3JFKJb7V4Q_aWWLR3pG3xSWq653eKc8M3szkc7gmh51AkzytjbLsNllQtMkOdF4QKsVIokOhTwtxZRljnjlhEkwJA$
>>
>>
>> _______________________________________________
>> fieldtrip mailing list
>> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>> https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!51zCYkAFZoqmWL9eer8ycUfaK7yAxppbGAdqlDDqNJKsJF_MSdudTtoyv-xxwSGGryAXHcc87pmsUrsRHBILnCGZkWJIrbi0HR1aKdrXGHci$ 
>> <https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!790wNYAs95ncJkCxJN-Y7IW-_m8uyJL3R275Ib_u1vRGM4SrI4E9u_Z4hEWrprE2g27wPafiw_1TM10Qp0p9qRfsq3NgKIZmbUafB6YShGYSfqIKGH2GJw$>
>>
>
>
> --
> Varghese Mathew
> Mobile No. 9535395896
>
>
>
> _______________________________________________
> fieldtrip mailing list
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!51zCYkAFZoqmWL9eer8ycUfaK7yAxppbGAdqlDDqNJKsJF_MSdudTtoyv-xxwSGGryAXHcc87pmsUrsRHBILnCGZkWJIrbi0HR1aKdrXGHci$ 
>


-- 
Varghese Mathew
Mobile No. 9535395896
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20230426/34ff6d15/attachment.htm>


More information about the fieldtrip mailing list