[FieldTrip] ft_sourceanalysis using LCMV beamformer and grid from ft_prepare_leadfield
Tyler Grummett
tyler.grummett at flinders.edu.au
Tue Apr 8 07:15:08 CEST 2014
Fieldtrip,
Ive got it working now.
The follow error:
*****************************************************************
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{:});
*****************************************************************
It is because:
if is 128x3
invCy is 124x124
When I ran the code:
cfg = [];
cfg.channel = 'EEG'; % only works for preprocessing
cfg.vartrllength = 2; % accept variable length trials
cfg.covariance = 'yes';
cfg.covariancewindow = 'all';
cfg.keeptrials = 'no';
timelock = ft_timelockanalysis(cfg, data);
It did the timelockanalysis on 124 channels, but it didnt remove the non-EEG channels from timelock.elec
and so the four EOG channels explains the 128.
timelock =
avg: [124x11758 double]
var: [124x11758 double]
time: [1x11758 double]
dof: [124x11758 double]
label: {1x124 cell}
dimord: 'chan_time'
cov: [124x124 double]
elec: [1x1 struct]
cfg: [1x1 struct]
timelock.elec =
chanpos: [128x3 double]
elecpos: [128x3 double]
label: {1x128 cell}
type: 'eeg1005'
unit: 'mm'
I dont know if this is a bug or not. Please advise.
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: Tuesday, 8 April 2014 12:18 PM
To: FieldTrip discussion list
Subject: [FieldTrip] ft_sourceanalysis using LCMV beamformer and grid from ft_prepare_leadfield
Hello fieldtrip,
I am trying to perform an LCMV beamformer on timelockanalysis data.
timelock =
avg: [124x20517 double]
var: [124x20517 double]
time: [1x20517 double]
dof: [124x20517 double]
label: {1x124 cell}
dimord: 'chan_time'
cov: [124x124 double]
elec: [1x1 struct]
cfg: [1x1 struct]
I first run ft_prepare_leadfield
cfg = [];
cfg.elec = timelock.elec;
cfg.vol = vol;
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);
grid =
xgrid: [-5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8]
ygrid: [-6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7]
zgrid: [0 1 2 3 4 5 6 7 8 9 10 11 12]
dim: [14 14 13]
pos: [2548x3 double]
unit: 'cm'
inside: [1x1409 double]
outside: [1x1139 double]
cfg: [1x1 struct]
leadfield: {1x2548 cell}
I then try to run the ft_sourceanalysis code:
cfg = [];
cfg.channel = timelock.label;
cfg.method = 'lcmv';
cfg.grid = grid;
cfg.vol = vol;
cfg.keepfilter = 'yes';
source = ft_sourceanalysis( cfg, timelock);
And it crashes with the error message:
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{:});
However, the code does work if it is:
cfg = [];
cfg.channel = timelock.label;
cfg.method = 'lcmv';
cfg.grid.inside = grid.inside;
cfg.vol = vol;
cfg.keepfilter = 'yes';
source = ft_sourceanalysis( cfg, timelock);
However, I run the sourceplot code produces something that looks like the picture attached.
What is interesting is that when I run the interp code:
the input is source data with 16777216 positions on a [256 256 256] grid
not plotting anatomy
But when you run the same code from sourcePost_nocon from the beamformer tutorial, you get the following when you run the code:
the input is source data with 3042 positions on a [18 13 13] grid
the input is volume data with dimensions [256 256 256]
I have used the same mri file for both.
?
Please help, I cant work out the issue.
Tyler
*************************
Tyler Grummett ( BBSc, BSc(Hons I))
PhD Candidate
Brain Signals Laboratory
Flinders University
Rm 5A301
Ext 66124
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20140408/fb78308e/attachment-0002.html>
More information about the fieldtrip
mailing list