Back to the main page.

Bug 3023 - layout problem if sensor at (0,0,0)

Status CLOSED FIXED
Reported 2015-12-09 13:37:00 +0100
Modified 2017-01-17 11:30:35 +0100
Product: FieldTrip
Component: plotting
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P5 minor
Assigned to: Jan-Mathijs Schoffelen
URL:
Tags:
Depends on:
Blocks:
See also:

Tilmann Sander-Thommes - 2015-12-09 13:37:59 +0100

Created attachment 761 fieldtrip cfg-structure with sensor at position (0,0,0). For a prototype multichannel system several sensors are placed around a central sensor at (0,0,0). If a layout is created for that geometry the central sensor is not in the middle of the layout. The following command sequence can be used to show the bug, the sensor has index 7. In the final layout plot it is on the right side close to sensor 1: >> clear('all') >> ft_defaults >> load('cfg_w_sens_at0_0_0') >> cfg.grad.coilpos(7,:) ans = 0 0 0 >> lay = ft_prepare_layout(cfg); creating layout from cfg.grad creating layout for meg system the call to "ft_prepare_layout" took 1 seconds >> lay.pos(7,:) ans = 0.4500 -0.0000 >> ft_layoutplot(cfg) Many thanks, Till


Jan-Mathijs Schoffelen - 2017-01-04 15:05:52 +0100

Sorry Till, for not following up on this one for such a long time. I looked a bit into it, and it seems to be caused by a rather deep error in ft_prepare_layout (subfunction sens2lay, which calls elproj, the latter is a function in fieldtrip/private). The default projection method 'polar' causes an issue when a sensor is at the origin. The following works fine for me (after cleaning up the cfg.grad provided): grad = cfg.grad; cfg = []; cfg.projection = 'stereographic'; cfg.grad = grad; lay = ft_prepare_layout(cfg); figure;ft_plot_lay(cfg); Better still, I would create a custom layout, with the channel positions entered manually (rather than by projection from the gradiometer array). Since this seems a rather special case to me, would you be OK with leaving it like this?


Tilmann Sander-Thommes - 2017-01-04 16:43:33 +0100

Hello Jan-Mathijs, Thank you for looking into that. I have not had any trouble with that bug ever again and I think your solution is fine. I reported it just in case that it was a real issue. And with it being reported and your solution/explanation it can be closed and found by other people. I am a permanent FieldTrip user and I am extremly happy with the progress made by the community. Best regards, Till


Jan-Mathijs Schoffelen - 2017-01-17 11:30:35 +0100

closed multiple bugs at once