<div dir="ltr">
<div class="" lang="x-western">
<div class="" style="font-family:-moz-fixed;font-size:14px" lang="x-western">Dear Fieldtrippers!
<br>
As newbie I have another question, now concerning the warping from
MNI to individual subjects.
<br>
Using the below code (the first part almost entirely from <a class="" href="http://fieldtrip.fcdonders.nl/example/create_single-subject_grids_in_individual_head_space_that_are_all_aligned_in_mni_space">http://fieldtrip.fcdonders.nl/example/create_single-subject_grids_in_individual_head_space_that_are_all_aligned_in_mni_space</a>),
I get first the template and then apply the grid to the individual
subjects.
<br>
However, in later on analysis step it turned out that while the
subjects where nicely similar positioned, the template position is
entirely different, as it is was even axes were exchanged...
<br>
Does anybody know what could be the reason and how to change it?
<br>
Thanks for any suggestions!
<br>
Best, Meike
<br>
<br>
<br>
% NOTE: the path to the template file is user-specific
<br>
template =
ft_read_mri('fieldtrip/fieldtrip-20140316/external/spm8/templates/T1.nii');<br>
template.coordsys = 'spm'; % so that FieldTrip knows how to
interpret the coordinate system
<br>
<br>
% segment the template brain and construct a volume conduction
model (i.e. head model): this is needed
<br>
% for the inside/outside detection of voxels.
<br>
cfg = [];
<br>
template_seg = ft_volumesegment(cfg, template);
<br>
<br>
cfg = [];
<br>
cfg.method = 'singleshell';
<br>
template_vol = ft_prepare_headmodel(cfg, template_seg);
<br>
template_vol = ft_convert_units(template_vol, 'cm'); % Convert the
vol to cm, since the grid will also be expressed in cm
<br>
<br>
% construct the dipole grid in the template brain coordinates
<br>
% the source units are in cm
<br>
% the negative inwardshift means an outward shift of the brain
surface for inside/outside detection
<br>
cfg = [];
<br>
cfg.grid.xgrid = -20:1:20;
<br>
cfg.grid.ygrid = -20:1:20;
<br>
cfg.grid.zgrid = -20:1:20;
<br>
cfg.grid.unit = 'cm';
<br>
cfg.grid.tight = 'yes';
<br>
cfg.inwardshift = -1.5;
<br>
cfg.vol = template_vol;
<br>
template_grid = ft_prepare_sourcemodel(cfg);
<br>
save('../analysis/MEG/source_analysis/MNI','template_grid','template_vol','template_seg','template')
<br>
% make a figure with the template head model and dipole grid
<br>
figure
<br>
hold on
<br>
ft_plot_vol(template_vol, 'facecolor', 'cortex', 'edgecolor',
'none');alpha 0.5; camlight;
<br>
ft_plot_mesh(template_grid.pos(template_grid.inside,:));
<br>
else
load('../analysis/MEG/source_analysis/MNI','template_grid','template_vol','template_seg','template')<br>
<br>
<br>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
<br>
SUBJECTS={ 'VP02' 'VP03' 'VP04' 'VP05' 'VP06'
'VP07' 'VP08' 'VP09' 'VP11' 'VP12' 'VP13' 'VP14'
'VP15' 'VP16' 'VP17' 'VP18'}
<br>
<br>
for SUBJI=SUBJECTS
<br>
SUBJ=SUBJI{1};
<br>
% read the single subject anatomical MRI
<br>
load(['..<i class=""><span class="">/</span>analysis/MEG/source_analysis<span class="">/</span></i>',SUBJ,'/mri']); %Has been
processed to CFT coordinates before
<br>
load(['..<i class=""><span class="">/</span>analysis/MEG/source_analysis<span class="">/</span></i>',SUBJ,'/segmentedmri']);
<br>
<br>
<br>
cfg = [];
<br>
cfg.method = 'singleshell';
<br>
vol = ft_prepare_headmodel(cfg, segmentedmri);
<br>
<br>
% create the subject specific grid, using the template grid that
has just been created
<br>
cfg = [];
<br>
cfg.grid.warpmni = 'yes';
<br>
cfg.grid.template = template_grid;
<br>
cfg.grid.nonlinear = 'yes'; % use non-linear normalization
<br>
cfg.mri = mri_ra;
<br>
grid = ft_prepare_sourcemodel(cfg);
<br>
<br>
% make a figure of the single subject headmodel, and grid
positions
<br>
figure;
<br>
ft_plot_vol(vol, 'edgecolor', 'none'); alpha 0.4; %camlight
<br>
ft_plot_mesh(grid.pos(grid.inside,:));
<br>
<br>
save(['..<i class=""><span class="">/</span>analysis/MEG/source_analysis<span class="">/</span></i>',SUBJ,'/MNIgrid'],'grid','vol')
<br>
end
<br>
<br>
</div>
</div>
</div>