def BrainRegionsScene(): scene = Scene() scene.add_brain_regions(['TH', 'VP'], use_original_color=True, alpha=1) act = scene.actors['regions']['TH'] scene.edit_actors([act], wireframe=True) set_camera(scene) scene.render()
def StreamlinesScene(): streamlines_files, data = streamlines_api.download_streamlines_for_region("PAG") scene = Scene() scene.add_streamlines(data[3], color="powderblue", show_injection_site=False, alpha=.3, radius=10) scene.add_brain_regions(['PAG'], use_original_color=False, colors='powderblue', alpha=.9) mos = scene.actors['regions']['PAG'] scene.edit_actors([mos], wireframe=True) set_camera(scene) scene.render()
def NeuronsScene2(): scene = Scene() neurons_metadata = mouselight_fetch_neurons_metadata(filterby='soma', filter_regions=['MOp5']) neurons_files = download_neurons(neurons_metadata[2:6]) scene.add_neurons(neurons_files, soma_color='deepskyblue', force_to_hemisphere="right") streamlines_files, data = streamlines_api.download_streamlines_for_region("MOp") scene.add_streamlines(data[:1], color="palegreen", show_injection_site=False, alpha=.2, radius=10) set_camera(scene) scene.render()
def NeuronsScene(show_regions = False): scene = Scene() fl = 'Examples/example_files/one_neuron.json' scene.add_neurons(fl, soma_color='darkseagreen', force_to_hemisphere="right",) if show_regions: scene.add_brain_regions(['ZI', 'PAG', 'MRN', 'NPC', "VTA", "STN", "PPT", "SCm", "HY"], use_original_color=True, alpha=.5) set_camera(scene) scene.render()
def CellsScene(): # Load and clean data data = pd.read_csv('/Users/federicoclaudi/Downloads/41593_2019_354_MOESM3_ESM.csv') data = data[['genotype', 'Xpos', 'Ypos', 'z.position']] data.columns = ['genotype', 'x', 'y', 'z'] # Visualise data scene = Scene() scene.add_cells(data) set_camera(scene) scene.render()
def ConnectivityScene(): scene = Scene() p0 = scene.get_region_CenterOfMass("ZI") # Then we se these coordinates to get tractography data, note: any set of X,Y,Z coordinates would do. tract = aba.get_projection_tracts_to_target(p0=p0) scene.add_tractography(tract, display_injection_structure=False, color_by="region", display_injection_volume=True, others_alpha=.25) scene.add_brain_regions(['ZI'], colors="ivory", alpha=1) set_camera(scene) scene.render()
def NeuronsScene3(): scene = Scene() neurons_metadata = mouselight_fetch_neurons_metadata(filterby='soma', filter_regions=['VAL']) neurons_files = download_neurons(neurons_metadata[2:6]) scene.add_neurons(neurons_files, soma_color='deepskyblue', force_to_hemisphere="right") scene.add_brain_regions(['VAL'], use_original_color=False, colors='palegreen', alpha=.9) mos = scene.actors['regions']['VAL'] scene.edit_actors([mos], wireframe=True) streamlines_files, data = streamlines_api.download_streamlines_for_region("VAL") scene.add_streamlines(data[:1], color="palegreen", show_injection_site=False, alpha=.2, radius=10) set_camera(scene) scene.render()
def StreamlinesScene2(): scene = Scene() streamlines_files, data = streamlines_api.download_streamlines_for_region("VAL") scene.add_streamlines(data, color="palegreen", show_injection_site=False, alpha=.3, radius=10) streamlines_files, data = streamlines_api.download_streamlines_for_region("VM") scene.add_streamlines(data, color="palevioletred", show_injection_site=False, alpha=.3, radius=10) scene.add_brain_regions(['VAL'], use_original_color=False, colors='palegreen', alpha=.9, hemisphere='right') mos = scene.actors['regions']['VAL'] scene.edit_actors([mos], wireframe=True) scene.add_brain_regions(['VM'], use_original_color=False, colors='palevioletred', alpha=.9, hemisphere='right') mos = scene.actors['regions']['VM'] scene.edit_actors([mos], wireframe=True) set_camera(scene) scene.render()
from BrainRender.Utils.MouseLightAPI.mouselight_download_neurons import * from BrainRender.Utils.videomaker import VideoMaker except: raise ValueError("Failed at imports") import os from random import choice import pandas as pd import numpy as np import random import json # ! TESTING SCENE CREATION print("Ceating scene + adding brain rgions") try: scene = Scene() regions = ["MOs", "VISp", "ZI"] scene.add_brain_regions(regions, colors="green") except: raise ValueError("Failed at SCENE") # ! TESTING NEURONS RENDERING print("Rendering neurons") try: neurons_metadata = mouselight_fetch_neurons_metadata( filterby='soma', filter_regions=['MOs']) neurons_files = download_neurons(neurons_metadata[:2]) parser = NeuronsParser(scene=scene, color_neurites=True,