forked from gacevedobolton/myVTKPythonLibrary
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathclipSurfacesForCutLVMesh.py
52 lines (41 loc) · 1.56 KB
/
clipSurfacesForCutLVMesh.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
41
42
43
44
45
46
47
48
49
50
51
#coding=utf8
########################################################################
### ###
### Created by Martin Genet, 2012-2016 ###
### ###
### University of California at San Francisco (UCSF), USA ###
### Swiss Federal Institute of Technology (ETH), Zurich, Switzerland ###
### École Polytechnique, Palaiseau, France ###
### ###
########################################################################
import vtk
import myVTKPythonLibrary as myVTK
from mat_vec_tools import *
########################################################################
def clipSurfacesForCutLVMesh(
endo,
epi,
height,
verbose=1):
myVTK.myPrint(verbose, "*** clipSurfacesForCutLVMesh ***")
plane = vtk.vtkPlane()
plane.SetNormal(0,0,-1)
plane.SetOrigin(0,0,height)
clip = vtk.vtkClipPolyData()
clip.SetClipFunction(plane)
if (vtk.vtkVersion.GetVTKMajorVersion() >= 6):
clip.SetInputData(endo)
else:
clip.SetInput(endo)
clip.Update()
clipped_endo = clip.GetOutput(0)
clip = vtk.vtkClipPolyData()
clip.SetClipFunction(plane)
if (vtk.vtkVersion.GetVTKMajorVersion() >= 6):
clip.SetInputData(epi)
else:
clip.SetInput(epi)
clip.Update()
clipped_epi = clip.GetOutput(0)
return (clipped_endo,
clipped_epi)