Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if alpha is None:
alpha = brainrender.ROOT_ALPHA
bilateralmesh = self._get_structure_mesh(region, c=color, alpha=alpha)
if bilateralmesh is None:
print(f"Failed to get mesh for {region}, returning None")
return None
com = (
bilateralmesh.centerOfMass()
) # this will always give a point that is on the midline
right = bilateralmesh.cutWithPlane(origin=com, normal=(0, 0, 1))
# left is the mirror right # WIP
com = self.get_region_CenterOfMass("root", unilateral=False)[2]
left = actors_funcs.mirror_actor_at_point(right.clone(), com, axis="x")
if hemisphere == "both":
return left, right
elif hemisphere == "left":
return left
else:
return right
if alpha is None:
alpha = brainrender.ROOT_ALPHA
bilateralmesh = self._get_structure_mesh(region, c=color, alpha=alpha)
if bilateralmesh is None:
print(f"Failed to get mesh for {region}, returning None")
return None
com = (
bilateralmesh.centerOfMass()
) # this will always give a point that is on the midline
right = bilateralmesh.cutWithPlane(origin=com, normal=(0, 0, 1))
# left is the mirror right # WIP
com = self.get_region_CenterOfMass("root", unilateral=False)[2]
left = actors_funcs.mirror_actor_at_point(right.clone(), com, axis="x")
if hemisphere == "both":
return left, right
elif hemisphere == "left":
return left
else:
return right
if alpha is None:
alpha = brainrender.ROOT_ALPHA
bilateralmesh = self._get_structure_mesh(region, c=color, alpha=alpha)
if bilateralmesh is None:
print(f"Failed to get mesh for {region}, returning None")
return None
com = (
bilateralmesh.centerOfMass()
) # this will always give a point that is on the midline
right = bilateralmesh.cutWithPlane(origin=com, normal=(0, 0, 1))
# left is the mirror right # WIP
com = self.get_region_CenterOfMass("root", unilateral=False)[2]
left = actors_funcs.mirror_actor_at_point(right.clone(), com, axis="x")
if hemisphere == "both":
return left, right
elif hemisphere == "left":
return left
else:
return right
def _mirror_neuron(neuron, mcoord):
"""
Actually takes care of mirroring a neuron
:param neuron: neuron's meshes
:param mcoord: coordinates of the point to use for the mirroring
"""
# This function does the actual mirroring
for name, actor in neuron.items():
# get mesh points coords and shift them to other hemisphere
if isinstance(actor, (list, tuple, str)) or actor is None:
continue
neuron[name] = mirror_actor_at_point(actor, mcoord, axis='x')
return neuron