alignment inner_skull mri

External Email - Use Caution

Dear MNE team,

I had some issues with the skull stripping in Freesurfer and in some cases
I obtained a better one using the fieldtrip/spm pipeline. Now that I obtain
the inner_skull.surf I guess I have to convert it to the freesurfer
coordinates otherwise it's not aligned with the mri for example (see image
attached). How can I do the transformation ? I tried but unsuccessfully.

Thanks
Edoardo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20201005/fbb02027/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: freeviewBEM.JPG
Type: image/jpeg
Size: 158933 bytes
Desc: not available
Url : http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20201005/fbb02027/attachment-0001.jpe

External Email - Use Caution

what did you try?

you can use plot_bem in mne-python to check things and you can write a
surface file in .surf format.

see for example https://mne.tools/stable/generated/mne.write_surface.html

HTH
Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20201005/7217800d/attachment.html

External Email - Use Caution

what did you try?

you can use plot_bem in mne-python to check things and you can write a
surface file in .surf format.

Keep in mind you need to know what coordinate frame the surface that is
created by fieldtrip/spm lives in. If it's MRI voxels (?), then you'd want
a MRI voxel (just called "vox" in MNE) to FreeSurfer Surface RAS MRI (just
called "mri" in MNE) transformation. In nibabel this would be something
like:

rr, tris = mne.read_surface('inner_skull.surf') # in mm
mri = nibabel.load('SUBJECTS_DIR/SUBJECT/mri/T1.mgz')
xform = mri.header.get_vox2ras_tkr() # in mm
rr = mne.transforms.apply_trans(rr, xform)
mne.write_surface('inner_skull_fixed.surf', rr, tris)

This might or might not work depending on the coordinate frame that
fieldtrip/spm actually uses. For example, if the volume is in just
MRI/Scanner RAS coordinates (probably more likely?), you'll need to take
the points and convert them from MRI/scanner RAS to FreeSurfer surface RAS,
which would involve something like:

a = mri.header.affine # vox->ras
b = mri.header.get_vox2ras_tkr() # vox->mri
xform = b @ np.linalg.inv(a) # ras->mri

and apply this xform instead and save as above. For more information, see:

https://mne.tools/dev/auto_tutorials/source-modeling/plot_background_freesurfer_mne.html#mri-coordinate-frames

Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20201005/a66284fa/attachment.html