Back to the main page.

Bug 2986 - ft_volumerealign fails when realigning mri and headshape in 'cm'

Reported 2015-10-16 10:27:00 +0200
Modified 2019-08-10 12:32:21 +0200
Product: FieldTrip
Component: forward
Version: unspecified
Hardware: PC
Operating System: Mac OS
Importance: P5 minor
Assigned to:
Depends on:
See also:

Philipp Ruhnau - 2015-10-16 10:27:50 +0200

Created attachment 742 test script and head shape Hey Fieldtrip-friends, I think I've stumbled about this a few times and because there is a sort of easy fix I never reported it. in short: when realigning a structural scan to a headshape and both are in cm the realignment fails (see attached example). this does not happen, when both structures are initially transformed to mm... my bet is that the headshape is transformed to mm somewhere in ft_volumerealign (around lines 550 ff?) but not the mri (for the output), so the transformation matrix is affected in a wrong way (another hint for this is that the interactive plot looks fine, which works on a headshape and scalp model in mm within the function). As I said the workaround is to just have everything in mm (which is a bit inconvenient because the default for headmodels is cm...) and then later convert it to whatever you want. Of course you always have to check this, but if people assume that what they see in the interactive plot is what they get out, and they don't do another check on the actual output, they end up with misaligned data. notabene: I couldn't append the mri file which I had the problem with so I loaded the standard_mri from fieldtrip and converted to cm to illustrate the point. luckily the standard mri and this headshape match quite well ;) best philipp

Jan-Mathijs Schoffelen - 2015-10-16 13:28:47 +0200

Hi Philipp, Thanks for reporting this and your detailed diagnosis. We'll try and look into this as soon as possible. For now, it seems you have a work around :o).

Jan-Mathijs Schoffelen - 2016-07-04 22:36:17 +0200

OK, I think I nailed this one. It's a bit silly that there's an intermediate conversion to 'mm' units for the headshape. If it's ensured that the units are the same as the MRI, all seems to go well. I'll test a bit more.

Jan-Mathijs Schoffelen - 2016-07-05 12:31:55 +0200

I just pulled a pull request that fixes this, I think. Feel free to re-open if the problem persists

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