[FieldTrip] error when converting from spm to ft

Duncan Astle Duncan.Astle at mrc-cbu.cam.ac.uk
Thu Nov 15 19:24:39 CET 2012


Word up Zita,

Try this(replacing the filename for the file you want):

D1 = spm_eeg_load('/imaging/as05/EEG data/Load3Easy_TF/wmrtf_efMMspm8_raw_0001');
l3e1=D1.fttimelock;
l3e1.dimord='chan_freq_time';
l3e1.powspctrm = squeeze(D1.fttimelock.powspctrm);

Extra tip: you first need to separate your conditions such that you have an SPM file for each subject for each condition........

Let me know how you get on,
D.
________________________________________________
Dr. Duncan Astle,
Programme Leader Track,
British Academy Research Fellow,
MRC Cognition and Brain Sciences Unit,
Chaucer Road,
Cambridge.
Duncan.Astle at mrc-cbu.cam.ac.uk

From: fieldtrip-bounces at science.ru.nl [mailto:fieldtrip-bounces at science.ru.nl] On Behalf Of Zita Eva Patai
Sent: 15 November 2012 17:04
To: FieldTrip discussion list
Subject: Re: [FieldTrip] error when converting from spm to ft

Dear Jörn,

Thank you for the quick reply. I will try your suggestion!

Many thanks,
z
On Thu, Nov 15, 2012 at 2:55 PM, "Jörn M. Horschig" <jm.horschig at donders.ru.nl<mailto:jm.horschig at donders.ru.nl>> wrote:
Dear Zita,

The function seems to convert the function not correctly to a freq datastructure - it seems more like raw data to me.

freq data requires a .powspctrm field, which should be a matrix of observations x channels x freq x time. So you would need to use cell2mat on your .trial field. Probably you need to permute the dimensions to match this order. Additionally, you will need a .dimord field which which should be 'rpt_chan_freq_time' and you need a .freq field that contains the frequencies in that matrix. Please first make sure that your trials actually have 3 dimensions, else something else in the conversion went wrong.

I don't use SPM so no clue if there is a better way than doing it manually.

Best,
Jörn


On 11/14/2012 6:32 PM, Zita Eva Patai wrote:
Hello FT-ers

In the past i had no problem when converting my data from SPM (where i do preprocessing and averaging) to FT (where I do my cluster-stats and plotting)

Currently, I am using the new way to convert (previous version seems outdated 'nspm2ftrip') and I am hitting a wall: it says my data is not in the right format, ie: not freq data. But i know that it is...any advice would be much appreciated! Not to mention is warns me my data is not epoched when it is indeed so...

Thank you!
zita

*********************
>> D = spm_eeg_load
SPM M/EEG data object
Type: evoked
Transform: TF
8 conditions
326 channels
20 frequencies
501 samples/trial
8 trials
Sampling frequency: 250 Hz
Loaded from file  C:\Users\Eva Z Patai\Documents\MATLAB\epoched_data\tf\rmtf_rs01_timecorr.mat

Use the syntax D(channels, frequencies, samples, trials) to access the data
Type "methods('meeg')" for the list of methods performing other operations with the object
Type "help meeg/method_name" to get help about methods

>> data = spm2ft(D)

mapping condition label "11" to condition code 1
mapping condition label "12" to condition code 2
mapping condition label "21" to condition code 3
mapping condition label "22" to condition code 4
mapping condition label "31" to condition code 5
mapping condition label "32" to condition code 6
mapping condition label "41" to condition code 7
mapping condition label "42" to condition code 8

data =

      fsample: 250.0000
        label: {326x1 cell}
         time: {1x8 cell}
        trial: {1x8 cell}
    trialinfo: [8x1 double]
          cfg: [1x1 struct]


>> data2 = ft_checkdata(data, 'datatype', 'freq')

Warning: the data does not contain a trial definition, assuming that the trials are consecutive segments of a continuous recording
> In utilities\private\warning_once at 81
  In utilities\private\fixsampleinfo at 54
  In ft_datatype_raw at 91
  In ft_checkdata at 170
Error using ft_checkdata (line 288)
This function requires freq data as input.


--

Zita Patai
DPhil, Experimental Psychology
University of Oxford
bcl.psy.ox.ac.uk/people/zita-eva-patai/<http://bcl.psy.ox.ac.uk/people/zita-eva-patai/>




_______________________________________________

fieldtrip mailing list

fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl>

http://mailman.science.ru.nl/mailman/listinfo/fieldtrip




--

Jörn M. Horschig

PhD Student

Donders Institute for Brain, Cognition and Behaviour

Centre for Cognitive Neuroimaging

Radboud University Nijmegen

Neuronal Oscillations Group

FieldTrip Development Team



P.O. Box 9101

NL-6500 HB Nijmegen

The Netherlands



Contact:

E-Mail: jm.horschig at donders.ru.nl<mailto:jm.horschig at donders.ru.nl>

Tel:    +31-(0)24-36-68493<tel:%2B31-%280%2924-36-68493>

Web: http://www.ru.nl/donders



Visiting address:

Trigon, room 2.30

Kapittelweg 29

NL-6525 EN Nijmegen

The Netherlands

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



--

Zita Patai
DPhil, Experimental Psychology
University of Oxford
bcl.psy.ox.ac.uk/people/zita-eva-patai/<http://bcl.psy.ox.ac.uk/people/zita-eva-patai/>


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20121115/b7a697e0/attachment-0002.html>


More information about the fieldtrip mailing list