[FieldTrip] ft_volumereslice rotates the brain, how to fix?

Andrew Chang changa5 at mcmaster.ca
Mon Mar 6 19:04:31 CET 2017

Dear Fieldtrip users,

I am following the tutorial (
http://www.fieldtriptoolbox.org/tutorial/natmeg/dipolefitting) to work on
coregistering the anatomical MRI (using colin27 template) to the EEG
coordinate system, and then reslicing the MRI on to a cubic grid. However,
I found that the ft_volumereslice rotates the MRI image, which seems weird.

This is the sourceplot of the realigned MRI (from the 'mri_realigned2'
variable, see the code below):
[image: Inline image 1]

However, this is the sourceplot of the resliced MRI, which was rotated in 3
dimensions (from the 'mri_resliced' variable, see the code below):
[image: Inline image 3]

I found that this rotation effect can be modulated by adjusting the
parameters [rotation, scale, translate] on xyz dimensions, when I use the
'headshap' method for ft_volumerealign (see the code below). However, the
effect of adjusting these parameters seems not to be linear or intuitive at
all, and I cannot find the best combination to fix the rotation problem.

Any advice or help would be much appreciated! Thank you all in advance!

Here is the .mat file of what I have done:

Here is my code
%% load MRI
[mri_orig] = ft_read_mri('colin27_t1_tal_lin.nii');

%% load elec locations
% I do not have the channel location or the headshape file, so I use a
template cap to build the channel locations and headshape
sphcoor = [Theta,Phi]';
cartcoor = elp2coor(sphcoor,10)'; % converting theta/phi coorfinates into
elec.elecpos = cartcoor;
elec.chanpos = cartcoor;
elec.label = ChannelName; % 'ChannelName' is a cell array of channel labels
elec.unit = 'cm';

shape.pos = elec.elecpos;
shape.label = elec.label;
shape.unit = elec.unit ;
shape.coordsys = 'spm';

%% Coregister the anatomical MRI to the EEG coordinate system
cfg = [];
cfg.method = 'interactive';
cfg.coordsys = 'spm';
[mri_realigned1] = ft_volumerealign(cfg, mri_orig);

cfg = [];
mri_realigned2 = [];
cfg.method = 'headshape';
cfg.coordsys = 'spm';
cfg.headshape = shape;
[mri_realigned2] = ft_volumerealign(cfg, mri_orig);
% key in the following parameter for controlling the alignment
% rotation: [0,0,0.5]
% scale: [0.95, .8, .8]
% translate: [0, 15, 0]

cfg = [];
cfg.resolution = 1;
cfg.xrange = [-100 100];
cfg.yrange = [-110 110];
cfg.zrange = [-50 120];
mri_resliced = ft_volumereslice(cfg, mri_realigned2);


Andrew Chang, Ph.D. Candidate
Vanier Canada Graduate Scholar

Auditory Development Lab
Department of Psychology, Neuroscience & Behaviour
McMaster University
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170306/b463ab97/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: realigned.jpg
Type: image/jpeg
Size: 157286 bytes
Desc: not available
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170306/b463ab97/attachment-0002.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: resliced.jpg
Type: image/jpeg
Size: 145531 bytes
Desc: not available
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170306/b463ab97/attachment-0003.jpg>

More information about the fieldtrip mailing list