[FieldTrip] Unsupported data format

Schoffelen, J.M. (Jan Mathijs) jan.schoffelen at donders.ru.nl
Fri Jul 15 10:10:02 CEST 2016


Hi Rachel,

Once your data is represented in a fieldtrip-style structure, there’s no need anymore to call ft_definetrial with a specified named dataset in the cfg.

If you want to segment your data, you may still want to call ft_definetrial to generate a so-called ‘trl’ matrix, and subsequently use ft_redefinetrial to re-segment, i.e.:

load(’signal_raw.mat’); % I assume that this files contains the fieldtrip-style data structure

cfg = [];
cfg.trl = trl;
data_epoched = ft_redefinetrial(cfg, data);

So, note that ft_preprocessing shouldn’t be called, this is onlyl useable when reading proprietary data from disk.

It seems that you don’t need the cfg.dataset argument to begin with, and if you manage to titrate your ft_trialfun_test such that it converts the timestamps you provide it with into the correct trl-matrix, I don’t see a reason why it shouldn’t work.

Best,
Jan-Mathijs


On 15 Jul 2016, at 08:49, Nakyung Lee <rleese12 at berkeley.edu<mailto:rleese12 at berkeley.edu>> wrote:

Hi Arjen,

Thank you for your reply.
Your email got forwarded successfully.

So currently I tried using 'ft_definetrial' and 'ft_preprocessing'.
'ft_definetrial' returns an error when used with 'ft_trialfun' set to default.
Below is the code I used (and 'signal_raw.mat' is a fieldtrip raw data and it has all three fields you mentioned).

cfg.dataset = 'signal_raw.mat';
cfg.trialdef.event = subj_globals.buttonpress_times;
cfg = ft_definetrial(cfg);

So I simply call ft_definetrial with minimal configuration and here's the error I got:

Error using ft_read_header (line 2194)
unsupported header format "matlab"

Error in ft_trialfun_general (line 78)
hdr = ft_read_header(cfg.headerfile, 'headerformat', cfg.headerformat);

Error in ft_definetrial (line 177)
    [trl, event] = feval(cfg.trialfun, cfg);

Error in trialdef_alsotest (line 12)
cfg = ft_definetrial(cfg);

I circumvented this issue by using my own trialfun ('ft_trialfun_test' in the code).
We already have all the necessary timestamps so I could build a very simple one.
Here's a new code (I ran the code with minimal cfg for 'ft_preprocessing' to isolate the problem):

cfg.dataset = 'signal_raw.mat';
cfg.trialfun = 'ft_trialfun_test';
cfg.trialdef.event = subj_globals.buttonpress_times;

cfg = ft_definetrial(cfg);

cfg.continuous = 'yes';
buttonpress_hg = ft_preprocessing(cfg);

And here's the error I got:

Error using ft_read_header (line 2194)
unsupported header format "matlab"

Error in ft_preprocessing (line 397)
  hdr = ft_read_header(cfg.headerfile, 'headerformat', cfg.headerformat, 'coordsys', cfg.coordsys, 'coilaccuracy',
  cfg.coilaccuracy);

Error in test_trialdef (line 18)
buttonpress_hg = ft_preprocessing(cfg);

So both error come from 'ft_read_header'.
I've been looking at the code but it seemed quite hard to debug as 'ft_read_header' uses a lower level function that directly reads from the file (hence it seemed like a simple fix like passing in a fake header wouldn't work).
Am I doing something wrong here?

Again, thank you for your reply and let me know if you need more information.

Best,
Rachel

On Thu, Jul 14, 2016 at 12:10 AM, Arjen Stolk <a.stolk8 at gmail.com<mailto:a.stolk8 at gmail.com>> wrote:
Hi Rachel,

What is the error you're receiving, and how are you calling ft_preprocessing?

If the data is in raw format (incl a trial, time and label field), it should theoretically be possible to use ft_preprocessing on it, eg;
cfg = []
cfg ..
data = ft_preprocessing(cfg, raw)

where raw is your data as described above.

Best,
Arjen

> On Jul 13, 2016, at 11:50 PM, Nakyung Lee <rleese12 at berkeley.edu<mailto:rleese12 at berkeley.edu>> wrote:
>
> Dear FieldTrip community,
>
> My name is Rachel Lee and I'm a research assistant in Prof. Ming Hsu's lab in UC Berkeley.
>
> We currently have a .Tbk file, a .Tdx file, .tev file, .tsq file to preprocess and analyze but it seems like those data formats are not yet supported by FieldTrip.
> So, instead of using those raw data files, we've been trying to find a workaround by transforming them into a .mat file (and casting the .mat file into a raw datatype in FieldTrip by manually assigning fields to it).
> This hasn't been so successful; we've been unable to call ft_preprocessing because of the lack of a proper header format (which is needed in ft_read_header, one of the lower level functions that ft_preprocessing calls).
> I've been looking at the codes but been unable to come up with a solution.
>
> Does anyone have a similar experience?
> Is there any way to circumvent this issue?
> Any type of help would be appreciated.
>
> Thank you,
> Rachel Lee
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl>
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip

_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl>
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip

_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl>
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20160715/35093a23/attachment-0001.html>


More information about the fieldtrip mailing list