[FieldTrip] Problem with coordinate systems when creating head model
Maria Hakonen
maria.hakonen at gmail.com
Fri Aug 18 16:01:14 CEST 2017
Dear fieldtrip experts,
I would need to create a volume conduction model of the head using
standard_mri.m. standard_mri.m is in the spm coordinate system and my MEG
data in the neuromag system. To get all data in the same coordinate system,
I have converted standard_mri.m to neuromag using ft_volumerealign.
However, ft_volumesegment converts MRI back to spm.
Could someone please let me know how I can get the head model and MEG data
in the same coordinate system?
I really appreciate any help you can provide!
Here is what I have tried:
mri is in spm coordinate system:
mri =
dim: [181 217 181]
anatomy: [181x217x181 uint8]
transform: [4x4 double]
hdr: [1x1 struct]
unit: 'mm'
coordsys: 'spm'
Check fiducials for ft_volumerealign:
hs=ft_read_headshape('aml_sentences16b_raw_tsss.fif', 'unit','mm');
hs.fid.pos
ans =
-66.1226 0.0000 -0.0000
-0.0000 83.5082 -0.0000
67.1784 -0.0000 -0.0000
hs.fid.label
ans =
'LPA'
'Nasion'
'RPA'
cfg = [];
cfg.method= 'fiducial';
cfg.fiducial.nas = [-0.0000 83.5082 -0.0000];
cfg.fiducial.lpa = [-66.1226 0.0000 -0.0000];
cfg.fiducial.rpa = [67.1784 -0.0000 -0.0000];
cfg.coordsys= 'neuromag';
cfg.headshape = hs;
mri_realigned = ft_volumerealign(cfg, mri);
mri_realigned seems to be in neuromag system as it should be.
mri_realigned =
dim: [181 217 181]
anatomy: [181x217x181 uint8]
transform: [4x4 double]
hdr: [1x1 struct]
unit: 'mm'
coordsys: 'neuromag'
inside: [181x217x181 logical]
transformorig: [4x4 double]
cfg: [1x1 struct]
However, ft_volumesegment converts it back to spm system:
cfg = [];
cfg.output = 'brain';
cfg.coordsys = 'neuromag';
segmentedmri = ft_volumesegment(cfg, mri_realigned);
Warning: The option cfg.coordsys is deprecated, support is no longer
guaranteed
> In ft_checkconfig (line 168)
In ft_volumesegment (line 170)
the input is volume data with dimensions [181 217 181]
Converting the coordinate system from neuromag to spm
I also tried to convert MEG data to spm system as follows:
hdr = ft_read_header('aml_sentences16b_raw_tsss.fif', 'unit','mm');
cfg = [];
cfg.method= 'fiducial';
cfg.target.pos(1,:) = [1 0 0];
cfg.target.pos(1,:) = [0 83 0];
cfg.target.pos(1,:) = [0 -117 0];
cfg.target.lab = {'NAS', 'LPA', 'RPA'};
cfg.grad = hdr.grad;
mri_realigned = ft_sensorrealign(cfg);
… but got:
Warning: FT_SENSORREALIGN is deprecated, please use FT_ELECTRODEREALIGN
instead.
> In ft_sensorrealign (line 118)
using gradiometers specified in the configuration
Reference to non-existent field 'label'.
Error in ft_datatype_sens (line 148)
nchan = length(sens.label);
Error in ft_sensorrealign (line 247)
tmp(i) = ft_datatype_sens(template(i)); % ensure up-to-date
sensor description
template(i) seems to be as follows:
ans =
pos: [0 -117 0]
lab: {'NAS' 'LPA' 'RPA'}
I think that ft_electroderealign only works with EEG data since it gives:
mri_realigned = ft_electroderealign(cfg);
Warning: The field cfg.headshape is forbidden, it will be removed from your
configuration
> In ft_checkconfig (line 215)
In ft_electroderealign (line 212)
using gradiometers specified in the configuration
Reference to non-existent field 'elecpos'.
Error in ft_electroderealign (line 254)
assert(isequaln(elec_original.elecpos, elec_original.chanpos), 'this
function requires same electrode and channel
positions.');
Best,
Maria
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170818/af73064b/attachment-0001.html>
More information about the fieldtrip
mailing list