-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathComputeMeshSections.py
42 lines (32 loc) · 1001 Bytes
/
ComputeMeshSections.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import vtk
from vmtk import vtkvmtk, vmtkscripts
import numpy as np
import sys
import os
from glob import glob
class ComputeMeshSections():
def __init__(self,Args):
self.Args=Args
def Main(self):
#Read the Centerlines
Centerlines=self.ReadVtpFile(self.Args.OutFolder+"/Centerlines.vtp")
#Read the Mesh File
Mesh=self.ReadVtuFile(self.Args.InputMeshFolder+"/mesh-complete.mesh.vtu")
#ComputeMeshSections
MeshSections=self.ComputeMeshSections(Centerlines,Mesh)
def ComputeMeshSections(self,Centerlines,Mesh):
def ReadVtuFile(self,FileName):
reader=vtk.vtkXMLUnstructuredGridReader()
reader.SetFileName(FileName)
reader.Update()
return reader.GetOutput()
def ReadVtpFile(self,FileName):
reader=vtk.vtkXMLPolyDataReader()
reader.SetFileName(FileName)
reader.Update()
return reader.GetOutput()
def WriteVtpFile(self,Surface,FileName):
writer=vtk.vtkXMLPolyDataWriter()
writer.SetFileName(FileName)
writer.SetInputData(Surface)
writer.Update()