<div dir="ltr">Dear Fieldtrip users,<div><br></div><div>I am following the tutorial (<a href="http://www.fieldtriptoolbox.org/tutorial/natmeg/dipolefitting">http://www.fieldtriptoolbox.org/tutorial/natmeg/dipolefitting</a>) 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.</div><div><br></div><div>This is the sourceplot of the realigned MRI (from the 'mri_realigned2' variable, see the code below):</div><div><img src="cid:ii_15aa4aab1e042fc6" alt="Inline image 1" width="552" height="414" style="margin-right: 0px;"><br></div><div><br></div><div>However, this is the sourceplot of the resliced MRI, which was rotated in 3 dimensions (from the 'mri_resliced' variable, see the code below):</div><div><img src="cid:ii_15aa4ba9c2b609f8" alt="Inline image 3" width="552" height="414" style="margin-right: 0px;"><br></div><div><br></div><div>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. </div><div><br></div><div>Any advice or help would be much appreciated! Thank you all in advance!<br></div><div><br></div><div><br></div><div>Here is the .mat file of what I have done: <a href="https://www.dropbox.com/s/viazz1vaq8gjyqb/fixingRotationMRI.mat?dl=0">https://www.dropbox.com/s/viazz1vaq8gjyqb/fixingRotationMRI.mat?dl=0</a></div><div><br></div><div>Here is my code</div><div><font face="monospace, monospace">%% load MRI</font></div><div><font face="monospace, monospace">[mri_orig] = ft_read_mri('colin27_t1_tal_lin.nii');<br></font></div><div><font face="monospace, monospace"><br></font></div><div><div><font face="monospace, monospace">%% load elec locations</font></div><div><font face="monospace, monospace">% I do not have the channel location or the headshape file, so I use a template cap to build the channel locations and headshape</font></div><div><font face="monospace, monospace">load('chanCfg')</font></div><div><font face="monospace, monospace">sphcoor = [Theta,Phi]';</font></div><div><font face="monospace, monospace">cartcoor = elp2coor(sphcoor,10)'; % converting theta/phi coorfinates into xyz</font></div><div><font face="monospace, monospace">elec.elecpos = cartcoor;</font></div><div><font face="monospace, monospace">elec.chanpos = cartcoor;</font></div><div><font face="monospace, monospace">elec.label = ChannelName; % 'ChannelName' is a cell array of channel labels</font></div><div><font face="monospace, monospace">elec.unit = 'cm';</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">shape.pos = elec.elecpos;</font></div><div><font face="monospace, monospace">shape.label = elec.label;</font></div><div><font face="monospace, monospace">shape.unit = elec.unit ;</font></div><div><font face="monospace, monospace">shape.coordsys = 'spm';</font></div></div><div><font face="monospace, monospace"><br></font></div><div><div><font face="monospace, monospace">%% Coregister the anatomical MRI to the EEG coordinate system</font></div><div><font face="monospace, monospace">cfg = [];</font></div><div><font face="monospace, monospace">cfg.method = 'interactive';</font></div><div><font face="monospace, monospace">cfg.coordsys = 'spm';</font></div><div><font face="monospace, monospace">[mri_realigned1] = ft_volumerealign(cfg, mri_orig);</font></div></div><div><font face="monospace, monospace"><br></font></div><div><div><font face="monospace, monospace">cfg = [];</font></div><div><font face="monospace, monospace">mri_realigned2 = [];</font></div><div><font face="monospace, monospace">cfg.method = 'headshape';</font></div><div><font face="monospace, monospace">cfg.coordsys = 'spm';</font></div><div><font face="monospace, monospace">cfg.headshape = shape;</font></div><div><font face="monospace, monospace">[mri_realigned2] = ft_volumerealign(cfg, mri_orig);<br></font></div></div><div><font face="monospace, monospace">% key in the following parameter for controlling the alignment</font></div><div><font face="monospace, monospace"><div>% rotation: [0,0,0.5]</div><div>% scale: [0.95, .8, .8]</div><div>% translate: [0, 15, 0]</div></font></div><div><font face="monospace, monospace"><br></font></div><div><div><font face="monospace, monospace">cfg = [];</font></div><div><font face="monospace, monospace">cfg.resolution = 1;</font></div><div><font face="monospace, monospace">cfg.xrange = [-100 100];</font></div><div><font face="monospace, monospace">cfg.yrange = [-110 110];</font></div><div><font face="monospace, monospace">cfg.zrange = [-50 120];</font></div><div><font face="monospace, monospace">mri_resliced = ft_volumereslice(cfg, mri_realigned2);</font></div></div><div><br><br><br>Best,</div><div>Andrew<br clear="all"><div><br></div>-- <br><div class="gmail-m_-7274084066534655969gmail_signature"><div dir="ltr">Andrew Chang, Ph.D. Candidate<br>Vanier Canada Graduate Scholar<br><a href="http://changa5.wordpress.com/" target="_blank">http://changa5.wordpress.com/</a><br><br>Auditory Development Lab<br>Department of Psychology, Neuroscience & Behaviour<br>McMaster University</div></div></div></div>