Back to the main page.

Bug 1830 - merge the functionality of ft_sensorrealign, ft_electroderealign and ft_interactiverealign in one or two functions

Reported 2012-11-12 23:01:00 +0100
Modified 2019-08-10 12:41:24 +0200
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Mac OS
Importance: P3 normal
Assigned to:
Depends on:
See also:

Jan-Mathijs Schoffelen - 2012-11-12 23:01:30 +0100

Robert Oostenveld - 2012-11-12 23:06:48 +0100

*** Bug 646 has been marked as a duplicate of this bug. ***

Jan-Mathijs Schoffelen - 2012-11-12 23:07:14 +0100

is het niet tijd om te gaan slapen?

Robert Oostenveld - 2012-11-12 23:10:11 +0100

ja, zegt Ilse ook net. En jij dan?

Jan-Mathijs Schoffelen - 2012-11-12 23:14:07 +0100

weer veel te weinig kunnen doen overdag, dus weer het gevoel het 's avonds te moeten inhalen. niet slim natuurlijk.

Lilla Magyari - 2012-11-12 23:53:49 +0100

(In reply to comment #4) I am also wondering why I am reading this now. :)

Robert Oostenveld - 2012-11-13 09:50:58 +0100

refreshed after a night sleep: I believe one of them is used in EEGLAB or SPM and therefore external compatibility was so important that new and incompatible ideas at a certain moment had to be implemented in another function. But I might be wrong here. It would make sense to consider the EEG and MEG case separately and to approach it from the conceptual level. For EEG there is a need for manual/interactive realignment and the need for non-affine transformations (i.e. non-linear fitting of the electrodes to the scalp surface). For EEG you can also imagine it being desirable to click on vitE capsules in an anatomical MRI. MEG only needs rigid-body transformations. In some cases it involves fitting headshapes to MRI-segmented scalp surfaces, and applying the transform on the MEG coils. It might also make sense to deal with head movements in the MEG version of this function. E.g. what is now done by ft_headmovement.

Lilla Magyari - 2013-03-10 16:58:55 +0100

(In reply to comment #6) hi Robert, is your conclusion than to use ft_sensorrealign for MEG and ft_electroderealign for EEG? I am asking this because I recently committed changes on ft_electroderealign (e.g: alignment of electrodes to FEM headmodels, and output/input have to contain also elecpos) which are not incorporated into ft_sensrealign. Although the reference documentation of ft_sensrealign says now that it aligns also EEG electrodes. Other option could be that ft_sensrealign should be merged with ft_electroderealign and then it does EEG and also MEG alignment. Lilla (I assigned this bug for myself.)

Robert Oostenveld - 2013-03-10 18:39:57 +0100

(In reply to comment #7) Since the two are conceptually different, I think that we should call them ft_electroderealign and ft_gradiometerreallign. Having sens in the name suggests that it is a function that will work for either. There will be some shared code of course.

Lilla Magyari - 2013-07-23 22:13:12 +0200

I re-assign this to joint development user.

- 2014-07-09 13:41:05 +0200

Discussed in FT meeting: - ft_XXXrealign should not feature adding (or deleting) electrodes or fiducials, but only change their coordinates. - merge ft_sensor- and electroderealign, and throw an error if a non-rigid body transformation is applied on gradiometers

Jörn M. Horschig - 2015-01-07 11:03:18 +0100

resetting to default user, as I render it unlikely that I will work on this

Robert Oostenveld - 2015-11-11 09:03:51 +0100

this one was flagged as fixed, but the functions still exist. Also adding electrodes is still supported (which should not, see comment 10). Since I again ran into this issue related to bug 2837 (about ECoG electrodes), I now really want to get this out of the way!

Robert Oostenveld - 2015-11-11 15:01:19 +0100

mac011> svn commit *realign* test/inspect_ft_electroderealign.m test/test_ft_electroderealign.m Sending ft_electroderealign.m Sending ft_sensorrealign.m Adding test/inspect_ft_electroderealign.m Deleting test/test_ft_electroderealign.m Transmitting file data ... Committed revision 10872. I merged the two functions, trying to pick the best functionality from either one throughout. I realised from the code that all code assumed electrodes and no code was specifically in place for gradiometers. Hence I removed the mentioning of gradiometers from the documentation. There might be a few methods that will work for gradiometers. I removed the manual electrode placement by poking on the surface. I added a deprecation warning to ft_sensorrealign. We should not further support or improve that function any more, all effort should be aimed at ft_electroderealign.

Robert Oostenveld - 2015-11-11 15:03:05 +0100

I made a new function (actually Arjen made it, I only added it) for electrode placement (e.g. by poking the surface or a CT/MRI). mac011> svn commit ft_electrodeplacement.m Adding ft_electrodeplacement.m Transmitting file data . Committed revision 10873. See also bug 2837.

Robert Oostenveld - 2017-08-17 17:34:43 +0200

I cleaned up ft_interactiverealign: [bug1830-realign 8ca95dd] cleaned up the impplementation of ft_interactiverealign, made it more consistent for the different individual and template objects, made the plotting styles more flexible (defaults stay the same), ensure that the top/bottom/left/right viewpoints are consistent with the template coordsys, removed possibility of plotting MRI as montage (since that does not make sense) 3 files changed, 285 insertions(+), 146 deletions(-) create mode 100644 private/setviewpoint.m create mode 100644 test/inspect_bug1830.m

Robert Oostenveld - 2017-08-22 18:27:28 +0200

[bug1830-realign a828d75] first complete implementation of FT_MESHREALIGN, supporting three methods. Added example code to test script. See 2 files changed, 1007 insertions(+), 9 deletions(-) create mode 100644 ft_meshrealign.m

Robert Oostenveld - 2017-08-29 12:56:23 +0200

discussing with JM, we identified three additional items 1) ft_convert_units is used in scripts and should remain backward compatible 2) the fiducial clicking is similar to electrode clicking and should become shared code 3) the cfg.method between the different ft_xxxrealign should become consistent for 'interactive' and 'fiducial' Only item 1 will still be done in this issue and will be merged together with I will make separate issues for item 2 and 3.

Robert Oostenveld - 2017-08-30 10:53:55 +0200

I have merged, which r3esolves this bug. See 3340 and 3341 to follow up the other issues.

Robert Oostenveld - 2019-08-10 12:35:11 +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

Robert Oostenveld - 2019-08-10 12:41:24 +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