[FieldTrip] ft_mvaranalysis

Tyler Grummett tyler.grummett at flinders.edu.au
Thu Jun 5 11:36:57 CEST 2014


Hey jorn,

Yeah I tried that, I entered in specific grid points into the leadfield.

The rank was still 37 ( out of 116), I still cant really work it out haha.

Tyler

*************************

Tyler Grummett ( BBSc, BSc(Hons I))
PhD Candidate
Brain Signals Laboratory
Flinders University
Rm 5A301
Ext 66124

________________________________________
From: fieldtrip-bounces at science.ru.nl <fieldtrip-bounces at science.ru.nl> on behalf of "Jörn M. Horschig" <jm.horschig at donders.ru.nl>
Sent: Thursday, 5 June 2014 7:02 PM
To: FieldTrip discussion list
Subject: Re: [FieldTrip] ft_mvaranalysis

Hola,

did you read some tutorials on virtual channel extraction? If you follow
this one:
http://fieldtrip.fcdonders.nl/tutorial/connectivity#connectivity_between_meg_virtual_channel_and_emg
You might want to get to where you want. With 'voxel' I basically meant
source activity at a specific gridpoint. For some people, fMRI
terminology is easier to grasp ;)

Best,
Jörn

On 6/5/2014 2:20 AM, Tyler Grummett wrote:
> Hey Jorn,
>
> First off, thank you and you are a champ.
>
> I am trying to create a virtual channel for each area of the brain using an atlas.
>
> Originally I was doing the following to get my grid:
>
>              % compute lead field ( apparently source analysis computes
>              % lead field anyway
>              cfg                 = [];
>              cfg.elec            = timelock.elec;
>              cfg.vol             = vol;
>              %             cfg.grid.resolution = 5;   % use a 3-D grid with a 5 mm resolution
>              %             cfg.grid.unit       = 'mm';
>              cfg.grid.xgrid = atlas_grid.xgrid;
>              cfg.grid.ygrid = atlas_grid.ygrid;
>              cfg.grid.zgrid = atlas_grid.zgrid;
>              %             cfg.dim = atlas_grid.dim;
>              %             cfg.pos = pos;
>              cfg.reducerank = 'yes'; % 3 for EEG, 2 for MEG
>              cfg.backproject = 'yes';
>              cfg.normalize = 'yes'; % if you are not contrasting the activity of interest again another condition or baseline time-window
>              grid = ft_prepare_leadfield( cfg);
>
> This generates a roughly 4800 dipoles in the brain. I then interpolate with the following code:
>
>              parameter = 'avg.pow';
>              cfg            = [];
>              cfg.downsample = 2;
>              cfg.parameter = parameter;
>              sourceInt  = ft_sourceinterpolate( cfg, source, mri);
>
> And it gives me a plot where the cross-hair is  outside the brain ( see attached).
> Ive made sure each step is using the MNI coordinate system.
>
> I honestly dont know how to create voxels, and how that would translate into channels.
>
> Kind regards,
>
> Tyler
>
> *************************
>
> Tyler Grummett ( BBSc, BSc(Hons I))
> PhD Candidate
> Brain Signals Laboratory
> Flinders University
> Rm 5A301
> Ext 66124
>
> ________________________________________
> From: fieldtrip-bounces at science.ru.nl <fieldtrip-bounces at science.ru.nl> on behalf of "Jörn M. Horschig" <jm.horschig at donders.ru.nl>
> Sent: Wednesday, 4 June 2014 5:45 PM
> To: FieldTrip discussion list
> Subject: Re: [FieldTrip] ft_mvaranalysis
>
> Hi Tyler,
>
> ah I see, so the 'source'-structure you get from the beamforming serves
> to create the 'data'-structure to run mvaranalysis.
> cfg.reducerank in ft_prepare_leadfield does not reduce the rank of your
> data, it reduces the rank of leadfield dimensionality (a dipole has
> moments in 3 directions, x,y,z).
> The interpolation does not work for you, because you do not have a full
> 3D grid anymore but rather individual grid points. Of course one could
> interpolate, but it would be far from optimal, so FieldTrip refuses to
> do so (imagine you want to interpolate to a 2D grid, e.g. a square, but
> you only have a data point of the center of that 2D grid).
> Instead of using 116 gridpoints why not lump them together to regions of
> interest. That way you'd probably get only a handful of 'voxels', and
> you probably get rid of the rank deficiency. However,  I am not quite
> sure what you want to achieve with this analysis, so I am not sure
> whether I give adequate help advise ;)
>
> Best,
> Jörn
>
> On 6/4/2014 9:53 AM, Tyler Grummett wrote:
>> Hey Jorn,
>>
>> I was just checking to see if I was calculating the beamformer correctly.
>>
>> Long story short, I worked out X Y Z coordinates for brain regions using the AAL atlas, gave that to the leadfield and beamformer to only give me 116.
>> What this does it doesnt allow me to interpolate the data anymore (whereas previously I had approx 4000 because I was using the same Xgrid, Ygrid
>> and Zgrid as the atlas).
>>
>> I was trying to increase my rank (or decrease rank deficiency by changing my code).
>>
>> However, no matter what I have tried thus far, nothing has helped.
>>
>> Tyler.
>>
>> *************************
>>
>> Tyler Grummett ( BBSc, BSc(Hons I))
>> PhD Candidate
>> Brain Signals Laboratory
>> Flinders University
>> Rm 5A301
>> Ext 66124
>>
>> ________________________________________
>> From: fieldtrip-bounces at science.ru.nl <fieldtrip-bounces at science.ru.nl> on behalf of "Jörn M. Horschig" <jm.horschig at donders.ru.nl>
>> Sent: Wednesday, 4 June 2014 5:12 PM
>> To: FieldTrip discussion list
>> Subject: Re: [FieldTrip] ft_mvaranalysis
>>
>> Hi Tyler,
>>
>> I thought you are talking about mvaranalysis - why is the code you've
>> pasted about leadfields and lcmv beamforming?
>>
>> Best,
>> Jörn
>>
>> On 6/4/2014 3:15 AM, Tyler Grummett wrote:
>>> Jorn,
>>>
>>> There is an additional issue of interpolating the data and then plotting it with ft_sourceplot.
>>>
>>> I have hit a wall of issues haha
>>>
>>> Tyler
>>>
>>> *************************
>>>
>>> Tyler Grummett ( BBSc, BSc(Hons I))
>>> PhD Candidate
>>> Brain Signals Laboratory
>>> Flinders University
>>> Rm 5A301
>>> Ext 66124
>>>
>>> ________________________________________
>>> From: fieldtrip-bounces at science.ru.nl <fieldtrip-bounces at science.ru.nl> on behalf of Tyler Grummett <tyler.grummett at flinders.edu.au>
>>> Sent: Wednesday, 4 June 2014 10:11 AM
>>> To: FieldTrip discussion list
>>> Subject: Re: [FieldTrip] ft_mvaranalysis
>>>
>>> Hey Jorn,
>>>
>>> You were right, it was rank reduced. I tried changing that option that is used if ft_prepare_leadfield ( 'reducerank' = 'no'), but it didnt seem to work.
>>>
>>> My code is as follows: (I used an atlas to get the grid coordinates)
>>>
>>>                % compute lead field ( apparently source analysis computes
>>>                % lead field anyway
>>>                cfg                 = [];
>>>                cfg.elec            = timelock.elec;
>>>                cfg.vol             = vol;
>>>                cfg.grid.unit       = 'mm';
>>>                cfg.dim = atlas_grid.dim;
>>>                cfg.pos = pos;
>>>                cfg.reducerank = 'no'; % 3 for EEG, 2 for MEG
>>>                cfg.backproject = 'yes';
>>>                cfg.normalize = 'yes'; % if you are not contrasting the activity of interest again another condition or baseline time-window
>>>                grid = ft_prepare_leadfield( cfg);
>>>
>>>                % Source Analysis: without contrasting condition
>>>                cfg = [];
>>>                cfg.channel = 'EEG';
>>>                cfg.method = 'lcmv';
>>>                cfg.grid = grid;
>>>                cfg.vol = vol;
>>>                cfg.keepfilter = 'yes';
>>>                source = ft_sourceanalysis( cfg, timelock);
>>>
>>> Previously I had used the x, y and z grid from the atlas, but I till had a reduced rank.
>>>
>>> Any suggestions?
>>>
>>> Tyler
>>>
>>> *************************
>>>
>>> Tyler Grummett ( BBSc, BSc(Hons I))
>>> PhD Candidate
>>> Brain Signals Laboratory
>>> Flinders University
>>> Rm 5A301
>>> Ext 66124
>>>
>>> ________________________________________
>>> From: fieldtrip-bounces at science.ru.nl <fieldtrip-bounces at science.ru.nl> on behalf of "Jörn M. Horschig" <jm.horschig at donders.ru.nl>
>>> Sent: Tuesday, 3 June 2014 6:16 PM
>>> To: FieldTrip discussion list
>>> Subject: Re: [FieldTrip] ft_mvaranalysis
>>>
>>> Hi Tyler,
>>>
>>> most likely your data is rank deficient. You can check this by
>>>     >> rank(data.trial{1})
>>>
>>> You probably won't get 116 (#channels) as a result. If I remember
>>> correctly your data needs to have full-rank for mvaranalysis.
>>>
>>> Best,
>>> Jörn
>>>
>>>
>>> On 6/3/2014 9:50 AM, Tyler Grummett wrote:
>>>> JM,
>>>>
>>>>
>>>> My data has the following format:
>>>>
>>>>
>>>> data =
>>>>
>>>>
>>>> fsample: 500
>>>> sampleinfo: [14x2 double]
>>>> trial: {1x14 cell}
>>>> time: {1x14 cell}
>>>> label: {1x116 cell}
>>>> cfg: [1x1 struct]
>>>>
>>>> I had a look and there are no NaNs or anything. I have tried running
>>>> using the coherence method for connectivity analysis (hence I didnt
>>>> need to use mvaranalysis) and it seemed to work fine.
>>>>
>>>> Can you give me any suggestions as to what the problems with my data
>>>> could be?
>>>>
>>>> Tyler
>>>>
>>>>
>>>>
>>>> *************************
>>>>
>>>> /Tyler Grummett ( BBSc, BSc(Hons I))/
>>>> /PhD Candidate/
>>>> /Brain Signals Laboratory/
>>>> /Flinders University/
>>>> /Rm 5A301/
>>>> /Ext 66124/
>>>> ------------------------------------------------------------------------
>>>> *From:* fieldtrip-bounces at science.ru.nl
>>>> <fieldtrip-bounces at science.ru.nl> on behalf of jan-mathijs schoffelen
>>>> <jan.schoffelen at donders.ru.nl>
>>>> *Sent:* Tuesday, 3 June 2014 5:06 PM
>>>> *To:* FieldTrip discussion list
>>>> *Subject:* Re: [FieldTrip] ft_mvaranalysis
>>>> This is a low level matlab error and suggests a problem with your data.
>>>>
>>>>
>>>> On Jun 3, 2014, at 9:32 AM, Tyler Grummett
>>>> <tyler.grummett at flinders.edu.au
>>>> <mailto:tyler.grummett at flinders.edu.au>> wrote:
>>>>
>>>>> Using the same code it generates the error:
>>>>>
>>>>> Error using chol
>>>>> Matrix must be positive definite.
>>>>>
>>>>> Error in armorf (line 40)
>>>>> ap(:,:,1) = inv((chol(ap(:,:,1)/Nr*(Nl-1)))');
>>>>>
>>>>> Error in ft_mvaranalysis (line 395)
>>>>> [ar, tmpnoisecov] = armorf(dat, numel(rpt{rlop}),
>>>>> size(tmpdata.trial{1},2),
>>>>> cfg.order);
>>>>>
>>>>>
>>>>>
>>>>> *************************
>>>>>
>>>>> /Tyler Grummett ( BBSc, BSc(Hons I))/
>>>>> /PhD Candidate/
>>>>> /Brain Signals Laboratory/
>>>>> /Flinders University/
>>>>> /Rm 5A301/
>>>>> /Ext 66124/
>>>>> ------------------------------------------------------------------------
>>>>> *From:*fieldtrip-bounces at science.ru.nl
>>>>> <mailto:fieldtrip-bounces at science.ru.nl><fieldtrip-bounces at science.ru.nl
>>>>> <mailto:fieldtrip-bounces at science.ru.nl>> on behalf of jan-mathijs
>>>>> schoffelen <jan.schoffelen at donders.ru.nl
>>>>> <mailto:jan.schoffelen at donders.ru.nl>>
>>>>> *Sent:*Tuesday, 3 June 2014 4:49 PM
>>>>> *To:*FieldTrip discussion list
>>>>> *Subject:*Re: [FieldTrip] ft_mvaranalysis
>>>>> Hi Tyler,
>>>>>
>>>>> Try using ft_hastoolbox(‘bsmart’,1) and then in the cfg for
>>>>> ft_mvaranalysis cfg.toolbox = ‘bsmart’
>>>>>
>>>>> Best,
>>>>> Jan-Mathijs
>>>>>
>>>>> On Jun 3, 2014, at 3:39 AM, Tyler Grummett
>>>>> <tyler.grummett at flinders.edu.au
>>>>> <mailto:tyler.grummett at flinders.edu.au>> wrote:
>>>>>
>>>>>> Hello fieldtrippers,
>>>>>>
>>>>>> Im having problems with ft_mvaranalysis at line 390: [ar, rc, pe] =
>>>>>> mvar(dat', cfg.order, cfg.mvarmethod);
>>>>>>
>>>>>> The error message is:
>>>>>>
>>>>>> Undefined function 'mvar' for input arguments of type 'double'.
>>>>>>
>>>>>> ​ Ive tried looking for the function, but I cant find it. Is it
>>>>>> likely that it is hidden or absent?
>>>>>>
>>>>>> I swear this has worked before on old data, and I didnt update the
>>>>>> toolbox between trying it
>>>>>> with the old data and with the new data. I have now updated the
>>>>>> fieldtrip toolbox and I have
>>>>>> tried running the code again, but no luck.
>>>>>>
>>>>>> Tyler
>>>>>>
>>>>>> *************************
>>>>>>
>>>>>> /Tyler Grummett ( BBSc, BSc(Hons I))/
>>>>>> /PhD Candidate/
>>>>>> /Brain Signals Laboratory/
>>>>>> /Flinders University/
>>>>>> /Rm 5A301/
>>>>>> /Ext 66124/
>>>>>> _______________________________________________
>>>>>> fieldtrip mailing list
>>>>>> fieldtrip at donders.ru.nl <mailto:fieldtrip at donders.ru.nl>
>>>>>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>>>> Jan-Mathijs Schoffelen, MD PhD
>>>>>
>>>>> Donders Institute for Brain, Cognition and Behaviour,
>>>>> Centre for Cognitive Neuroimaging,
>>>>> Radboud University Nijmegen, The Netherlands
>>>>>
>>>>> Max Planck Institute for Psycholinguistics,
>>>>> Nijmegen, The Netherlands
>>>>>
>>>>> J.Schoffelen at donders.ru.nl <mailto:J.Schoffelen at donders.ru.nl>
>>>>> Telephone: +31-24-3614793
>>>>>
>>>>> http://www.hettaligebrein.nl <http://www.hettaligebrein.nl/>
>>>>>
>>>>> _______________________________________________
>>>>> fieldtrip mailing list
>>>>> fieldtrip at donders.ru.nl <mailto:fieldtrip at donders.ru.nl>
>>>>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>>> Jan-Mathijs Schoffelen, MD PhD
>>>>
>>>> Donders Institute for Brain, Cognition and Behaviour,
>>>> Centre for Cognitive Neuroimaging,
>>>> Radboud University Nijmegen, The Netherlands
>>>>
>>>> Max Planck Institute for Psycholinguistics,
>>>> Nijmegen, The Netherlands
>>>>
>>>> J.Schoffelen at donders.ru.nl <mailto:J.Schoffelen at donders.ru.nl>
>>>> Telephone: +31-24-3614793
>>>>
>>>> http://www.hettaligebrein.nl
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> fieldtrip mailing list
>>>> 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
>>> Tel:    +31-(0)24-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
>>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>>
>>> _______________________________________________
>>> fieldtrip mailing list
>>> fieldtrip at donders.ru.nl
>>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>>
>>> _______________________________________________
>>> fieldtrip mailing list
>>> 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
>> Tel:    +31-(0)24-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
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>
>> _______________________________________________
>> fieldtrip mailing list
>> 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
> Tel:    +31-(0)24-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
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
>
> _______________________________________________
> fieldtrip mailing list
> 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
Tel:    +31-(0)24-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
http://mailman.science.ru.nl/mailman/listinfo/fieldtrip




More information about the fieldtrip mailing list