About Freesurfer

Dear Francois and all,
From what I could gather, when extract cortical envelope from a T1 MRI by FreeSurfer, T1 MRI should be converted to mgz-filetype, just as the link: [https://www.fieldtriptoolbox.org/tutorial/sourcemodel/#2-preparation-of-the-anatomical-mri-impose-coordinate-system-according-to-the-meeg-coordinates.]
However, brainstorm can also perform MEG-MRI coregistration. So, when I use the cortical envelope obtained by FreeSurfer to eatimate the source, is the following process necessary to get the mgz-file?
cfg = [];
cfg.method = 'interactive';
cfg.coordsys = 'neuromag';
mri = ft_volumerealign(cfg, mri);

That is, do I need to align the anatomical data to the intended coordinate system before converting T1 MRI to mgz file?And is it correct to get mgz-file through the following code?

mripath = 'E:\mri\nii';
subj_fn = 'subject01.nii';
mri = ft_read_mri([mripath, filesep, subj_fn]);
mri_neuromag = ft_determine_coordsys(mri, 'interactive', 'yes');
% reslice to 1mm
cfg = [];
cfg.resolution = 1;
cfg.dim = [256 256 256];
mri_reslice = ft_volumereslice(cfg, mri_neuromag);
cfg = [];
cfg.method = 'interactive';
cfg.coordsys = 'acpc';
mri_acpc = ft_volumerealign(cfg, mri_reslice);
% save the mri file, will be processed with freesurfer
cfg = [];
cfg.filename = [mripath, filesep, 'subject01.mgz'];
cfg.filetype = 'mgz';
cfg.parameter = 'anatomy';
ft_volumewrite(cfg, mri_acpc);

I also uploaded the data. You can download it at the following link:

Thanks for all your help.
Best,
Han Xiaoke

I'm not sure I understand how your question relate to the use of Brainstorm, it looks like you are planning to use FieldTrip for your analysis... You should probably ask your questions to the FieldTrip community:
https://www.fieldtriptoolbox.org/support/

If you want to use Brainstorm, you don't need to do anything with your .nii file before processing it with FreeSurfer: we mark the fiducials on the FreeSurfer output file T1.mgz after processing. Alternatively, you can use CAT12.

If you are planning to use Brainstorm, start by reading the introduction tutorials (section Get Started) before processing your own recordings:
https://neuroimage.usc.edu/brainstorm/Tutorials

Dear Francois,
Thank you for your patient reply.
As shown in the figure below, my MRI is upside down. The first picture is opened with FSL, and the second picture is opened with Fieldtrip.
图片25 图片26

When I want to use FreeSurfer for segmentation and Brainstorm for source estimation, do I need to change the direction first?
As far as I know, fslreorient2std can transpose the direction into MNI space. So if I need to change direction, can I use fslreorient2std?
Specially, my data is produced by Elekta Neuromag system, e.g. “.fif” files. Is its MEG-MRI coregistration the same as CTF? Can I follow this link completely:
https://neuroimage.usc.edu/brainstorm/Tutorials/ChannelFile#Automatic_registration?
I will appreciate very much with your any opinions.
Best,
Han Xiaoke

When I want to use FreeSurfer for segmentation and Brainstorm for source estimation, do I need to change the direction first?

Just process the MRI with FreeSurfer (which will realign it in its own orientation, whatever the input orientation is), and import the FreeSurfer output folder in Brainstorm (as in the tutorial).

Specially, my data is produced by Elekta Neuromag system, e.g. “.fif” files. Is its MEG-MRI coregistration the same as CTF? Can I follow this link completely:

The logic is the same of any MEG system: marking the same NAS/LPA/RPA points both when digitizing the fiducials before the MEG acquisition, and in the MRI when importing your data into Brainstorm.
Or use a full digitized head shape ("Automatic registration" = "Refined registration using head points").

After following the CTF-based introduction tutorials, you can read Elekta-specific tutorials from the tutorials page, if you feel like like learning more about processing Elekta recordings:
https://neuroimage.usc.edu/brainstorm/Tutorials

Dear Francois,
I truly appreciate your reply in resolving the problem. That would really help me.
Thanks again for you kind help :coffee: :coffee:.
Best,
Han Xiaoke