Skip to content

Scrambled MEG sensor locations

Issues

MEG sensor locations appear scrambled

The layout of the sensors is wrong. When plotting the position, they appear scrambled.

Plot the channel positions:

plot3(data.grad.chanpos(:,1), data.grad.chanpos(:,2), data.grad.chanpos(:,3), 'o')

How it should look:

Also, you cannot plot the sensor layout with ft_plot_sens(data.grad):

Error using ft_plot_sens (line 448)
cannot work with balanced gradiometer definition

If you have this error, it is potentially a big problem if you are doing source reconstruction, as the geometry of the sensors relative to the brain is wrong. This is another reason why you should always plot the alignment of headpoints, the headmodel, and sensors before doing source reconstruction.

The problem comes from the reconstruction of the channels when removing ICA components (ft_rejectcomponent).

When using ft_rejectcomponent make sure that you specify input data and set the configuration to not update sensor info:

% Remove components
cfg = [];
cfg.component   = reject_comp;
cfg.channel     = 'MEG';
cfg.updatesens  = 'no';
icaclean_data = ft_rejectcomponent(cfg, comp, data);