[FieldTrip] Appending data.grad, after using D.ftraw(0)

George Wallis wallisgj at gmail.com
Mon Sep 10 18:21:36 CEST 2012


Hi Stephan,

Thanks very much for your reply (and sorry for not replying to the thread;
I get a digest, and couldn't figure out how to reply to an individual
message).  So, SPM will produce an outdated .grad format, which can be
corrected.

There is one thing I don't get, which is why ft_chantype looks for the
older fields, viz:

*isgrad   = isa(input, 'struct') && isfield(input, 'pnt') &&
isfield(input, 'ori');*


It seems like the function ft_chantype is called from, ft_datatype_sens,
automatically corrects the old grad format before passing the structure
(now called 'sens') to ft_chantype:

% sensor description is a MEG sensor-array, containing oriented coils
[chanpos, chanori, chanlab] = channelposition(sens, 'channel', 'all');
sens.coilori = sens.ori; sens = rmfield(sens, 'ori');
sens.coilpos = sens.pnt; sens = rmfield(sens, 'pnt');
sens.chanpos = chanpos;
sens.chanori = chanori;

Did the new format not propagate through?

best wishes,
George


On Mon, Sep 10, 2012 at 2:55 PM, <fieldtrip-request at science.ru.nl> wrote:

> Send fieldtrip mailing list submissions to
>         fieldtrip at science.ru.nl
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> or, via email, send a message with subject or body 'help' to
>         fieldtrip-request at science.ru.nl
>
> You can reach the person managing the list at
>         fieldtrip-owner at science.ru.nl
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of fieldtrip digest..."
>
>
> Today's Topics:
>
>    1. about overlap in PSD calculation (Ivano Triggiani)
>    2. real-value spatial filter from FFT dipole localization?
>       (Bj?rn Herrmann)
>    3. Appending data.grad, after using D.ftraw(0) (George Wallis)
>    4. Re: Appending data.grad, after using D.ftraw(0)
>       (smoratti at psi.ucm.es)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Mon, 10 Sep 2012 11:27:09 +0100 (BST)
> From: Ivano Triggiani <ivano_triggiani at yahoo.it>
> To: "fieldtrip at science.ru.nl" <fieldtrip at science.ru.nl>
> Subject: [FieldTrip] about overlap in PSD calculation
> Message-ID:
>         <1347272829.31720.YahooMailNeo at web133103.mail.ir2.yahoo.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi all.
>
> How can I obtain informations about the kind of overlapping performed by
> fiedltrip implemented method to obtain a Power Spectral Density ?
>
> I need to compare fieldtrip PSD with another spectral density, so I need
> to be sure of everything. I found docs about tapering, but I don't
> understand if using a kind of tapering the overlapping is given.
> Ivano
>
> ?
> ------------------------------------------------------------------------
>
>
>
>
> "No man can wear one face to himself
> and another to the multitude,
> without finally getting bewildered
> as to which one is true."
>
>
> Nathaniel Hawthorne
>
>
> ________________________________
>  Da: "fieldtrip-request at science.ru.nl" <fieldtrip-request at science.ru.nl>
> A: fieldtrip at science.ru.nl
> Inviato: Luned? 10 Settembre 2012 12:00
> Oggetto: fieldtrip Digest, Vol 22, Issue 17
>
> Send fieldtrip mailing list submissions to
> ??? fieldtrip at science.ru.nl
>
> To subscribe or unsubscribe via the World Wide Web, visit
> ??? http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> or, via email, send a message with subject or body 'help' to
> ??? fieldtrip-request at science.ru.nl
>
> You can reach the person managing the list at
> ??? fieldtrip-owner at science.ru.nl
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of fieldtrip digest..."
>
>
> Today's Topics:
>
> ?  1. Using WPLI od WPLI-debiased to do the coherence analysis
> ? ? ? (sahand babapoor)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Sun, 9 Sep 2012 20:49:31 -0400
> From: sahand babapoor <sahand.babapoor at gmail.com>
> To: fieldtrip at science.ru.nl
> Subject: [FieldTrip] Using WPLI od WPLI-debiased to do the coherence
> ??? analysis
> Message-ID:
> ??? <CAPWLZVVY9oDYS9NuRceBvK0-++PcRe5p-Ni88+afmVdEMxa_1A at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi all,
>
> I am trying to do coherency analysis between ACC and FEF. I have tried both
> WPLI and WPLI-debiased methods to do the analysis. When I am using WPLI I
> find a very nice coherence pattern between ACC and FEF in the frequencies
> between ~11Hz to 20 Hz. However, when I am using WPLI-debiased method, the
> previous WPLI coherence pattern disappears and? breaks into many sparse
> clusters across many time points and frequencies. Is there a way to know
> which method is the best for me. I should note that I am recording using
> tungsten microelectrodes advanced into the brain. I would appreciate if
> your help.
>
> Best,
> Sahand
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20120909/2a47bbc7/attachment-0001.html
> >
>
> ------------------------------
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
> End of fieldtrip Digest, Vol 22, Issue 17
> *****************************************
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20120910/448a5494/attachment-0001.html
> >
>
> ------------------------------
>
> Message: 2
> Date: Mon, 10 Sep 2012 13:16:09 +0200 (CEST)
> From: Bj?rn Herrmann <bherrmann at cbs.mpg.de>
> To: fieldtrip at science.ru.nl
> Subject: [FieldTrip] real-value spatial filter from FFT dipole
>         localization?
> Message-ID: <1396322041.3317.1347275769488.JavaMail.root at zimbra>
> Content-Type: text/plain; charset=utf-8
>
> Dear fieldtrip users,
>
> maybe someone can point me in the right direction. I try to obtain a
> spatial filter from localizing the sources of an auditory 3Hz peak in my
> FFT spectrum. I would like to apply the filter to my single trial real
> data, i.e. basically reducing my 204 gradiometer channels (neuromag system)
> to one or two channels in source space.
> I was using DICS beamformer and cfg.realfilter = 'yes' but the source
> localization results (NAI) looked not too well compared to the nice
> auditory gradiometer topographies.
> I then used ft_dipolefitting, however, I have trouble understanding the
> output. This is where I wondered whether someone could help me, in telling
> whether it is possible to obtain a real-value spatial filter from this:
>
> source =
>      label: {204x1 cell}
>        dip: [1x1 struct]
>      Vdata: [204x408 double]
>     Vmodel: [204x408 double]
>       freq: 3
>     dimord: 'chan_freq'
>       grad: [1x1 struct]
>        cfg: [1x1 struct]
>
> source.dip =
>         pos: [2x3 double]
>         mom: [6x408 double]
>         pot: [204x408 double]
>          rv: [1x408 double]
>         pow: 2.7948e+18
>         csd: [6x6 double]
>     fourier: [6x204 double]
>
> I would appreciate helping comments, as I tested the different methods for
> some time now, but was unable to extract a reasonable real-value spatial
> filter for my auditory cortex activations.
>
> Best regards,
>
> Bj?rn
>
>
>
>
>
> ------------------------------
>
> Message: 3
> Date: Mon, 10 Sep 2012 13:22:20 +0100
> From: George Wallis <wallisgj at gmail.com>
> To: fieldtrip at science.ru.nl
> Subject: [FieldTrip] Appending data.grad, after using D.ftraw(0)
> Message-ID:
>         <
> CADqk8UgZ-wUf-FAjLL9K0hScW6ZTWrOVJKaR0S+PVhvuKx31-w at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Dear fieldtrippers,
>
> if anyone can help me with this I'd be very grateful!
>
> I have a bunch of preprocessed and epoched data files in SPM format, and
> I'm converting them to fieldtrip format using the following:
>
> D  = spm_eeg_load(fn);
> data = D.ftraw(0);
>
> ...which results in...
>
> data =
>
>     fsample: 250
>       label: {350x1 cell}
>       trial: {1x360 cell}
>        time: {1x360 cell}
>
> Comparing this to data structures generated using fieldtrip alone, field
> like data.grad are missing.
>
> I can create something like a grad field by doing:
>
> D.sensors('MEG')
>
> ans =
>
>       pnt: [510x3 double]
>       ori: [510x3 double]
>       tra: [306x510 double]
>      unit: 'mm'
>     label: {306x1 cell}
>
> If I then append this to the data:
>
> data.grad = D.sensors('MEG');
>
> I get an error:
>
> ---
>
> Error using ft_chantype (line 56)
> the input that was provided to this function cannot be deciphered
>
> Error in ft_datatype_sens (line 128)
>         sens.chantype = ft_chantype(sens);
>
> Error in ft_datatype_raw (line 99)
>       data.grad = ft_datatype_sens(data.grad);
>
> Error in ft_checkdata (line 177)
>   data = ft_datatype_raw(data, 'hassampleinfo', hassampleinfo);
>
> Error in ft_timelockanalysis (line 134)
> data = ft_checkdata(data, 'datatype', {'raw', 'comp'}, 'feedback', 'yes',
> 'hassampleinfo',
> 'yes');
>
> Error in ft_SENS_ERF_grRep (line 82)
>             avdat = ft_timelockanalysis(cfg,raw);
>
> ---
>
> ...when I try to do timelockanalysis on this data.  If I leave the grad
> field off (i.e. not append it to the output of ftraw(0)) there's no
> problem, and the analysis runs fine.  However, because I want to do spatial
> neighbour cluster analysis later, I think I need the .grad field, so I
> might as well get it incorporated at this stage.
>
> Going a bit further into the error messages above, the function
> ft_datatype_sens appears to convert the old format .ori, .pnt into the
> newer .coilori, .coilpos ... etc.  But the next function in the chain,
> ft_chantype, looks for .pnt and .ori when doing:
>
> isgrad   = isa(input, 'struct') && isfield(input, 'pnt') && isfield(input,
> 'ori');
>
> I'm wondering if this could be the problem?
>
> Sorry for the long message!  I'd be very grateful if anyone can help out.
>
> Best wishes,
> George
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20120910/8418e2de/attachment-0001.html
> >
>
> ------------------------------
>
> Message: 4
> Date: Mon, 10 Sep 2012 15:55:26 +0200
> From: "smoratti at psi.ucm.es" <smoratti at psi.ucm.es>
> To: FieldTrip discussion list <fieldtrip at science.ru.nl>
> Subject: Re: [FieldTrip] Appending data.grad, after using D.ftraw(0)
> Message-ID: <44D6E4E8-E44D-4D08-B012-C3B506F6E935 at psi.ucm.es>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Dear George,
>
> Your approach was right, and it would have worked with older versions of
> field trip. Now in field trip the grad field contents have changed a little
> bit.
>
> Now it contains
>
> balance: [1x1 struct]
>      chanori: [306x3 double]
>      chanpos: [306x3 double]
>     chantype: {306x1 cell}
>     chanunit: {306x1 cell}
>      coilori: [510x3 double]
>      coilpos: [510x3 double]
>        label: {306x1 cell}
>          tra: [306x510 double]
>         unit: 'cm'
>
> so the field put would be chanpos, ori would be chanori (or coilpos/
> coilori depending on your MEG system).
>
> So check this out and you can easily adapt the structure. I think SPM does
> not go with the ?ltimate field trip version.
>
> I hope this helps,
>
> best,
>
> Stephan
>
> ________________________________________________________
> Stephan Moratti, PhD
>
> see also: http://web.me.com/smoratti/
>
> Universidad Complutense de Madrid
> Facultad de Psicolog?a
> Departamento de Psicolog?a B?sica I
> Campus de Somosaguas
> 28223 Pozuelo de Alarc?n (Madrid)
> Spain
>
> and
>
> Center for Biomedical Technology
> Laboratory for Cognitive and Computational Neuroscience
> Parque Cient?fico y Tecnol?gico de la Universidad Politecnica de Madrid
> Campus Montegancedo
> 28223 Pozuelo de Alarc?n (Madrid)
> Spain
>
>
> email: smoratti at psi.ucm.es
> Tel.:    +34 679219982
>
> El 10/09/2012, a las 14:22, George Wallis escribi?:
>
> > Dear fieldtrippers,
> >
> > if anyone can help me with this I'd be very grateful!
> >
> > I have a bunch of preprocessed and epoched data files in SPM format, and
> I'm converting them to fieldtrip format using the following:
> >
> > D  = spm_eeg_load(fn);
> > data = D.ftraw(0);
> >
> > ...which results in...
> >
> > data =
> >
> >     fsample: 250
> >       label: {350x1 cell}
> >       trial: {1x360 cell}
> >        time: {1x360 cell}
> >
> > Comparing this to data structures generated using fieldtrip alone, field
> like data.grad are missing.
> >
> > I can create something like a grad field by doing:
> >
> > D.sensors('MEG')
> >
> > ans =
> >
> >       pnt: [510x3 double]
> >       ori: [510x3 double]
> >       tra: [306x510 double]
> >      unit: 'mm'
> >     label: {306x1 cell}
> >
> > If I then append this to the data:
> >
> > data.grad = D.sensors('MEG');
> >
> > I get an error:
> >
> > ---
> >
> > Error using ft_chantype (line 56)
> > the input that was provided to this function cannot be deciphered
> >
> > Error in ft_datatype_sens (line 128)
> >         sens.chantype = ft_chantype(sens);
> >
> > Error in ft_datatype_raw (line 99)
> >       data.grad = ft_datatype_sens(data.grad);
> >
> > Error in ft_checkdata (line 177)
> >   data = ft_datatype_raw(data, 'hassampleinfo', hassampleinfo);
> >
> > Error in ft_timelockanalysis (line 134)
> > data = ft_checkdata(data, 'datatype', {'raw', 'comp'}, 'feedback',
> 'yes', 'hassampleinfo',
> > 'yes');
> >
> > Error in ft_SENS_ERF_grRep (line 82)
> >             avdat = ft_timelockanalysis(cfg,raw);
> >
> > ---
> >
> > ...when I try to do timelockanalysis on this data.  If I leave the grad
> field off (i.e. not append it to the output of ftraw(0)) there's no
> problem, and the analysis runs fine.  However, because I want to do spatial
> neighbour cluster analysis later, I think I need the .grad field, so I
> might as well get it incorporated at this stage.
> >
> > Going a bit further into the error messages above, the function
> ft_datatype_sens appears to convert the old format .ori, .pnt into the
> newer .coilori, .coilpos ... etc.  But the next function in the chain,
> ft_chantype, looks for .pnt and .ori when doing:
> >
> > isgrad   = isa(input, 'struct') && isfield(input, 'pnt') &&
> isfield(input, 'ori');
> >
> > I'm wondering if this could be the problem?
> >
> > Sorry for the long message!  I'd be very grateful if anyone can help out.
> >
> > Best wishes,
> > George
> > _______________________________________________
> > fieldtrip mailing list
> > fieldtrip at donders.ru.nl
> > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20120910/444962f9/attachment.html
> >
>
> ------------------------------
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
> End of fieldtrip Digest, Vol 22, Issue 18
> *****************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20120910/cc384c59/attachment.html>


More information about the fieldtrip mailing list