-
Notifications
You must be signed in to change notification settings - Fork 7
/
clipPDataUsingField.py
37 lines (26 loc) · 1.27 KB
/
clipPDataUsingField.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
#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
########################################################################
def clipPDataUsingField(
pdata_mesh,
array_name,
threshold_value,
verbose=1):
myVTK.myPrint(verbose, "*** clipPDataUsingField ***")
pdata_mesh.GetPointData().SetActiveScalars(array_name)
clip_poly_data = vtk.vtkClipPolyData()
clip_poly_data.SetInputData(pdata_mesh)
clip_poly_data.SetValue(threshold_value)
clip_poly_data.GenerateClippedOutputOn()
clip_poly_data.Update()
return clip_poly_data.GetOutput(0), clip_poly_data.GetOutput(1)