[FieldTrip] Assistance with digitized electrodes and individual MRI alignment for EEG source analysis

Schoffelen, J.M. (Jan Mathijs) janmathijs.schoffelen at donders.ru.nl
Thu Mar 28 09:43:59 CET 2024


Hi Enrico,

Apologies for the late reply, I noticed that so far this message has not been followed up on. I hope that by now you have managed to solve your problems, but here are some pointers on the off chance that they are still helpful:


  1.
alignment of the individual MRI to a common coordinate system using fieldtrip function: using ft_volumerealing and manually marking relevant landmarks seem to effectively generate a transformation matrix and produce a partially aligned output; however, when I check the quality of the alignment, I can still see the head twisted (transversal view), reflecting (I assume) the position of the head in the scan. This twisting seems to be normalized only by ft_volumereslice, which however inclines forward the MRI in the sagittal view.
Why does this happen? Isn't the realignment step supposed adjust rotation and any other geometrical positioning related issues? Can we avoid the forward inclination produced by ft_volumereslice while still obtaining isometric voxels?
here's the code I used (note that it doesn't matter which landmarks and coord sys I choose, the problem persists)
     *
cfg          = [];
cfg.method   = 'interactive';
cfg.coordsys = 'ctf';
mri_aligned_fiducials = ft_volumerealign(cfg, mri);

I am not sure whether I completely follow, but 1) ft_volumerealign indeed adjusts only the transform field, and 2) ft_volumereslice indeed ‘recreates’ the volume, by sampling the anatomy at different voxel locations. The tilt that you describe is the consequence of the fact that ft_volumereslice aligns the ‘voxel’-axes of the volume with the ‘headcoordinate’-axes. Given that the ‘ctf’ convention head coordinate system has its origin somewhere in the vicinity of the brain’s pons, and has the x-axis going through the nasion, this indeed leads to a forward tilt. As such this shouldn’t be a problem for the downstream analysis, because the voxel-to-head coordinate transformation is kept consistent with this. Between the lines, it looks as if you might have a non-isotropic anatomical volume, where indeed it is desired to use ft_volumereslice to make the volume a bit better behaved in terms of voxel sizes. If you are still bothered by the tilt, and if the original mri volume (prior to the call to ft_volumerealign) has a well behaved coordinate system attached to it, you may consider reversing the order of the alignment and the reslicing (i.e. reslice first, and do the rest later). This may anyhow be the better order, because this ensures that the voxel coordinates of clicked fiducials are consistent with the volume that is used for further analysis. In other words, if you align first and then reslice, and use the resliced volume for some other stuff, the voxel coordinates of the fiducials are inconsistent.


     *

  1.
Alignement affination with head shape of the subject: as suggested by some tutorials (i.e., https://www.fieldtriptoolbox.org/workshop/oslo2019/forward_modeling/<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.fieldtriptoolbox.org%2Fworkshop%2Foslo2019%2Fforward_modeling%2F&data=05%7C02%7Cfieldtrip%40science.ru.nl%7C05c58818ba684441f30708dc4f03367e%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638472122432559296%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=qU4Q5oUm9jPfwtPkpEI54BKfjthttGU%2Fa1WMsWn0nxs%3D&reserved=0>)  I am trying to refine the alignment of the individual MRI (in order to improve the later co-registration with the electrodes) using the head shape points of the subject collected through the Polhemus. However, when I try this alignment, the head shape defined by the collected head points results way bigger and disproportioned as compared to the head shape generated by fieldtrip from the subject's MRI (I guess it'd correspond to the mesh of the scalp). Likewise, the position of the fiducials (e.g., nasion, l/r tragus) results challengingly inconsistent. This problem shows up also when later on I try to co-register the electrodes with the triangulated mesh of the scalp based on fiducials or manually, which as you can imagine does not provide a reliable accuracy. It seems the only way to overcome this aspect is changing the scaling of the MRI in the manual adjustment, which however leads to a loss in proportion consistency between x, y and z. Any idea of why this happens and how to find an effective solution? Here's the codes I tried to use

           
           % Alignment of MRI to headshape
cfg                                       = [];
cfg.method                              = 'headshape';
cfg.headshape.headshape        = head;
cfg.coordsys                         = 'ctf';
cfg.headshape.icp                 = 'no';  % (automatic iteration leads to catastrophic results)
mri_aligned_headshape               = ft_volumerealign(cfg, mri_aligned_fiducials);

% Alignment of elec with headmodel based on fiducials (nasion, lpa and rpa - which are actually left and right traguses in both structures)
cfg           = [];
cfg.method     = 'fiducial';
cfg.target      = elec_mri; % ( this are manually pointed fiducials from the 'mri_realinged_headshape'
cfg.elec             = elec;
cfg.fiducial      = {'NAS', 'LPA', 'RPA'};
cfg.feedback = 'yes';
elec_realigned       = ft_electroderealign(cfg);


I am not sure, but could your observations have to do with the fact that you have a non-isotropic MRI image, and/or that the fiducial voxel locations don’t make sense. I would expect that in the call to ft_electroderealign all geometric objects (cfg.target cfg.elec) are expressed in the same metric units, and in approximately the same coordinate system.



  1.
Relevant artifacts on the headmodel scalp mesh: many of the individual MRIs I am using are collected with the subject wearing digital goggles (part of active tasks fMRI sessions). Therefore, when I compute segmentation and mesh for the headmodel, the goggle shape results embedded in the scalp mesh. May you know if this can cause issue with the later on computation of the forward model and of the inverse solution, although there are not electrodes placed on the goggle area? Actually I would need to exclude from the analysis the inferior and lateral electrodes, but it seems to me a more straighforward solution than using ft_defacevolume or ft_defacemesh, which based on my experience are flawly, not user-friendly, subjected to many errors and notsistematic (likewise for correcting parameters as cfg.scalpthreshold or cfg.scalpsmooth in ft_volumesegment).
If the answer to my question is yes, how would you suggest to troubleshoot the issue? Would it be better for me to use other MRI processing tools to exclude goggles with a more efficient mask setting (e.g., manual drawing)?

I've been struggling for a while already, so that I would really appreciate any type of suggestion, a direct solution or  sources I can consult, whichever they may be!

Hmmm, for an accurate forward model (i.e. representing the anamoty during the EEG - task) the goggles should be eliminated from the image. I am not aware of a very straightforward way of doing this. If the goggles are clearly delineated in the MR-image (as opposed to causing a bit artifactual blur at the front of the head), one could try and use image processing heuristics to try and get rid of it (e.g. by calling ft_volumesegment using different settings for threshold/smoothing, and then take logical combinations of the output volumes). Otherwise, you may want to consider an approach which is described here: https://pubmed.ncbi.nlm.nih.gov/35378289/<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpubmed.ncbi.nlm.nih.gov%2F35378289%2F&data=05%7C02%7Cfieldtrip%40science.ru.nl%7C05c58818ba684441f30708dc4f03367e%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638472122432559296%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=3Qkh0waYs1Y7ihXHN7U1YcCCOLcrblhH06DqoMTnrMM%3D&reserved=0> i.e. use a template anatomical image, warped to the individual participants head.

Best wishes,
Jan-Mathijs





Your time and attention are very much appreciated.
Best of luck with your work,
Regards

Enrico Sozza, PhD Student
Brainlab – Cognitive Neuroscience Research Group
Department of Clinical Psychology and Psychobiology
Institute of Neurosciences
University of Barcelona
P. Vall d'Hebron 171, 08035 Barcelona, Catalonia-Spain
Tel: +34 933 125 058 – Fax: +24 934 021 584
http://www.ub.edu/brainlab<https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.ub.edu%2Fbrainlab&data=05%7C02%7Cfieldtrip%40science.ru.nl%7C05c58818ba684441f30708dc4f03367e%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638472122432715550%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=3ZgZ6P53G9xh4zMoJhbQ4f45TpPZ1zRMGW4ddxGuChY%3D&reserved=0>
http://www.neurociencies.ub.edu<https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.neurociencies.ub.edu%2F&data=05%7C02%7Cfieldtrip%40science.ru.nl%7C05c58818ba684441f30708dc4f03367e%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638472122432715550%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=4Xw9D5AgeACfibUdFrYfwuVqASXVEh7D07d33hpKhOk%3D&reserved=0>


Aquest missatge, i els fitxers adjunts que hi pugui haver, pot contenir informació confidencial o protegida legalment i s’adreça exclusivament a la persona o entitat destinatària. Si no consteu com a destinatari final o no teniu l’encàrrec de rebre’l, no esteu autoritzat a llegir-lo, retenir-lo, modificar-lo, distribuir-lo, copiar-lo ni a revelar-ne el contingut. Si l’heu rebut per error, informeu-ne el remitent i elimineu del sistema tant el missatge com els fitxers adjunts que hi pugui haver.

Este mensaje, y los ficheros adjuntos que pueda incluir, puede contener información confidencial o legalmente protegida y está exclusivamente dirigido a la persona o entidad destinataria. Si usted no consta como destinatario final ni es la persona encargada de recibirlo, no está autorizado a leerlo, retenerlo, modificarlo, distribuirlo o copiarlo, ni a revelar su contenido. Si lo ha recibido por error, informe de ello al remitente y elimine del sistema tanto el mensaje como los ficheros adjuntos que pueda contener.

This email message and any attachments it carries may contain confidential or legally protected material and are intended solely for the individual or organization to whom they are addressed. If you are not the intended recipient of this message or the person responsible for processing it, then you are not authorized to read, save, modify, send, copy or disclose any part of it. If you have received the message by mistake, please inform the sender of this and eliminate the message and any attachments it carries from your account.

_______________________________________________
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%7C05c58818ba684441f30708dc4f03367e%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638472122432715550%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=H%2FIZrlG0JK3y8uBT2di2%2FIpNpDwc7OSpGCaeJiDSgW8%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%7C05c58818ba684441f30708dc4f03367e%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638472122432715550%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=0Jnr1wAkJCkArffje%2BSyefqbc2bkjrZYd7byhTS%2BbWU%3D&reserved=0>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20240328/9d9ebdd8/attachment.htm>


More information about the fieldtrip mailing list