# [email protected] import numpy as np import nibabel as nib from nibabel import trackvis from trimesh_class import TriMesh from trimesh_vtk import TriMesh_Vtk # add normal direction #file_name = "brain_mesh/lh_sim_tri_tau20_l3l10.ply" file_name = "brain_mesh/lhwhitet.vtk" mesh = TriMesh_Vtk(file_name, None) vertices = mesh.get_vertices() nb_step = 10 saved_flow = "testflow.dat" trk_filename = "testtract_lhwhite2.trk" lines = np.memmap(saved_flow, dtype=np.float64, mode='r', shape=(nb_step, vertices.shape[0], vertices.shape[1])) # mesh.update() mesh.update_normals() normals = mesh.get_normals() # load nifti for trk info #subject_nii_file = "brain_mesh/s31_T1.nii.gz" subject_nii_file = "brain_mesh/S1-A2_fa.nii.gz" fa_file = nib.load(subject_nii_file) img = fa_file.get_data()
def update_polydata(self, vertices_flow_index=-1): TriMesh_Vtk.set_polydata_triangles(self, TriMeshFlow.get_triangles(self)) TriMesh_Vtk.set_polydata_vertices(self, TriMeshFlow.get_vertices(self, vertices_flow_index=vertices_flow_index))