Back to the main page.

Bug 1899 - ft_read_mri -- errors when reading neuromag fiff mri files other then 1mm resolution

Reported 2012-12-17 17:58:00 +0100
Modified 2013-01-16 14:20:02 +0100
Product: FieldTrip
Component: fileio
Version: unspecified
Hardware: All
Operating System: All
Importance: P3 major
Assigned to: Jan-Mathijs Schoffelen
Depends on:
See also:

Luke - 2012-12-17 17:58:07 +0100

around line 201 in ft_read_mri there is a matlab shift introduced to correct different indexing schemes between matlab and C. matlab_shift = [ 0 0 0 0.001; 0 0 0 -0.001; 0 0 0 0.001; 0 0 0 0]; % transform transforms from 2001 to 5 and further to 4 transform = transform\(hdr.voxel_trans.trans+matlab_shift); %end code this inputs a physical shift of 1 mm in the origin of each dimension. this only works with 1mm resolution mris and would have problems with oblique mris as well. I better approach would be to introduce the shift in voxel coordinates ie to map voxel (1,1,1) to voxel (0,0,0) this could be accomplished like this: matlab_shift = eye(4); matlab_shift(1:3,4) = [-1,-1,-1]; transform = transform\(hdr.voxel_trans.trans * matlab_shift); Best regards, Luke

Jan-Mathijs Schoffelen - 2012-12-31 08:43:50 +0100

Hi Luke, Thanks for finding this out. I CC this bug to Burkhard Maess, who contributed the original patch to deal with transformation matrices in fif-mris. I'd be happy to incorporate your suggested change, but I suggest to involve Burkhard in this. If Burkhard agrees too, I'll do it. I don't have fif-mris available myself, so I have to rely on you guys in this. Cheers, JM

Burkhard Maess - 2013-01-03 08:58:07 +0100

Hi Luke and Jan-Mathijs , I also like to thank Luke for this correction. I will be happy to find it in the new version. all the best and a Happy New Year, Burkhard

Jan-Mathijs Schoffelen - 2013-01-03 09:15:24 +0100

Patch as suggested included in revision 7274. @ Luke: could you test and report back whether it works as intended, so I can close the bug? @ both: happy new year to you too!

Luke - 2013-01-03 14:54:01 +0100

Hi JM and Burkhard, The patch did the job, you can close the bug. thank you for the help. Happy new year to you both. Best Luke