<jupyter_start><jupyter_text>In this tutorial you will learn how to export and import scene from BrainRender<jupyter_code># We start with the usual set up code
# We begin by adding the current path to sys.path to make sure that the imports work correctly
import sys
sys.path.append('../')
import os

# Set up VTKPLOTTER to work in Jupyter notebooks
from vtkplotter import *
embedWindow(backend=False) 

from BrainRender.settings import *
from BrainRender.Utils.data_io import update_folders

main_fld = "path_to_your_folder"
update_folders(main_fld)

# Please check that the folder paths have been set correctly
print(folders_paths['main_fld'])

from BrainRender.scene import Scene, LoadedScene

# Before populating the scene, we need to change the current working directory to the parent folder, 
# then we are ready to start!
os.chdir(os.path.normpath(os.path.join(os.getcwd(), os.pardir)))<jupyter_output><empty_output><jupyter_text>To save a scene to file you need to create, populate and render a scene<jupyter_code># create a scene and add some cortical regions
tutorial_scene = Scene(jupyter=True)
tutorial_scene.add_brain_regions(['VISp', 'MOs', 'MOp'], colors='blue') # add the PAG to our scene

# render the scene, but make sure to not make it interactive.
tutorial_scene.render(interactive=False)

# Making the scene interactive would make the program stop until the window is closed, and the following line wouldn't be exectured
tutorial_scene.export_scene(savename="exported_scene") # to not save the scene in the default output folder you can pass save_dir to another path

# Now close the window
closeWindow()<jupyter_output><empty_output><jupyter_text>This will have saved the scene as a numpy file, to load the scene we need to use the LoadedScene class<jupyter_code>loaded_scene = LoadedScene(filepath="path to your saved scene")
loaded_scene.render()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.07161664033701948, 'fraction_numerical': 0.0, 'mean_word_length': 6.037037037037037, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '131044', 'license': 'MIT', 'n_tokens_mistral': 584, 'n_tokens_neox': 565, 'n_words': 222, 'path': 'Examples/ExportScene.ipynb', 'repo_name': 'raacampbell/BrainRender', 'size': '1899'}