[FieldTrip] plotting interpolated sources with ft_sourceplot
Tyler Grummett
tyler.grummett at flinders.edu.au
Mon Mar 31 12:36:52 CEST 2014
Jorn,
I apologise about the bugzilla report. My last two emails on this emailing list were ignored, thats all. I didnt really know how else to approach this issue.
I had a look at my variables.
source.avg =
pow: [642x1 double]
filter: {642x1 cell}
sourceInt.avg =
pow: [16777216x1 double]
So clearly, as both variables are completely different. Something has gone wrong.
The next part of my code is the following:
% interpolate sources
mri = ft_read_mri('Subject01.mri');
mri = ft_volumereslice([], mri);
cfg = [];
cfg.downsample = 2;
cfg.parameter = 'avg.pow';
sourceInt = ft_sourceinterpolate( cfg, source, mri);
sourceInt = rmfield( sourceInt,'time'); % The avg.pow parameter
% does not vary over time, therefore the time dimension is not needed.
mri =
anatomy: [256x256x256 double]
dim: [256 256 256]
transform: [4x4 double]
coordsys: 'ctf'
unit: 'mm'
cfg: [1x1 struct]
I cant really see if the data works in the tutorial because it doesnt appear as though fieldtrip has a tutorial on lcmv beamformers, they seem to stick to frequency domain beamformers.
Ive been wrong before though,
thanks for your help.
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: Monday, 31 March 2014 7:13 PM
To: FieldTrip discussion list
Subject: Re: [FieldTrip] plotting interpolated sources with ft_sourceplot
Hi Tyler,
hm, okay, it could be that the issue with the leadfield and with the
plot are related, but it could also be that they are separate issues. I
just saw that you posted the same 'problem' on bugzilla and included a
picture. Maybe for next time, include a picture on the mailinglist and
just create a bug on bugzilla if you are sure it is a bug in Fieldtrip
and not if you are not sure. That saves us a lot of time in separating
code issues from user problems ;)
So, back to you problem. It seems that your reconstruction results in
one voxel only. Are you sure that your grid consistents of more than
just one position? So, for example check the size of the matrices in
source.avg, source- and headmodel, etc.
Also, you can check in Matlab the respective fields of source and
sourceInt and see whether that makes sense.
Lastly, a neat way to check is always to use your code on data from the
tutorial, and vice versa, use code from the tutorial on your data and
see whether that works. Both should give sensible results, and if one
does not, you know where to start looking for a solution ;)
Best,
Jörn
On 3/31/2014 9:41 AM, Tyler Grummett wrote:
> Hey Jorn,
>
> Previously I have let ft_sourceanalysis do a lead field because if I use the following code:
>
> % compute lead field ( apparently source analysis computes
> % lead field anyway
> cfg = [];
> cfg.elec = timelock.elec;
> cfg.vol = vol;
> cfg.reducerank = 3;
> cfg.grid.resolution = 1; % use a 3-D grid with a 1 cm resolution
> cfg.grid.unit = 'cm';
> 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 IS WHERE I AM UP TO
>
> and then calculate the source analysis:
>
> % Source Analysis: without contrasting condition
> cfg = [];
> cfg.method = 'lcmv';
> cfg.grid = grid;
> cfg.vol = vol;
> % cfg.grid.pos = maxpos;
> cfg.keepfilter = 'yes';
> cfg.dics.projectnoise = 'yes';
> % cfg.dics.lambda = 0;
> source = ft_sourceanalysis( cfg, timelock);
>
> then I get an error than says:
>
> Error using *
> Inner matrix dimensions must agree.
>
> Error in beamformer_lcmv (line 268)
> filt = pinv(lf' * invCy * lf) * lf' *
> invCy; % van Veen eqn. 23, use
> PINV/SVD to cover rank deficient leadfield
>
> Error in ft_sourceanalysis (line 794)
> dip(i) = beamformer_lcmv(grid, sens, vol,
> squeeze_avg, squeeze(Cy(i,:,:)),
> optarg{:});
>
> I just removed the leadfield code and it successfully ran. I could also interpolate it later.
> Is this the correct approach.
>
> Thankyou in advance!
>
> 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: Monday, 31 March 2014 5:30 PM
> To: FieldTrip discussion list
> Subject: Re: [FieldTrip] plotting interpolated sources with ft_sourceplot
>
> Hi Tyler,
>
> what you are describing sounds to me like the center bias of the
> beamformer. Did you contrast the activity with anything, or did you
> normalize your leadfield?
> Check this out:
> http://fieldtrip.fcdonders.nl/tutorial/beamformer#source_analysiswithout_contrasting_condition
>
> Best,
> Jörn
>
> On 3/31/2014 5:46 AM, Tyler Grummett wrote:
>> I have been trying to plot my interpolated source data using the code:
>>
>> % interpolate sources
>> mri = ft_read_mri('Subject01.mri');
>> mri = ft_volumereslice([], mri);
>> cfg = [];
>> cfg.downsample = 2;
>> cfg.parameter = 'avg.pow';
>> sourceInt = ft_sourceinterpolate( cfg, source, mri);
>> sourceInt = rmfield( sourceInt,'time'); % The avg.pow
>> parameter
>> % does not vary over time, therefore the time dimension
>> is not needed.
>>
>> % Plot interpolated data
>> cfg = []; %#ok<UNRCH>
>> cfg.method = 'ortho'; % spline
>> cfg.funparameter = 'avg.pow';
>> ft_sourceplot( cfg, sourceInt);
>>
>> However the figure that comes up just had orange squares in the subplots.
>>
>> I dont know where Ive gone wrong.
>>
>>
>> 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
>> 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