[FieldTrip] rpa/nas/lpa coordinates

Elena Orekhova Elena.Orekhova at neuro.gu.se
Mon May 23 12:03:11 CEST 2011

Dear Robert, 
As you advised, I tried to use 'ft_determine_coordsys' to look at my non-segmented MRI, but got the error (see below).
What can be the reason?


>> mri

mri = 

          dim: [512 512 180]
      anatomy: [512x512x180 int16]
          hdr: [1x1 struct]
    transform: [4x4 double]
         unit: 'm'

>> [dataout] = ft_determine_coordsys(mri)
??? Error using ==> surface
Z must be a matrix, not a scalar or vector

Error in ==> ft_plot_slice at 184
h      = surface(Xh, Yh, Zh, V);

Error in ==> ft_plot_ortho at 94
  hx = ft_plot_slice(dat, varargin{:});

Error in ==> ft_determine_coordsys at 192
  ft_plot_ortho(data.(funparam), 'transform', data.transform, 'resolution', 1,
  'style', 'intersect');

From: fieldtrip-bounces at donders.ru.nl [fieldtrip-bounces at donders.ru.nl] on behalf of Robert Oostenveld [r.oostenveld at donders.ru.nl]
Sent: Monday, May 23, 2011 9:33 AM
To: Email discussion list for the FieldTrip project
Subject: Re: [FieldTrip] rpa/nas/lpa coordinates

Dear Elena

> On 21 May 2011, at 14:11, Elena Orekhova wrote:
>> Hi
>> I Just started to use Fieldtrip with my Neuromag MEG data and try
>> to follow  the example script
>> ‘read_neuromag_mri_and_create_single-
>> subject_grids_in_individual_head_space_that_are_all_aligned_in_mni_space
I don't know all details of the Neuromag system, but recently we did
add the http://fieldtrip.fcdonders.nl/getting_started/yokogawa
documentation that explains reasonably general how coordinate system
coregistration works. We also added a new function (FT_SENSORREALIGN)
to ease the coregistration and we are working towards a more
consistent representation of the corodinate systems in the relevant
fieldtrip data structures.

Although the details for your system are different (see http://fieldtrip.fcdonders.nl/faq/how_are_the_different_head_and_mri_coordinate_systems_defined)
, you might get a better overview of the steps that are involved by
reading the yokogawa getting started.

> The instruction suggests to take voxel coordinates of fiduscials
> from the Neuromag
> GUI for MRI-MEG Integration. I have already performed this step and
> saved the
> transformed mri in the /sets/XXX.fif file.

I suggest you use the FT_DETERMINE_COORDSYS to perform a visual
inspection of the coordinate systems of your anatomical MRI and of
your sensor positions (data.grad, or you can use FT_READ_SENS to read
them directly from the MEG fif file). Note that you have to use the
function twice (on the mri and on the grad) and compare the figures

>  Should I write any  rpa/nas/lpa coordinates in this case?
> cfg.fiducial.rpa  = [y x z];
> cfg.fiducial.nas  = [y x z];
> cfg.fiducial.lpa  = [y x z];

if you need them (see above), then these should be [x y z] and not [y
x z].

> I have 2 4X4 transformations in the .fif file, not sure what they
> mean.

Please read this page, which is a general introduction.

> mri.hdr.trans.trans
> 0.9913    0.1210    0.0518   -0.0032
>    -0.0948    0.9291   -0.3574    0.0254
>    -0.0914    0.3494    0.9325   -0.0519
>          0         0         0    1.0000
> mri.hdr.voxel_trans.trans
>    -0.0000   -0.0000   -0.0010    0.1058
>    -0.0005    0.0000    0.0000    0.1597
>          0   -0.0005    0.0001    0.1058
>          0         0         0    1.0000

the mri header is system specific, so I am not sure. But I guess that
the first is the homogenous transformation matrix in head coordinates
(linked to the fiducials) and the second is the homogenous
transformation matrix in MRI coordinates. The first one appears to be
in mm, the second one in meter.

Please try

mri.transform = mri.hdr.voxel_trans.trans;
ft_determine_coordsys(mri)  % press ctrl-c

mri.transform = mri.hdr.trans.trans;
ft_determine_coordsys(mri)  % press ctrl-c

The two figures will show you the origin, the direction of axes of the
coordinate system and the scale.

best regards,

fieldtrip mailing list
fieldtrip at donders.ru.nl

More information about the fieldtrip mailing list