Back to the main page.

Bug 863 - megplanar followed immediately by combineplanar does not work

Status CLOSED FIXED
Reported 2011-08-09 14:34:00 +0200
Modified 2011-08-17 15:13:32 +0200
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P1 normal
Assigned to: Jan-Mathijs Schoffelen
URL:
Tags:
Depends on:
Blocks:
See also:

Jörn M. Horschig - 2011-08-09 14:34:30 +0200

If you got raw data, call megplanar and then combineplanar, checkdata complaints that you provided ctf data as input instead of ctf planar. The problem is caused in ft_senstype which checks the .grad field, in which channel labels are still left as they originally were. A proposed fix would be to change the recursion of ft_senstype to first check data.label rather than data.grad. Johanna encountered the same problem with her Nottingham data.


Jan-Mathijs Schoffelen - 2011-08-09 14:39:40 +0200

megplanar should incorporate the balancing matrix in the gradiometer array and also change the labels. Isn't this the case? i.e. ft_apply_montage should be called in ft_megplanar on both the trial data and the grad-field).


Jörn M. Horschig - 2011-08-09 16:12:01 +0200

hmm, yea, probably my bug is related to the fact that my data has no M* sensors anymore, just HLC sensors... must be a bug I introduced in my own script. I'll mark this as invalid as long as I cannot reproduce it with proper data, sorry for the confusion!


Jörn M. Horschig - 2011-08-09 16:26:44 +0200

hm okay, reproduced :/ the problem is in line 138 of ft_senstype. the function wants to infer the senstype from hdr, which labels did not get converted to planar labels -- cut -- if isdata % preferably look at the data and not the header for the grad, because it might be re-balanced and/or planar if isfield(input, 'hdr') input = input.hdr; isheader = true; -- cut -- I do not get that comment, if the data is planar, ft_senstype should return XXX_planar how to avoid this?


Johanna - 2011-08-09 16:42:39 +0200

I quickly looked at my scripts on my Nottingham data, and it seems my workaround also involved removing the hdr which had original labels causing combineplanar to think it was non-planar data. I did it something like this: data.grad=data.hdr.grad data=rmfield(data,'hdr') data1=ft_megplanar(cfg,data) data2=ft_combineplanar(cfg,data1) I ran into this about 3 weeks ago, but had a few other things different than normal so didn't realise it might be a bug, I thought it was something weird I was doing elsewhere.


Jan-Mathijs Schoffelen - 2011-08-15 13:46:33 +0200

OK, I don't see a reason why the data.hdr should prevail over the data.grad, so I changed the order in the if/else tree. This solves this problem