Back to the main page.

Bug 2111 - Problem with ft_prepare_layout

Reported 2013-04-11 17:57:00 +0200
Modified 2014-03-12 12:21:34 +0100
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P3 normal
Assigned to: Jörn M. Horschig
Depends on:
See also:

Vladimir Litvak - 2013-04-11 17:57:31 +0200

Created attachment 448 cfg Hi, I'm getting a weird results projecting a CTF grad to 2D. It looks like there is a mismatch between locations and labels (as the reference sensors are also there and they shouldn't be) and also some kind of misalignment. I attach the cfg. Thanks, Vladimir

Vladimir Litvak - 2013-04-11 17:58:29 +0200

Created attachment 449 Here is what it looks like for me

Jörn M. Horschig - 2013-04-23 12:48:04 +0200

Hi Vladimir, using a 3D plot I am pretty sure that there is no misalignment between labels and channel position. The reference sensors are just there because they are present in the grad and you do not specify a subset of channels (e.g. if you specify = 'MEG' then they are gone). However, the channel positions are indeed rotated... this strange rotation seems to be already there in the grad though. Plotting the x- and y-positions of the 3D coordinates results in a plot with frontal channels at around 5 o'clock. ft_prepare_layout applies an additional 90 degree rotation for the CTF system before projecting to a 2D plane, but in your case it seems more like a 135 deg shift. I'm gonna consult Robert with this, because I'm out of ideas (the same cfg with another CTF275.grad results in a plot that looks all fine). Just to make sure, would there be any reason you can think of why the .grad information could be wrong?

Vladimir Litvak - 2013-04-23 12:52:23 +0200

(In reply to comment #2) Hi Jorn, Yes, after posting the bug I saw myself that the locations are rotated in the grad. I couldn't figure out why it happened and I also couldn't reproduce it reliably in the processing pipeline. It might have something to do with ft_average_sens. If your reach the conclusion that the layout is OK for this defective grad then I should wait and try to see if it happens again and look for the error elsewhere. Vladimir

Jörn M. Horschig - 2013-04-23 13:37:19 +0200

Created attachment 460 fiducial swapp illustration Hi Vladimir, Robert and me thought about what might have gone wrong. The explanation that makes most sense is that two fiducials were swapped. When calling ft_determine_coordsys(cfg.grad), you can see that the Z-axis still points somewhat to the top of the head, so left and right fiducial are not swapped with each other. However, the sensors are not aligned well with the X- and Y-axes. A swap between the nasion fiducial and one of the aurical fiducials would explain this. I attached a drawing of this. Does that make sense to you?

Vladimir Litvak - 2013-04-23 17:02:23 +0200

(In reply to comment #4) There is now another problem with fr_preparelayout. The message is: ??? Reference to non-existent field 'width'. Error in ==> ft_prepare_layout at 663 layout.width = layout.width(chansel); You can run the spm test script to reproduce it. Please fix ASAP. Vladimir

Jörn M. Horschig - 2013-04-23 17:16:12 +0200

Robert, I added you because Vladimir's latest message seems be related more to SPM and bug 1320 (for the record, I can confirm this error for = '3d')

Robert Oostenveld - 2013-04-23 17:31:04 +0200

(In reply to comment #6) that was easy, I changed layout.pos = layout.pos(chansel,:); layout.label = layout.label(chansel); layout.width = layout.width(chansel); layout.height = layout.height(chansel); into layout.pos = layout.pos(chansel,:); layout.label = layout.label(chansel); if ~strcmp(, '3d') % these don't exist for the 3D layout layout.width = layout.width(chansel); layout.height = layout.height(chansel); end mac001> svn commit ft_prepare_layout.m Sending ft_prepare_layout.m Transmitting file data . Committed revision 8065.

Jörn M. Horschig - 2013-07-03 10:42:52 +0200

no complaints, so I consider it fixed successfully :)