forked from Spokhim/MouseBrainModelling
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbrainrender_tractography.py
55 lines (44 loc) · 1.44 KB
/
brainrender_tractography.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
"""
This tutorial shows how download and rendered afferent mesoscale projection data
using the AllenBrainAtlas (ABA) and Scene classes
"""
import brainrender
brainrender.SHADER_STYLE = "cartoon"
from brainrender.scene import Scene
import numpy as np
import pandas as pd
import pylab
import matplotlib.pyplot as plt
from scipy import stats
from matplotlib.colors import ListedColormap
from turbo_colormap import *
import inspect
import os
import csv
import time
import sys
import glob
import pandas as pd
from pprint import pprint
import scipy.cluster.hierarchy as hierarchy
#from tvb.simulator.lab import *
#from tvb.simulator.plot.tools import *
# Input Simulation Pipeline
#from SimulationPipeline import *
#from useful_fns import *
from brainrender.colors import *
# Create a scene
scene = Scene(title="tractography")
# Get data - using df just for the acronyms
df = pd.read_csv(r"C:\Users\Pok Him\Desktop\MouseBrainModelling\CortexDensitiesAlter.csv",delimiter=",")
name = df.acronym
for i in np.arange(len(name)):
acronym = name[i]
# Get the center of mass of the region of interest
p0 = scene.atlas.get_region_CenterOfMass(acronym)
# Get projections to that point
tract = scene.atlas.get_projection_tracts_to_target(p0=p0)
# Add the brain regions and the projections to it
#scene.add_brain_regions([acronym], alpha=0.4, use_original_color=True)
scene.add_tractography(tract, color_by="target_region")
scene.render()