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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 945 - (hide annotations)
Tue Jan 30 22:34:27 2007 UTC (14 years, 9 months ago) by jongui
File MIME type: text/x-python
File size: 1769 byte(s)
added the feature that enables the dimension to be specified
1 jongui 943 """
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     # NOTE: Method not used at the moment.
57     def setValue(self, contour, value):
58     """
59     Set the specific contour value.
60    
61     @type contour: Number
62     @param contour: Contour
63     @type value: Number
64     @param value: Contour value
65     """
66    
67     self.__vtk_contour.SetValue(contour, value)
68    
69 jongui 945
70 jongui 943 def _getOutput(self):
71     """
72     Return the output of the contour.
73    
74     @rtype: vtkPolyData
75     @return: Polygonal data
76     """
77    
78     return self.__vtk_contour.GetOutput()
79    

  ViewVC Help
Powered by ViewVC 1.1.26