import trimesh import meshio from vmtk import pypes from vmtk import vmtkscripts import vtk from vtk.util.numpy_support import vtk_to_numpy from vtk.util.numpy_support import numpy_to_vtk from scipy.spatial import distance from tools import Files_Management as gf from tools import BSplines_Utilities as bs gf.Reload(gf) gf.Reload(bs) ############################################################################################ ################################### NIFTI READER ########################################### ############################################################################################ def Mesh_from_Nifti(nifti_file_to_read, path_writer, only_lumen=True): if not os.path.exists(nifti_file_to_read): print(f"File: {nifti_file_to_read} does not exist") sys.exit(1) #NIFIT READING AND CONVERSION TO NUMPY ARRAY reader = vtk.vtkNIFTIImageReader()
import scipy.stats as st from scipy.spatial import procrustes from scipy import interpolate from sklearn import mixture from symfit import parameters, variables, sin, cos, Fit import matplotlib.pyplot as plt import matplotlib.colors as col #UTILITIES FILES from tools import Files_Management as gf from tools import BSplines_Utilities as bs from tools import Statistics_Utilities as stats from geometry_utilities import Geometry_Treatment as geo_treat #RELOAD ALL NEEDED PACKAGES gf.Reload(gf) gf.Reload(bs) gf.Reload(stats) gf.Reload(geo_treat) ################################################################################################################ ############################################### POD ON REDUCED BASIS ########################################### ################################################################################################################ def Centerline_pod(liste_control, epsilon=1.e-2): print("----> Procrustes Analysis + Save dilatation coefficient") #EXTRACT CONTROL POINTS FROM PROCRSUTES ANALYSIS procrust_control, disparity = Procrustes(liste_control) #EXTRACT DILATATION (SCALING) FROM PROCRUSTES ANALYSIS
import numpy as np import meshio import time import trimesh import os from math import * from scipy.interpolate import griddata from scipy.spatial import distance from tools import Files_Management as gf from tools import Statistics_Utilities as stats gf.Reload(gf) gf.Reload(stats) def Parametrization_analysis(path_parametrization): PARA = gf.Read_parametrization(path_parametrization) #WE ALWAYS BEGIN PARAMETRIZATION WITH HIGHEST Z COORDINATES PZ1 = PARA[0, 2] PZ2 = PARA[-1, 2] if PZ2 > PZ1: PARA = np.flip(PARA, axis=0) #COMPUTE THETAS print("-----> Number of thetas : ", np.shape(PARA[:, 12:])[1]) #COMPUTE NB POINT CENTERLINE