forked from OpenGeoVis/PVGeo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample_filter.py
More file actions
67 lines (59 loc) · 2.15 KB
/
Copy pathexample_filter.py
File metadata and controls
67 lines (59 loc) · 2.15 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
"""
Example python filter demonstrating some of the features available for
python programmable filters.
"""
# Name to be used for coding/macros:
Name = 'ExamplePythonFilter'
# Label for the filter menu:
Label = 'Example Python Filter'
# The filter/source menu category:
FilterCategory = 'PVGP Filters'
# A general overview of the plugin
Help = 'This is a simple example of a Python Programmable Filter'
NumberOfInputs = 1 # Specify as many as you would like
InputDataType = '' # Leave blank if input doesn't matter
OutputDataType = '' # Leave blank to preserve input data type
# How to add input arrays:
#- Number of Input array drop down choices
NumberOfInputArrayChoices = 1
#- Labels for the array drop down choices:
InputArrayLabels = ['Array']
# Any extra XML GUI components you might like:
ExtraXml = ''
# These are the parameters/properties of the plugin:
Properties = dict(
test_bool=True,
test_int=123,
test_int_vector=[1, 2, 3],
test_double=1.23,
test_double_vector=[1.1, 2.2, 3.3],
test_string='string value',
)
# This is the description for each of the properties variable:
#- Include if you'd like. Totally optional.
#- The variable name (key) must be identical to the property described.
PropertiesHelp = dict(
test_bool='This is a description about the test_bool property!'
)
# Where your main processing occurs
#- Data processing
def RequestData(self):
from vtk.util import numpy_support as nps
import PVGPpy.helpers as inputhelp
pdi = self.GetInput() # VTK Data Type
pdo = self.GetOutput() # VTK Data Type
# Get input array info (selection made in drop down menu)
name = inputhelp.getSelectedArrayName(self, 0)
field = inputhelp.getSelectedArrayField(self, 0)
if test_bool:
print(name)
else:
print(field)
# Use if you need to set extents and what not
#- Information, spatial extent, ect
def RequestInformation(self):
from paraview import util
# This script is usually not necessary for filters
# Here's an example of setting extents that might be necessary for plugin to function correctly:
#util.SetOutputWholeExtent(self, [0,nx-1, 0,ny-1, 0,nz-1])
print('Have a great day!')