Closed wmvanvliet closed 5 years ago
Merging #268 into master will decrease coverage by
0.18%
. The diff coverage is22.22%
.
@@ Coverage Diff @@
## master #268 +/- ##
==========================================
- Coverage 75% 74.82% -0.19%
==========================================
Files 7 7
Lines 2517 2526 +9
Branches 506 509 +3
==========================================
+ Hits 1888 1890 +2
- Misses 454 461 +7
Partials 175 175
This means interactive PySurfer brains in Binder are now possible!
This would be through the X3D
backend? It's mature enough that you can for example rotate the brain with the mouse?
Oh that's a mybinder
link, trying now...
It interacts but has some bugs:
We can probably try to fix this at the mayavi
end, this looks like a hopefully easy bytes vs str issue.
In any case, +1 for merge from me!
You could also achieve this with PyVista. Cross-post from https://github.com/pyvista/pyvista/issues/146#issuecomment-494406647
Check out all the PyVista examples on http://playground.pyvista.org
Or this one: https://mybinder.org/v2/gh/OpenGeoVis/omfvista/master?filepath=Example.ipynb
This is enabled by default if panel
is installed
It would be good to have this mentioned in the documentation. Maybe at the bottom of this page?
BTW @wmvanvliet I don't hit the bytes/str bug locally, so if you update your mayavi
on MyBinder to latest master it will probably go away
neat @wmvanvliet !
The str
vs bytes
bug is actually an empty string bug. Sometimes VTK is too slow to render the brain and the X3D string becomes empty. I also hit it locally sometimes. It's a mayavi/VTK bug and generally the X3D is kind of unstable. However, it's better than nothing when in a pinch :)
You could also achieve this with PyVista
Time to rewrite pysurfer in pyvista? ;)
Time to rewrite pysurfer in pyvista? ;)
I know you were joking, but just in case you're curious -- we've had long discussions about this in #106 and #134. IIRC the consensus was basically that we should start some new neuro-3D-viz package that is more general, and less bound to Freesurfer conventions (but still provides what we need for working with FS).
To make some progress in MNE, @GuillaumeFavelier has made some progress implementing Mayavi alternatives (PyVista, ipyvolume, VisPy) for our basic 3D functionality such as plot_alignment
working. One of the next big targets will be source estimate plotting (currently we use PySurfer for this). Once things actually work to some extent, it will probably make sense to spin this off into its own package.
In the meantime this is great, thanks @wmvanvliet
Thanks @wmvanvliet!
Mayavi can render things inside a jupyter notebook as either PNG or X3D. This functionality can be enabled with
mlab.init_notebook()
.This PR adds an
_ipython_display_
hook to theBrain
class that renders the brain accordgin to the Mayavi notebook integration settings.This means interactive PySurfer brains in Binder are now possible! https://mybinder.org/v2/gh/wmvanvliet/SNL_workshop_2019/master?filepath=pysurfer_demo.ipynb