/[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 1147 - (hide annotations)
Wed May 16 06:39:11 2007 UTC (13 years, 11 months ago) by ksteube
File MIME type: text/x-python
File size: 1767 byte(s)
Added back in some files that were accidentally deleted.

1 ksteube 1147 """
2     @author: John NGUI
3     """
4    
5     import vtk
6    
7     class ContourModule:
8     """
9     Class that defines contour module.
10     """
11    
12     def __init__(self, object):
13     """
14     Initliase the contour module.
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 at the same time.
35     def generateContours(self, contours, lower_range = None,
36     upper_range = None):
37     """
38     Generate the specified number of contours within the specified range.
39     In order to generate an iso surface, the 'lower_range' and
40     'upper_range' must be equal.
41    
42     @type contours: Number
43     @param contours: Number of contours to generate
44     @type lower_range: Number
45     @param lower_range: Lower range of contour values
46     @type upper_range: Number
47     @param upper_range: Upper range of contours values
48     """
49    
50     if(lower_range != None): # True if the lower_range is specified.
51     self.__lower_range = lower_range
52     if(upper_range != None): # True if the upper_range is specified.
53     self.__upper_range = upper_range
54    
55     self.__vtk_contour.GenerateValues(contours, self.__lower_range,
56     self.__upper_range)
57    
58     def _getContour(self):
59     """
60     Return the contour.
61    
62     @rtype: vtkContourFilter
63     @return: Contour filter
64     """
65    
66     return self.__vtk_contour
67    
68     def _getOutput(self):
69     """
70     Return the output of the contour.
71    
72     @rtype: vtkPolyData
73     @return: Polygonal data
74     """
75    
76     return self.__vtk_contour.GetOutput()
77    

  ViewVC Help
Powered by ViewVC 1.1.26