[FieldTrip] Registration of neuromag data
Schoffelen, J.M. (Jan Mathijs)
janmathijs.schoffelen at donders.ru.nl
Fri Nov 15 13:29:48 CET 2024
Sorry if I was unclear Alex, with ‘figure 3’ I meant the first figure in your e-mail, i.e. the one which correctly uses the inverse of the transformation matrix, to express the fiducials in voxel coordinates, and then correctly updates the mri’s transformation matrix.
Best wishes,
Jan-Mathijs
On 15 Nov 2024, at 13:13, Alex Williams <alexanderwil2024 at my.fit.edu> wrote:
You don't often get email from alexanderwil2024 at my.fit.edu. Learn why this is important<https://aka.ms/LearnAboutSenderIdentification>
Hi Jan-Mathijs,
Thanks so much for your response! So the third image uses both volumerealigns but uses a non-inverted transform from mriread. The only image that uses only one call to volumerealign applying the fiducial method is image two, but it applies an inverted transform from mriread. But was hoping to confirm that the third image would be the best for coregistration in this case.
-Alex
On Fri, Nov 15, 2024, 05:32 Schoffelen, J.M. (Jan Mathijs) via fieldtrip <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>> wrote:
Hi Alex,
To be honest, I have the impression that what you plotted in ‘figure 3’ makes sense.
The other ones don’t make sense, because the sensors are expressed in neuromag space (I assume) so the ‘brain’ needs to be brought into neuromag space as well, which is what you do with your first call to ft_volumerealign. Unless I am missing something.
Best wishes,
Jan-Mathijs
On 14 Nov 2024, at 19:26, Alex Williams via fieldtrip <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>> wrote:
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:
<Both volumerealigns.png>
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:
<Only fiducial volumerealign.png>
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:
<image.png>
-Alex
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmailman.science.ru.nl%2Fmailman%2Flistinfo%2Ffieldtrip&data=05%7C02%7Cfieldtrip%40science.ru.nl%7C96c0a6c5167a471866a708dd05713214%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638672705901496422%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=dF9Kp2cG%2FJt0Zx7NXoyBx6kPF7j9bEdOnXhgB3dF7DY%3D&reserved=0>
https://doi.org/10.1371/journal.pcbi.1002202<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdoi.org%2F10.1371%2Fjournal.pcbi.1002202&data=05%7C02%7Cfieldtrip%40science.ru.nl%7C96c0a6c5167a471866a708dd05713214%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638672705901652665%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=NIJnAxgGiaiUu4eEoxvjvgtSS2C%2BsxCNoQDzvx7P8Mk%3D&reserved=0>
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmailman.science.ru.nl%2Fmailman%2Flistinfo%2Ffieldtrip&data=05%7C02%7Cfieldtrip%40science.ru.nl%7C96c0a6c5167a471866a708dd05713214%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638672705901652665%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=J89fCc2hy19y7SLxubJebs5gKfW%2FYJUBUM6kg7m7J0s%3D&reserved=0>
https://doi.org/10.1371/journal.pcbi.1002202<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdoi.org%2F10.1371%2Fjournal.pcbi.1002202&data=05%7C02%7Cfieldtrip%40science.ru.nl%7C96c0a6c5167a471866a708dd05713214%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638672705901652665%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=NIJnAxgGiaiUu4eEoxvjvgtSS2C%2BsxCNoQDzvx7P8Mk%3D&reserved=0>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20241115/8db30802/attachment.htm>
More information about the fieldtrip
mailing list