Using Notebooks
brainrender can be used with Jupyter notebooks in two ways:
  1. 1.
    you can embed a window with your rendered scene
  2. 2.
    you can have your scene be rendered in a pop-up window.
For an example of how to use brainrender with jupyter have a look here.

Rendering your scene in a separate window

If you want to have your scene be rendered in a new window, then you just need to set this option before your create your scene.
1
from vedo import embedWindow
2
embedWindow(None)
Copied!
after this everything will work exactly the same as usual, and you will have access to all of brainrender's features!

Embedding renderings in Jupyter notebooks

When embedding renderings in Jupyter Notebook not all of brainrender's functionality will work! If you want to support all of brainrender's features you should not embed renderings in the notebooks.
Note that this is due to the backend (k3d) used to embed the renderings not because of brainrender.
If you want to embed your scene anyways, you can do that as either a k3d panel or a with itkwidgets by setting:
1
embedWindow('k3d') # or 'itkwidgets'
Copied!
If you chose k3d then to rendered your scene:
1
from vedo import show
2
3
# scene.render now will prepare the scene for rendering,
4
# but it won't render anything yet
5
scene.render()
6
7
# to actually display the scene we use `vedo`'s `show`
8
# method to show the scene's actors
9
show(scene.actors)
Copied!
and with itkwidgets:
1
from ipywidgets import VBox, Button
2
VBox([show(scene.actors)])
Copied!
Last modified 1yr ago
Export as PDF
Copy link