[FieldTrip] MEG fiducial points creating error in volume alignment

Schoffelen, J.M. (Jan Mathijs) janmathijs.schoffelen at donders.ru.nl
Wed Mar 22 09:44:50 CET 2023


Hi Benjy,

There’s an error in your logic here: the template MRI is defined in a RAS coordinate space, and you want to align it to the fiducial-based coordinate space. The alignment procedure is based on the assumption that the coordinates of the fiducials are expressed in the same coordinate space as the input MRI, which is not the case, because they are already expressed in the fiducial-based coordinate space.

Also I think that your expression ‘I will end up with one head model for all subjects’ is actually true (and unavoidable), because you are using a single template MRI. What you probably wanted to say is that you want a subject-specific coregistration of the template headmodel to the sensor array, based on the subject-specific position in the MEG device during the measurement. The latter information is not present in the headshape files, but is reflected in the position of the sensors (expressed in head coordinates). You may consider making all this a bit more fancy by warping the headmodel (inflating/shrinking) based on the participant’s headshape derived head size, but I think that this is tricky.

Good luck and best wishes,
Jan-Mathijs

On 21 Mar 2023, at 20:45, Barnett, Benjy via fieldtrip <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>> wrote:

Hey Guys,

I am trying to create a head model using a template anatomical MRI and the fiducial points included in my CTF MEG data. However, when I include the fiducial points as returned by ft_read_heashape, it causes the head model and sensors to be completely misaligned (see attached photo). I have tried with and without converting them both into mm units using ft_convert_units but this did not help. The process works if I use the interactive method in ft_volumerealign so I’m sure the error is coming at this point. The reason I do not want to use the interactive method is because if I do that I will end up with one head model for all subjects (as I would just be clicking on the same fiducial points for each subject). I want to use the fiducial points measured by the MEG system per subject, to improve the fit of the head model for each subject. I’ve included my code below.

Would you be able to help me figure out how to use subject specific, MEG-measured fiducial points in the volume realignment step of the forward-model process? Thank you.

mri = ft_read_mri(‘~\template\anatomy\single_subj_T1.nii');



%get fiducial points
raw_data_dir = fullfile(‘~\data\Raw',subject,'meg','raw');
dataSets = str2fullfile(raw_data_dir,’*wildcard*');
ds = dataSets(1);
head = ft_read_headshape(ds);
head = ft_convert_units(head,'mm');



%align to ctf
cfg = [];
cfg.method = 'fiducial';
cfg.coordsys = 'ctf';
cfg.fiducial.nas = head.fid.pos(1,:);
cfg.fiducial.lpa = head.fid.pos(2,:);
cfg.fiducial.rpa = head.fid.pos(3,:);
mri_realigned = ft_volumerealign(cfg,mri);


%And then the rest of the code to create the head model, which I believe is correct.

%segment brain from skull
cfg           = [];
cfg.output    = 'brain';
segmentedmri  = ft_volumesegment(cfg, mri_realigned);

% Build volume conduction model from geometry of brain
cfg = [];
cfg.method='singleshell';
vol = ft_prepare_headmodel(cfg, segmentedmri);

% Visualise
vol = ft_convert_units(vol, 'cm');
sens = ft_read_sens(ds{1}, 'senstype', 'meg');
figure
ft_plot_sens(sens, 'coilshape','point','style', 'r+');

hold on
ft_plot_headmodel(vol);
<Screenshot 2023-03-21 at 7.36.36 PM.png>
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!59U0dhFLXtFqU5wZuQmpd-_WZi7AWfvdXqv651a3wjZcavfUAzddhNHRLfBMhHPdt9HgEM_6OqN1CfwORWtahrI3vaDjWMskhLlKzQ$

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20230322/92725a9c/attachment.htm>


More information about the fieldtrip mailing list