Back to the main page.

Bug 1828 - ft_convert_coordsys fails with particular input MRI dimensionality

Reported 2012-11-08 16:48:00 +0100
Modified 2012-12-18 14:20:05 +0100
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Mac OS
Importance: P3 normal
Assigned to: Jan-Mathijs Schoffelen
Depends on:
See also:

Jan-Mathijs Schoffelen - 2012-11-08 16:48:12 +0100

My first hunch is, that the function relies on some baked-in voxel coordinates, which only make sense with a baked-in dimension. Let's check...

Robert Oostenveld - 2012-11-08 17:52:19 +0100

I am curious as to the data on which it fails. How obscure is it?

Jan-Mathijs Schoffelen - 2012-11-08 18:13:43 +0100

hcp-data. do I need to say more? ;-) Not obscure at all. 176x256x256 anatomical, with the 176 dimension being the left right axis. My early hunch by the way was not correct, but I have been trying to debug this one for the past 2 hours or so. :-( align_ctf2spm does not seem to provide a sufficiently close coregistration.

Jan-Mathijs Schoffelen - 2012-11-09 10:40:21 +0100

When the MRI is resliced, the affine registration is improved, but still not perfect. It is however good enough for the segmentation to produce a 'normal' output. As of yet, this is still quite anecdotal, will upload some data soon.

Jan-Mathijs Schoffelen - 2012-11-12 11:45:15 +0100

OK, it seems that the way spm_affreg is used in align_ctf2spm does not work super-robustly. Created bug1828.mat on /home/common/matlab/fieldtrip/data/test

Jan-Mathijs Schoffelen - 2012-11-12 12:11:08 +0100

Created attachment 369 axial slice with AC identified in red

Jan-Mathijs Schoffelen - 2012-11-12 12:11:53 +0100

Created attachment 370 axial slice with AC according to opt=0 (one-step coregistration)

Jan-Mathijs Schoffelen - 2012-11-12 12:12:25 +0100

Created attachment 371 axial slice with AC according to opt=1 (spm_affreg)

Jan-Mathijs Schoffelen - 2012-11-12 12:12:50 +0100

Created attachment 372 axial slice with AC according to opt=2 (spm_normalise)

Jan-Mathijs Schoffelen - 2012-11-12 12:15:05 +0100

bash-3.2$ svn commit ft_convert_coordsys.m private/align_ctf2spm.m ../test/test_bug1828.m Adding test/test_bug1828.m Sending utilities/ft_convert_coordsys.m Sending utilities/private/align_ctf2spm.m Transmitting file data ... Committed revision 6906. added (as of yet) undocumented option opt to ft_convert_coordsys that determines its behavior opt = 0: plain coregistration using only approximate fiducial locations opt = 1: initial rough estimate followed by spm_affreg opt = 2: initial rough estimate followed by spm_normalise FIXME: this should be also built into align_itab2spm

Jan-Mathijs Schoffelen - 2012-11-12 12:16:57 +0100

the distance (in voxel units) between the anatomically defined AC and the coregistration matrix based 'AC' is 40.8 (using opt = 0), 34.9 (using opt=1), and 5.8 (using opt=2), for the test data

Jan-Mathijs Schoffelen - 2012-11-28 15:53:27 +0100

jan2-mac:utilities jan$ svn commit -m "enhancement - added more robust functionality for coregistration also for itab2spm conversion" ft_convert_coordsys.m private/align_itab2spm.m Sending ft_convert_coordsys.m Sending private/align_itab2spm.m Transmitting file data .. Committed revision 7035.

Eelke Spaak - 2012-12-18 14:20:05 +0100

Test script was failing because spm() could not be found. I now added ft_hastoolbox('SPM8',1) to the script.