# path_visual = trimesh.load_path(mesh.vertices[boundary[3]]) # create a scene with the mesh, path, and points # scene = trimesh.Scene([path_visual, mesh ]) # trimesh.points.plot_points(points) # plt.show() # submeshes = stop.cut_mesh(mesh, tex_parcel.darray) # #splt.pyglet_plot(submeshes[0]) # cloud_boundary = trimesh.points.PointCloud(mesh.vertices[boundary]) # scene = trimesh.Scene([cloud_boundary, mesh]) # scene = trimesh.Scene([mesh, cloud_boundary]) col = mesh.visual.vertex_colors col[:, 3] = 100 mesh.visual.vertex_colors = col scene_list.append(path_visual) print(path_visual) scene = trimesh.Scene(scene_list) scene.show(smooth=False) sub_meshes, sub_tex, sub_corresp = stop.cut_mesh(mesh, tex_parcel.darray) scene_list = list() for s_mesh in sub_meshes: print(s_mesh) s_mesh.visual.vertex_colors = trimesh.visual.random_color() scene_list.append(s_mesh) scene = trimesh.Scene(scene_list) scene.show(smooth=False)
mesh = sio.load_mesh(mesh_file) texture_file = os.path.join(data_path,'OASIS_0004_Lwhite_bassins.gii') texture = sio.load_texture(texture_file) texture=texture.darray # Mesh + texture splt.pyglet_plot(mesh, texture, 'jet', True) unique_values=np.unique(texture) print(unique_values) unique_values=np.setdiff1d(unique_values,0) print(unique_values) # Density for i,val in enumerate(unique_values): inds = texture ==val sub_meshes, sub_tex, sub_corresp = stop.cut_mesh(mesh, inds) print(sub_meshes[0].vertices.shape[0]) print(sub_meshes[0].area_faces.sum()) print(sub_meshes[0].vertices.shape[0]/sub_meshes[0].area_faces.sum()) # Sub_meshes #plt.figure(1) #plt.figure(2) for i,val in enumerate(unique_values):g inds = texture ==val sub_meshes, sub_tex, sub_corresp = stop.cut_mesh(mesh, inds) print("----------------------------------------------------") print(sub_corresp) print(sub_corresp[0][0]) print(sub_corresp[0][-1])