problem partially solved

Andrew Smart andrew.smart at NYU.EDU
Fri Apr 20 19:38:50 CEST 2007


Hi Jan,
Thank you for tip. I agree that it's not good to hack fieldtrip this way, and I would want to find another work around.

Thanks for the code too! I was wondering though I bring the *.tfc files from BESA into Fieldtrip for example:

for i=1:nsubj
  Prepgram{i} = besa2fieldtrip(filename_Prepgram{i});
  Prepungram{i} = besa2fieldtrip(filename_Prepungram{i});
end

This gives me a 1x10 cell arry with structures for each subject with the following fields:

time       <1x41>
freq        <1x24>
labelcmb  <4x2>
cohspctrm <4x24x41>
dimord     'chan_freq_time'
cfg           <1x1>

Now with your code:

Newlabel = cell(size(Prepgram{i}.labelcmb,1),1);
for j = 1:size(Prepgram{i}.labelcmb,1)
  Newlabel{j} = [Prepgram{i}.labelcmb{j,1},'_',Prepgram{i}.labelcmb{j,2}];
end

freq.labelold = freq.label;
Prepgram{i}.label    = Newlabel;

However this doesn't seem to create a label field in the structure associated to each subject. Am I missing something?

In our script we would like to test the coherence in one condition between one dipole and the other dipoles in the model, to see if there is significant coherence when taking all the subjects together. Or does this make sense? If there is significant coherence for each subject, does it make sense to look at this on a group level?

thanks!
andy


----- Original Message -----
From: Jan Mathijs Schoffelen <Jan.Schoffelen at FCDONDERS.RU.NL>
Date: Friday, April 20, 2007 7:41 am
Subject: Re: [FIELDTRIP] problem partially solved
To: FIELDTRIP at NIC.SURFNET.NL


> 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}];
> end
> freq.labelold = freq.label;
> freq.label    = newlabel;
>
> Hope this helps,
>
> Jan-Mathijs
>
>
>
> -----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
> To: FIELDTRIP at NIC.SURFNET.NL
> 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:
>
> to
>
> 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?
>
> andy
>
> ----- 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
> To: FIELDTRIP at NIC.SURFNET.NL
>
>
> > 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 <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