Back to the main page.

Bug 2535 - Error in ft_apply_montage: gradiometer info not correctly selected?

Status CLOSED WONTFIX
Reported 2014-04-14 17:20:00 +0200
Modified 2019-08-10 12:33:25 +0200
Product: FieldTrip
Component: forward
Version: unspecified
Hardware: Macintosh
Operating System: Mac OS
Importance: P5 normal
Assigned to:
URL:
Tags:
Depends on:
Blocks:
See also:

Jonathan Daume - 2014-04-14 17:20:25 +0200

Hi, I get a crash when calling ft_apply_montage with ft_megplanar (for several late FT versions). I guess this comes from calling incorrect gradiometer info from the ICA output during ft_apply_montage, but I am not sure. This is what happens: The following is the gradiometer info of my ft_preprocessing output before I call ft_componentanalysis: data.grad = balance: [1x1 struct] chanori: [299x3 double] chanpos: [299x3 double] chantype: {299x1 cell} chanunit: {299x1 cell} coilori: [589x3 double] coilpos: [589x3 double] coordsys: 'ctf' label: {299x1 cell} tra: [299x589 double] type: 'ctf275' unit: 'cm' I add six EEG channels to the ICA causing changes in grad-info of the ICA-output comp: comp.grad = balance: [1x1 struct] chanori: [305x3 double] chanpos: [305x3 double] coilori: [589x3 double] coilpos: [589x3 double] coordsys: 'ctf' label: {305x1 cell} tra: [305x589 double] unit: 'cm' chanposorg: [299x3 double] chanoriorg: [299x3 double] labelorg: {299x1 cell} After calling ft_rejectcomponent using the original data (data_rej = ft_rejectcomponent(cfg, comp, data)), the grad-info gets correctly updated: data_rej.grad = balance: [1x1 struct] chanori: [305x3 double] chanpos: [305x3 double] coilori: [589x3 double] coilpos: [589x3 double] coordsys: 'ctf' label: {305x1 cell} tra: [305x589 double] type: 'ctf275' unit: 'cm' chanposorg: [299x3 double] chanoriorg: [299x3 double] labelorg: {299x1 cell} So far, so good. However, as soon as I call ft_megplanar (prior to ft_freqanalysis) there is a dimension mismatch during calculating sens.tra in ft_apply_montage: Error using * Inner matrix dimensions must agree. Error in ft_apply_montage (line 220) sens.tra = montage.tra * sens.tra; Error in ft_megplanar (line 309) interp.grad = ft_apply_montage(sens, planarmontage, 'balancename', 'planar', 'keepunused', 'yes'); It seems that montage.tra (569x299 double) contains only the MEG channels, which are selected by ft_apply_montage (as wanted for ft_megplanar), whereas sens.tra (=data_rej.grad.tra,305x589 double) still contains information about the added six EEG channels causing a dimension mismatch during multiplying. I guess, in sens.tra only the MEG channels should be selected as well. I can circumvent this problem by overwriting data_rej.grad with data.grad (the gradiometer info prior to the ICA), however, shouldn't this also work with the actual output of ft_rejectcomponent? Or am I misunderstanding something? Thanks a lot for your help! Regards, Jonathan


Jan-Mathijs Schoffelen - 2016-12-23 09:08:06 +0100

I am not sure whether this is still a problem. The code has probably significantly evolved since this has been first submitted, and nobody has followed up on this (including the person who filed the bug). For now, I suggest to close it, but feel free to reopen.


Robert Oostenveld - 2019-08-10 12:33:25 +0200

This closes a whole series of bugs that have been resolved (either FIXED/WONTFIX/INVALID) for quite some time. If you disagree, please file a new issue on https://github.com/fieldtrip/fieldtrip/issues.