[FieldTrip] problem with offline head movement compensation in MEG (ft_headmovement)

Sebastian Michelmann SXM1085 at student.bham.ac.uk
Tue Dec 13 17:41:00 CET 2016


Dear FT community ,
I tried to use ft_headmovement to adjust my grad structure in order to account for head movement before source reconstruction.

I run into the following problem:

% code
cfg = [];
cfg.dataset = filenames{1};
cfg.trl = trl_used;
[grad_adj] = ft_headmovement(cfg);

>> output
processing channel { 'HLC0011' 'HLC0012' 'HLC0013' 'HLC0021' 'HLC0022' 'HLC0023' 'HLC0031' 'HLC0032' 'HLC0033' }
reading and preprocessing
reading and preprocessing trial 687 from 687

the call to "ft_preprocessing" took 58 seconds and required the additional allocation of an estimated 14 MB

>> error
Error using kmeans (line 262)
X must have more rows than the number of clusters.

Error in ft_headmovement (line 125)
[bin, cluster] = kmeans(dat', cfg.numclusters);
----------------------------------------------------------------------
The problem is, that the dat passed to kmeans clustering is empty.
It seems that only headpositions that are at least 100 times present in the downsampled data are actually considered for clustering.
I don't understand the reason for that, especially since the data is not rounded and scaled in 'mm' (there are a lot of tiny changes between the sampling points)

Thanks for any suggestions!

All the best,

Sebastian


This is in line 92 of the function

dat  = zeros(length(data.label), 0);
wdat = zeros(1, 0);
for k = 1:length(data.trial)
  tmpdat  = data.trial{k};
  utmpdat = unique(tmpdat','rows')';
  dat     = [dat utmpdat];

  wtmpdat = zeros(1,size(utmpdat,2));
  for m = 1:size(utmpdat,2)
    wtmpdat(1,m) = sum(sum(tmpdat-utmpdat(:,m)*ones(1,size(tmpdat,2))==0,1)==9);
  end
  wdat    = [wdat wtmpdat];
end
dat(:, wdat<100) = [];
wdat(wdat<100)   = [];
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20161213/a9a7fdac/attachment-0001.html>


More information about the fieldtrip mailing list