/[escript]/trunk/pyvisi/py_src/contourmodule.py
ViewVC logotype

Contents of /trunk/pyvisi/py_src/contourmodule.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 943 - (show annotations)
Mon Jan 29 07:22:43 2007 UTC (14 years, 1 month ago) by jongui
File MIME type: text/x-python
File size: 1772 byte(s)
new pyvisi files
1 """
2 @author: John NGUI
3 """
4
5 import vtk
6
7 class ContourModule:
8 """
9 Class that defines contour.
10 """
11
12 def __init__(self, object):
13 """
14 Initliase the contour.
15
16 @type object: vtkUnstructuredGrid, etc
17 @param object: Input for the contour
18 """
19
20 self.__object = object
21 self.__vtk_contour = vtk.vtkContourFilter()
22
23 self.__setInput()
24
25 def __setInput(self):
26 """
27 Set the input for the contour.
28 """
29
30 self.__vtk_contour.SetInput(self.__object)
31
32 # lower_range and upper_range by default is assigned to None. This allows
33 # the contours to be altered without necessarily having to alter the
34 # lower_range and upper_range.
35 def generateContours(self, contours, lower_range = None,
36 upper_range = None):
37 """
38 Generate the specified number of contours withing the specified range.
39
40 @type contours: Number
41 @param contours: Number of contours to generate
42 @type lower_range: Number
43 @param lower_range: Lower range of the contours
44 @type upper_range: Number
45 @param upper_range: Upper range of the contours
46 """
47
48 if(lower_range != None): # True if the lower_range is altered.
49 self.__lower_range = lower_range
50 if(upper_range != None): # True if the upper_range is altered.
51 self.__upper_range = upper_range
52
53 self.__vtk_contour.GenerateValues(contours, self.__lower_range,
54 self.__upper_range)
55
56
57 # NOTE: Method not used at the moment.
58 def setValue(self, contour, value):
59 """
60 Set the specific contour value.
61
62 @type contour: Number
63 @param contour: Contour
64 @type value: Number
65 @param value: Contour value
66 """
67
68 self.__vtk_contour.SetValue(contour, value)
69
70
71 def _getOutput(self):
72 """
73 Return the output of the contour.
74
75 @rtype: vtkPolyData
76 @return: Polygonal data
77 """
78
79 return self.__vtk_contour.GetOutput()
80

  ViewVC Help
Powered by ViewVC 1.1.26