[Mne_analysis] alignment inner_skull mri
Eric Larson
larson.eric.d at gmail.com
Mon Oct 5 08:21:50 EDT 2020
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
More information about the Mne_analysis
mailing list