Back to the main page.

Bug 1612 - ft_electroderealign() cannot correctly align electrodes to head shape if the head is not in CTF orientation

Reported 2012-07-16 19:17:00 +0200
Modified 2016-01-15 09:37:06 +0100
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P3 normal
Assigned to: Jan-Mathijs Schoffelen
Depends on:
See also:

Yu Huang - 2012-07-16 19:17:22 +0200

The head shape provided in attachment is in ITAB orientation, but in line 387 & 388 of ft_electroderealign() where it calls headcoordinates(), the orientation is assumed to be CTF by default.

Yu Huang - 2012-07-16 20:25:06 +0200

Created attachment 293 input variable 'cfg' to ft_electroderealign() to reproduce the bug

Jan-Mathijs Schoffelen - 2012-07-18 16:47:41 +0200

Hi Yu Huang, I don't understand the cfg you supplied. It seems as if you specify many options, but it is not clear to me which 'method' you actually try to apply. The cfg suggests 'fiducial', whereas your question pertains to a headshape based alignment.

Yu Huang - 2012-07-18 20:01:35 +0200

I was trying to align the electrode coordinates stored in cfg.elec to the headshape based on three fiducials of that headshape, so the method should be 'fiducial'. The problem is the headshape is not in CTF orientation, so ft_electroderealign cannot correctly align it onto that headshape (new electrodes are far away from the headshape). But if I specified ITAB orientation in line 387 & 388 of ft_electroderealign() where it calls headcoordinates(), the result is correct (although the electrodes are not all exactly on the surface of the head, they are basically around the head). So I was wondering if ft_electroderealign() should add an argument of headshape orientation. Thanks!

Jan-Mathijs Schoffelen - 2015-09-18 12:39:55 +0200

I still don't fully understand why this did not work correctly, because the final transformation that is applied goes along the lines of: final_transform = elec2common/templ2common, i.e. it uses the 'common' coordinate system as an intermediate coordinate system, to match up the template coordinate system with the one in which the electrodes are expressed. As long as this common coordinate system is the same, I would say it doesn't matter which one you take, you could even define the origin on the moon for that matter. Yet, I can confirm the wrong result with the default 'ctf', and the better result with the coordsys being 'neuromag' or 'itab'. I added an explicit call to ft_determine_coordsys for the elec-array, forcing the user to at least think about it.