Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# get tractography points and represent as list
if color_by == "target_region" and not is_any_item_in_list(
inj_structures, VIP_regions
):
alpha = others_alpha
else:
alpha = brainrender.TRACTO_ALPHA
if alpha == 0:
continue # skip transparent ones
# 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,
)
)
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,
def add_sphere_at_point(
self, pos=[0, 0, 0], radius=100, color="black", alpha=1, **kwargs
):
"""
Adds a shere at a location specified by the user
:param pos: list of x,y,z coordinates (Default value = [0, 0, 0])
:param radius: int, radius of the sphere (Default value = 100)
:param color: color of the sphere (Default value = "black")
:param alpha: transparency of the sphere (Default value = 1)
:param **kwargs:
"""
sphere = shapes.Sphere(
pos=pos, r=radius, c=color, alpha=alpha, **kwargs
)
sphere.name = f"sphere {pos}"
self.actors.append(sphere)
return sphere
# get tractography points and represent as list
if color_by == "target_region" and not is_any_item_in_list(
inj_structures, VIP_regions
):
alpha = others_alpha
else:
alpha = brainrender.TRACTO_ALPHA
if alpha == 0:
continue # skip transparent ones
# 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,