Closed OlehKSS closed 6 years ago
@agramfort , @larsoner In the example two helper functions from PuSurfer are used: .utils.mesh_edges
and .utils.smoothing_matrix
. What should I do about this functions? Should I implement similar functions or should I add PySurfer as mne_g3d dependency? I, personally, don't want to rely on PySurfer, since it will create chain PySurfer -> mayavi -> VTK.
This functionality also exists in mne
, the first by the name mesh_edges
, the second as compute_morph_matrix
(though you can also use stc.morph
if you want, albeit a little bit slower).
This gist
should have all the functions you need to get mesh triangulation + color information for each vertex:
https://gist.github.com/larsoner/25fa656c6d6e0b02b56c40a571bfb77c
@larsoner Thanks, mesh_edges
is exactly the same, but compute_morph_matrix
is a little bit different, one seam to read data as well, unlike PySurfer.utils.smoothing_matrix
. By the way, from example data that I have I see that surface of the brain is stored as two hemispheres, is it always the case? Should I create a unified mesh out of two halves or user will provide unified mesh?
You should be able to use compute_morph_matrix
from MNE to avoid the PySurfer dependency.
I wouldn't unify the meshes at all, but instead create two mesh objects in the viz library. They are usually provided separately, have separate vertices, etc.
My 2 cents here: I don't know that we need to perfectly recreate the way that pysurfer creates mesh objects etc under the hood. From my perspective the two most important things are:
Ok, as far as I understand compute_morph_matrix
will not be required to create a basic mesh
Correct, to create a basic mesh compute_morph_matrix
is not needed.
I am pretty sure we will eventually need a sparse matrix multiplication in JavaScript to upsample low-resolution meshes to the high resolution surface to make data transfer times manageable. This is what compute_morph_matrix
provides in Python.
Create function for plotting brain mesh. Create example of usage in Jupyter. Use MNE sample data.
Use GSOC-wiki examples as a reference.