megplanar input structure

Akiko Ikkai akiko at NYU.EDU
Mon Sep 20 23:54:46 CEST 2010


Hello,

I'm trying to calculate the planar gradient for my MEG data. I have 2 questions:

1. in tutorial "Event related averaging and planar gradient", (ft_)megplanar appears to call for averaged data created with cfg.keeptrials = 'no'; (how it was calculated earlier in the page), which looks like: (from tutorial)

avgFIC =
         avg: [149x900 double]
         var: [149x900 double]
     fsample: 300
  numsamples: [77x1 double]
        time: [1x900 double]
         dof: [149x900 double]
       label: {149x1 cell}
      dimord: 'chan_time'
        grad: [1x1 struct]
         cfg: [1x1 struct]

However, megplanar looks for data.trial (e.g. line 252). If I feed in averaged data with  cfg.keeptrials = 'yes'; input structure looks like: (from my data, after timelockanalysis with cfg.keeptrials = 'yes';)

timelock =

        avg: [156x751 double]
        var: [156x751 double]
    fsample: 500
       time: [1x751 double]
        dof: [156x751 double]
      label: {1x156 cell}
      trial: [72x156x751 double]
     dimord: 'rpt_chan_time'
        cfg: [1x1 struct]

However, data.trial is matrix instead of cell structure, as megplanar requires (e.g. line 505:
interp.trial{i} = transform * data.trial{i}(dataindx,:);  ), it crashes here.

Also in tutorial, it appears that the sequence of analysis is ft_megplanar -> ft_timelockanalysis -> ft_combineplanar, where I suspect ft_timelockanalysis should be before calculating planar gradients...?


2. How to deal with bad channels in calculating planar gradient? It is suggested that we do preprocessing, timelockanalysis, megplanar and combineplanar. However, if I have bad channels and reject them in preprocessing, combineplanar crashes @ line 326

 if all(size(orig.pnt)==[302 3]) && ...
    all(size(orig.pnt)==[302 3]) && ...
    all(size(orig.tra)==[302 302]) && ...
    length(orig.label)==302 && ...
    all(sum(orig.tra~=0,1)>2)

because length(orig.label) is not going to be 302. Could I simply change these lines to something like:

if all(size(orig.pnt)==[length(orig.label) 3]) && ...
    all(size(orig.pnt)==[length(orig.label) 3]) && ...
    all(size(orig.tra)==[length(orig.label) length(orig.label)]) && ...
    all(sum(orig.tra~=0,1)>2)


If anyone could clarify these issues, I'd greatly appreciate it.
Thanks in advance! Akiko

----------------------------------
The aim of this list is to facilitate the discussion between users of the FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip.



More information about the fieldtrip mailing list