problem partially solved

Jan Mathijs Schoffelen Jan.Schoffelen at FCDONDERS.RU.NL
Fri Apr 20 13:40:53 CEST 2007

Dear Andy,

It seems as if you already solved the problem for your purpose. Anyway,
instead of making a hack in one of the (deep) fieldtrip functions, I would
rather change the frequency structure a bit before passing it to
freqstatistics. Typically what I do, is the following. Please note that this
workaround is ugly, but at present that's a way how it works.

In order to keep track of how to interpret the different channels in the
data, fieldtrip uses the field 'label', for which it assumes that the number
of labels is equal to the first dimension (when 'dimord' =
'chan_freq...etc'), or to the second dimension (when 'dimord' =
'rpt_chan_etc') of your parameter of interest. However, when you are indeed
interested in coherence, it's the field 'cohspctrm' which is the relevant
field, and for this, fieldtrip looks into 'labelcmb' to interpret which
channels have been used to compute coherence. If you put labelcmb on the
place of label (which you did in prepare_timefreq_data), but it's a
dangerous solution, because 'labelcmb' contains two columns and I guess the
fieldtrip-function which checks the labels only looks in the first column.
This potentially leads to double occurrences of some labels (for example if
for one reason or another your 'reference' channel is in the first column,
or if you have more than one reference channel). Therefore, I'd suggest to
'convert' the labelcmb into uniquely identifiable labels, by for example
concatenating the two labels in the pair:

Newlabel = cell(size(freq.labelcmb,1),1);
for j = 1:size(freq.labelcmb,1)
  Newlabel{j} = [freq.labelcmb{j,1},'_',freq.labelcmb{j,2}];
freq.labelold = freq.label;
freq.label    = newlabel;

Hope this helps,


-----Original Message-----
From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf
Of Andrew Smart
Sent: Thursday, April 19, 2007 9:44 PM
Subject: Re: [FIELDTRIP] problem partially solved

Hi Jan,
Thanks for the answer, everything works now ok.

I did follow this FIXME in freqstatistics

% FIXME in the hase of coherence, the code above does not work since "label"
is then incorrect.
% marbas reported the following
%   als ik freqstatistics gebruik om coherence data te analyseren met
%   cfg.parameter = coherence, dan wordt het powspctrm vervangen door
%   het cohspctrm. Het laatste heeft echter 1 kanaal minder (dwz als
%   er 1 referentiekanaal in zit), waardoor de informatie uit data.label
%   niet meer klopt, en freqstatistics crasht. Data.label zou, in geval
%   van cfg.parameter = coherence, moeten worden vervangen door
%   data.labelcmb(:,2), dan werkt het wel.

And I changed prepare_timefreq_data

output.label = input.label:


output.label  = input.labelcmb;

Otherwise fieldtrip crashes because the structure of the coherence data does
not have a label field, but a labelcmb with the coherence between channels
and the ref channel.

Is there a way to get fieldtrip to accomodate coherence structures?


----- Original Message -----
From: Jan Mathijs Schoffelen <jan.schoffelen at FCDONDERS.RU.NL>
Date: Thursday, April 19, 2007 3:22 pm
Subject: Re: [FIELDTRIP] problem partially solved

> Dear Andy,
> Please allow me to point you to the fact that fieldtrip has no
> restriction on the type of data you want to cohere. The rather mundane
> reason why the tutorial documentation on coherence is about
> cortico-muscular stuff, is related to the fact that the interpretation
> of cortico-muscular coherence is far more straightforward than the
> interpretation of coherence between EEG/MEG-channels, or between
> virtual electrodes/dipoles. However, the statistical routines don't
> care whether the coherence spectra you pass to them are between
> similar channels, or between dipole locations in the brain.
> Yours,
> Jan-Mathijs
> ----- Original Message -----
> From: Andrew Smart < at NYU.EDU>
> Date: Thursday, April 19, 2007 5:43 pm
> Subject: [FIELDTRIP] problem partially solved
> > Hi,
> > I found why I was getting the error
> > embarrassingly I had {i} instead of {:}!
> >
> > My general question remains about the possibility of doing
> > statistical group
> > analysis on coherence between BESA dipoles, or in source space in
> > general.
> > It seems most of the coherence analyses are set up to do coherence
> > betweenchannels and an external reference such as EMG.
> >
> > Thanks and sorry for all the messages!
> >
> > andy

More information about the fieldtrip mailing list