Conversion of coordinate system from SCS to world coordinate when exporting the mesh

I am working on this with Saima. Basically we want to save the mesh in the same coordinate system as the MRI that is used to generate the mesh. In 3D Slicer this is the RAS coordinate system which I think corresponds to the world coordinate system in Brainstorm. Is this the correct way to save the mesh in the world coordinate system:

% NOTE: First do these steps:
% 1. Export to Matlab the MRI_T1 as 'mri'.
% 2. Export to Matlab the mesh as 'mesh'.

% Output file to save mesh
OutputFile = 'mesh.msh'

% Convert CSC to World coordinate system
% See: https://github.com/brainstorm-tools/brainstorm3/blob/master/toolbox/process/functions/process_fem_mesh.m#L899
[mesh.Vertices, Transf] = cs_convert(mri, 'scs', 'world', mesh.Vertices(:,1:3));

% Save mesh as Gmsh format
out_fem_msh(mesh, OutputFile)
1 Like