[FieldTrip] Creating head and source model from Freesurfer T1.mgz
Kirandeep Kaur
k.kaur31 at aston.ac.uk
Fri Aug 22 16:24:47 CEST 2025
Dear Fieldtrip community!
I aim trying to generate source model for meg data files recorded in Elekta Neuromag system. However, I have generated the Freesurfer files using each subject's T1w MRI, without re-aligning the volume before running Freesurfer as suggested in this tutorial (sorry I was too used to working in Brainstorm!).
Now, I am trying to generate a headmodel from the Freesurfer generated T1.mgz using the following code, but I keep getting a warning (also shown below).
----------------------
mri_file=strcat(<path to freesurfer dir>, '/mri/T1.mgz');
mri=ft_read_mri(mri_file);
% re-align the volume
cfg=[];
cfg.method='interactive';
cfg.coordsys='neuromag';
mri=ft_volumerealign(cfg,mri);
% create seg file
cfg=[];
cfg.output='brain';
cfg.brainthreshold=0.5;
seg=ft_volumesegment(cfg,mri);
The above code runs, but I am getting the following warning:
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND=1.045258e-22.
My question is:
1.
Should I instead use the original T1w MRI for creating the headmodel, and use the Freesurfer T1.mgz of the same subject for creating the same model?
2.
If yes, what is the best way to co-register and create source model from a Freesurfer generated T1.mgz from a T1.nii which was not aligned to the neuromag coordsys before recon-all.
For context my ultimate aim is to generate virtual channels as per the Schaefer's atlas for the entire .fif file; i.e. simply go from the sensor space to roi parcellated source space after cleaning the data (using ICA).
Any help/suggestions here would be very useful.
Kind regards,
Kiran
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20250822/0b9478fb/attachment.htm>
More information about the fieldtrip
mailing list