python3dvtk

In Brainrender is there a way to at labels and stop the brain from load upside down?


I am using brainrender to show where I've placed some electrodes. However, whenever I load brainrender my brain always loads upside down:

brainrender2

3

4

Is there a way to fix this? Or do I just have to manually flip it every time?

I was also wondering if any one knew of a way to display/add text labels to the 3D image the brainrender makes? I did look at these functions, but as far as I can tell neither one actually places a label on a brain area.

labels: 5


Solution

  • Below I've copied the important parts of how to resolve the issues/questions posted here. All credit for an answer to this question goes to the developer of BrainRender(FedeClaudi on GitHub). I am copying the key information he provide my team in case the following link to the developers answer stops working: https://github.com/BrancoLab/BrainRender/issues/70

    The developer of the BrainRender tool updated this tool to version 0.4.0.0 which allows users to permanently add labels to brain areas:

    pip install -U brainrender

    You should also update using:

    https://github.com/BrancoLab/BrainRender.git
    

    Some key things to know about how the labels work:

    This is how we resolved our brain loading upside down, it turns out this is just an issue that occurs with Jupyter notebook:

    from vtkplotter import embedWindow
    
    from brainrender.scene import Scene
    
    
    
    # Change 1 Disable scene embedding with k3d in vtkplotter
    
    embedWindow(False) 
    
    
    
    # Change 2 set jupyter to False when creating the scene
    
    scene = Scene(jupyter=False)
    
    
    
    # Populate and render 
    
    scene.add_brain_regions(['MOp', 'MOs', 'VISl', 'VISp', 'RSPagl'], add_labels=True)
    
    scene.add_text('title')
    
    scene.render(camera='top')
    

    The developer also warned "to avoid import vtkplotter as vtk because there's another package called vtk".