[FieldTrip] MUSIC small bug and fail in retrieving simulation data location

Konstantina Kalogianni K.Kalogianni at tudelft.nl
Wed Feb 3 15:00:33 CET 2016


Dear fieldtrippers,

I am doing a sanity check on the implementation of the MUSIC algorithm in fieldtrip, before applying it in real data.
So after creating simulation data with sinusoids at a specific location and adding  relative noise of 1.5,
I am doing a music scan with the number of components as 1.
The code for that is below (I used filedtrip version fieldtrip-20160101):

%% leadfield should be generated for specific EEG signal
addpath([ft_path,'fileio\']);
addpath ([ft_path,'template\electrode\']);
addpath ([ft_path,'template\headmodel\']);
%% LOAD VOL ELEC MRI
% load electrode locations
elec=ft_read_sens('standard_1020.elc');
% load mri & vol (template)
load('standard_mri.mat'); %units in mm
load('standard_bem');
%% adjust electrode locations for 62 channels eeg
elec.label=upper(elec.label);
load([gendir 'label_62.mat'], 'label_62');
EEG.label=label_62;
label_signal=upper(EEG.label);
EEG.label=upper(EEG.label);
elec2find=zeros(length(label_signal),1);
for i=1:length(label_signal);
elec2find(i,1)=find(strcmp(label_signal(i),elec.label));
end
% elec with 62 locations based on SEP signal
elec.chanpos=elec.chanpos((elec2find), :);
elec.elecpos=elec.elecpos((elec2find), :);
elec.label=elec.label((elec2find));
elec.label=upper(elec.label);
% align elecs on vol if needed
cfg           = [];
cfg.method    = 'interactive';
cfg.elec      = elec;
cfg.headshape = vol.bnd(1);
elec_aligned = ft_electroderealign(cfg);
%% compute leadfield
cfg                  = [];
cfg.elec             =elec_aligned;
cfg.channel          = EEG.label;% or common_channels_;
cfg.reducerank       = 3;
cfg.headmodel        = vol;   % volume conduction headmodel
cfg.normalize        = 'yes';
cfg.grid.unit        = 'mm';
cfg.grid.resolution  = 5;
leadfield            = ft_prepare_leadfield(cfg, EEG);

%% simulate EEG data, dipole in specific location
loc1=[-30, -11, 65 ];
cfg = [];
cfg.headmodel  = vol ;
cfg.elec = elec_aligned;
cfg.fsample = 1024;            % Hz
cfg.dip.amplitude=[1];
cfg.dip.phase=[1];
cfg.dip.pos(1,:) = loc1;
cfg.dip.mom(:,1) = [1 0 0]';
cfg.ntrials=500;
cfg.triallength= 0.250;
cfg.fsample=1024;
cfg.relnoise = 1.5;
epoch = ft_dipolesimulation(cfg);
%% compute averaged dataset with covariance matrix
cfg=[];
% cfg.covariance='yes';
avg = ft_timelockanalysis(cfg, epoch);
%%
cfg                   = [];
cfg.method            = 'music';
cfg.grid              = load([gendir 'leadfield_templ.mat']); % leadfield, which has the grid information
cfg.headmodel         = load([gendir 'vol_temp.mat']);% volume conduction model (headmodel)
cfg.elec              = load([gendir 'elec_temp.mat']);
cfg.channel           = avg.label;
cfg.music.numcomponent= 1;
source_music          = ft_sourceanalysis(cfg, avg);
%%
pos_max = zeros(1,3);
[~,k]=max(source.avg.jr);
[~,l]=min(source.avg.jr);
music_max = source.pos(k, :);
music_min =  source.pos(l, :);
First of all the code in music.m will only work if you change line 77 and 78 with the following lines:
% select only the dipole positions inside the brain for scanning
dip.inside = find(dip.inside==1);
dip.pos    = dip.pos(dip.inside,:);

and line 103 with this lf = dip.leadfield{dip.inside(i)};
Otherwise it was not possible since the lf contained both the points inside and outside the brain

But even after changing those lines both the  minimum and the maximum of the music metric are not the original location.
Original location was [-30, -11, 65 ] and minimum music metric gives [-55, -15,     58] while maximum music metric gives [50, -20, 8].

The same location repeats with both using the covariance matrix as an input in music or not and also by changing the relative noise to 0.5 instead of 1.5.

Does someone run into the same type of problems with music?
Thanks in advance for your help.


K. (Nadia) Kalogianni
PhD candidate

TU Delft /Department of Biomechanical Engneering
Neuromuscular Control Laboratory

Mekelweg 2
2628 CD Delft
Room: F-1-320
T +31 15-27 84230
E  k.kalogianni at tudelft.nl

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20160203/0098c7cb/attachment-0001.html>


More information about the fieldtrip mailing list