Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def make_root_mesh(self):
if self.structures is None:
return
obj_path = os.path.join(self.meshes_folder, "root.vtk")
if os.path.isfile(obj_path):
return
# Get the mesh for each brain region to create root
meshes = [
self._get_structure_mesh(reg) for reg in self.region_acronyms
]
root = merge(meshes)
write(root, obj_path)
atlas_kwargs=dict(data_folder=self.data_folder),
)
temp_scene.add_neurons(self.neurons_names)
temp_scene.render(interactive=False)
temp_scene.close()
root = merge(*temp_scene.actors["neurons"]).clean().cap()
# root = mesh2Volume(root, spacing=(0.02, 0.02, 0.02)).isosurface()
points = Points(root.points()).smoothMLS2D(f=0.8).clean(tol=0.005)
root = recoSurface(points, dims=100, radius=0.2)
# Save
write(root, rootpath)
del temp_scene
return root