Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"Need to pass eiteher a filepath or data argument to parse_streamline"
)
# create actors for streamlines
lines = []
if len(data["lines"]) == 1:
try:
lines_data = data["lines"][0]
except KeyError:
lines_data = data["lines"]["0"]
else:
lines_data = data["lines"]
for line in lines_data:
points = [[l["x"], l["y"], l["z"]] for l in line]
lines.append(
shapes.Tube(
points,
r=radius,
c=color,
alpha=alpha,
res=brainrender.STREAMLINES_RESOLUTION,
)
)
coords = []
if show_injection_site:
if len(data["injection_sites"]) == 1:
try:
injection_data = data["injection_sites"][0]
except KeyError:
injection_data = data["injection_sites"]["0"]
else:
# represent injection site as sphere
if display_injection_volume:
actors.append(
shapes.Sphere(
pos=t["injection-coordinates"],
c=color,
r=brainrender.INJECTION_VOLUME_SIZE
* t["injection-volume"],
alpha=brainrender.TRACTO_ALPHA,
)
)
points = [p["coord"] for p in t["path"]]
actors.append(
shapes.Tube(
points,
r=brainrender.TRACTO_RADIUS,
c=color,
alpha=alpha,
res=brainrender.TRACTO_RES,
)
)
return actors
actors.append(
shapes.Sphere(
pos=t["injection-coordinates"],
c=color,
r=brainrender.INJECTION_VOLUME_SIZE
* t["injection-volume"],
alpha=brainrender.TRACTO_ALPHA,
)
)
actors[-1].name = (
str(t["injection-coordinates"]) + "_injection"
)
points = [p["coord"] for p in t["path"]]
actors.append(
shapes.Tube(
points,
r=brainrender.TRACTO_RADIUS,
c=color,
alpha=alpha,
res=brainrender.TRACTO_RES,
)
)
actors[-1].name = str(t["injection-coordinates"]) + "_tractography"
return actors
try:
data = cs.skeletons_data[neuron]
except:
print(f"No skeleton data found for {neuron}")
return None
# Create an actor for each neuron's branch and then merge
actors = []
for branch in data["branches"]:
coords = [data["coordinates"][str(p)] for p in branch]
# Just like for synapses we need to adjust the coordinates to match the .obj files
# coords are x z -y
adjusted_coords = [(c[0], c[2], -c[1]) for c in coords]
actors.append(
Tube(
adjusted_coords,
r=cs.skeleton_radius,
res=NEURON_RESOLUTION,
)
)
return merge(*actors)