Coordinate Transform between Brainstorm, Freesurfer and Curry8
Brainstorm & freesurfer
Requirement:
- The Brainstorm MRI is the
T1.mgz
generated by the freesurfer OR - Export the MRI image from Brainstorm and directly used as the input for Freesurfer (not going through our softwares or transformations)
Method 1: (tested in Brainstorm version 2021)
In Brainstorm, import surfaces (*h.pial
), merge surfaces, and it will be in the correct Brainstorm coordinate.
Method 2: (coordinate conversion in Matlab)
- Read the files:
Export Brainstorm MRI to Matlab (Variable name:
sMri
). Read freesurfer cortext file into Matlab usingmne_read_surface
(comes with Brainstorm) orfreesurfer_read_surf
from bioelectromagnetism. Those two function is the same, but the first function returns coordinate in unitm
, while the latter returns in unitmm
.[verts1, faces1] = mne_read_surface('lh.pial'); [verts2, faces2] = mne_read_surface('rh.pial'); verts = [verts1;verts2]; faces = [faces1;faces2];
- Shift
pos_bs2 = bst_bsxfun(@plus, verts, (size(sMri.Cube)/2 + [0 1 0]) .* sMri.Voxsize / 1000);
- Transform
pos_bs = cs_convert(sMri, 'mri', 'scs', pos_bs2);
The
pos_bs
will be the Freesurfer pial surface in Brainstorm coordinate.
Similarly, to go from brainstorm to freesurfer coordinates, we need
pos_fs = cs_convert(sMri, 'scs', 'mri', bs.Vertices);
pos_fs = bst_bsxfun(@minus, pos_fs, (size(sMri.Cube)/2 + [0 1 0]) .* sMri.Voxsize / 1000)*1000;
Curry8 & freesurfer
Case 1:
- The Curry MRI is the
T1.mgz
generated by freesurfer. - Simply do –> Results –> Coordinates: Freesurfer, NifTi (R,A,S) –> Sufaces: Load from –> select the pial
Case 2:
- The MRI is not the T1.mgz. There are already surfaces and points generated in the original MRI coordinate.
- Steps:
- Export image data from Curry
- After
recon-all
in Freesurfer, runtkregister2 --mov rawavg.mgz --targ T1.mgz --reg register.native.dat --noedit --regheader mri_surf2surf --sval-xyz pial --reg register.native.dat rawavg.mgz --tval lh.pial.native --tval-xyz rawavg.mgz --hemi lh --s subjectname
- Import
*h.pial.native
following the steps in case 1.
Brainstorm and Curry 8
From Brainstorm to Curry 8 (one MRI)
- Export Brainstorm MRI, and load into Curry 8. Select mirror when importing the .nii MRI into Curry
- Record the fiducials in Brainstorm in the MRI coordinate into a txt
- In Curry 8: Coordinates: Image Data (R,A,S) –> Localizer Load the txt –> Save and use as image landmark
- Save any points you want to export to Curry in MRI coordinate and load to Curry in Image Data (R,A,S) coordinates
- Or
- Export sEEG to file in .res format.
In Matlab: brainstorm to curry
curryPos = bsPos; curryPos(:,1) = -bsPos(:,2); curryPos(:,2) = bsPos(:,1); curryPos = curryPos * 1000;
- Then in Curry localziter, open the .res file in PAN coordinate.
From Brainstorm to Curry 8 (two MRI)
- Coregister the first MRI using steps above as Image Data (1) in Curry.
- Import the second MRI to Curry, change it to the default MRI (Image Data 1), and follow the steps above. (Curry 8 perform “Save and use as image landmark” only on Image Data 1, so we need to change the new MRI as the default one.)