[FieldTrip] Registration of neuromag data

Konstantinos Tsilimparis konstantinos.tsilimparis at outlook.com
Fri Nov 15 11:46:47 CET 2024


Hi Alex,

I believe there might be an issue with the logic you're using.

You move the three fiducials from the headshape space to the MRI space. Subsequently you define the MRI coordinate system based on these three fiducials. However, that does not guarantee that your transformed headshape fiducials correspond to the actual nasion, LPA, and RPA in the MRI space. You can plot nas_voxel_mriread, lpa_voxel_mriread, rpa_voxel_mriread together with your MRI to see if these points correspond to the actual nasion, LPA, and RPA in the MRI space.

I suggest you first define the fiducials directly in the MRI space using ft_volumerealign with cfg.method = 'interactive'. Once you've done that, you'll have three points in the MRI space and three corresponding points in the head shape which you can then co-register.

Best regards,
Konstantinos

From: fieldtrip <fieldtrip-bounces at science.ru.nl> On Behalf Of Alex Williams via fieldtrip
Sent: Thursday, November 14, 2024 7:26 PM
To: FieldTrip discussion list <fieldtrip at science.ru.nl>
Cc: Alex Williams <alexanderwil2024 at my.fit.edu>
Subject: [FieldTrip] Registration of neuromag data

Hi there FieldTrip community,

  I was curious if anyone would be familiar with an issue I came across within my study. I'm currently using an lcmv beamformer for source reconstruction of several subjects within the CamCan data set using their MEEG data. Right now, I'm currently looking back into the process of coregistration once more. The meeg data and headshape data I have use neuromag coordinates and I believe the coordinates of the fiducials are in voxel-coordinates. For all of the subjects, I get a coregistered orientation that seems to be tilted relative to the sensor array.

 I'm unsure if this would be the correct orientation based on what I've seen from previous head model orientations. However, since I'm unfamiliar with how the head would be oriented within a neuromag system, I was wondering if there was any way to confirm that this orientation would be correct or if there may be something that needs to be rectified in the code for proper orientation.

Here is the code I used for coregistration to acquire the image above:
%% Realign Coord Sys.
function mrialign=coregistration(Path1,Path2,mriread,S,job)
addpath /Users/alexanderwil2024/MATLAB-Drive/Research/MATLAB code/Beamformer Pipeline
cfg=[];
headshape=ft_read_headshape([Path1 Path2]);
headshape=ft_convert_coordsys(headshape,'neuromag');
vox2vox = inv(mriread.transform);
nas_voxel_mriread      = ft_warp_apply(vox2vox, headshape.fid.pos(2,:), 'homogenous'); % nasion
lpa_voxel_mriread      = ft_warp_apply(vox2vox, headshape.fid.pos(1,:), 'homogenous'); % Left preauricular
rpa_voxel_mriread      = ft_warp_apply(vox2vox, headshape.fid.pos(3,:), 'homogenous'); % Right preauricular

cfg=[];
nas1=nas_voxel_mriread;
lpa1=lpa_voxel_mriread;
rpa1=rpa_voxel_mriread;
cfg.fiducial.nas=nas1;
cfg.fiducial.lpa=lpa1;
cfg.fiducial.rpa=rpa1;
cfg.coordsys='neuromag';
cfg.method='fiducial';
mrialign = ft_volumerealign(cfg, mriread);
ft_sourceplot([],mrialign);

cfg=[];
cfg.method='headshape';
cfg.spmversion='spm12';
cfg.headshape.headshape=headshape;
cfg.headshape.interactive    = 'no';
mrialign=ft_volumerealign(cfg, mrialign);

% ********FOR VISUALIZING CO-REGISTRATION: IMPORTANT FOR FIDUCIALS!!!
% cfg=[];
% cfg.method='headshape';
% cfg.spmversion='spm12';
% cfg.headshape.headshape=headshape;
% cfg.headshape.interactive    = 'yes';
% ft_volumerealign(cfg, mrialign);

cfg=[];
cfg.parameter='anatomy';
cfg.filename=['/Volumes/My Book/coreg_mri_niftis/mrialign ',S,' for job ',job];
cfg.filetype='nifti';
ft_volumewrite(cfg,mrialign);
close all
o=1;
end
  In this code, mriread refers to the subject's raw MRI nifti data after being read in. tably, after the first use of volumerealign within the code to apply the fiducials from the mri nifti (mrialign = ft_volumerealign(cfg, mriread)), I use it again to apply a headshape-based method. I obtain this sagitally tilted positioning when using this setup:

[cid:image001.png at 01DB3752.9B4AD420]

  For additional reference, if I were to only use the first instance of the volumerealign function to apply the fiducials to mriread without using the second instance to apply the headshape method, I would obtain this coregistered model, which seem properly oriented but slightly removed from the sensor array:

[cid:image002.png at 01DB3752.9B4AD420]
Additionally, the vox2vox transform matrix inverts mriread's transform matrix to create the following coregistered positions. However, when the vox2vox transform doesn't use the inverted transform (vox2vox =mriread.transform) and applies the full code with both volumerealign methods, it leads to a coronally tilted positioning:

[cid:image003.png at 01DB3752.9B4AD420]



-Alex

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20241115/482a8c2c/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 128564 bytes
Desc: image001.png
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20241115/482a8c2c/attachment-0003.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 129047 bytes
Desc: image002.png
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20241115/482a8c2c/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image003.png
Type: image/png
Size: 143317 bytes
Desc: image003.png
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20241115/482a8c2c/attachment-0005.png>


More information about the fieldtrip mailing list