1 |
""" |
2 |
Class that shows a scalar field by contour surfaces. |
3 |
""" |
4 |
|
5 |
import vtk |
6 |
from common import * |
7 |
|
8 |
class Contour(Common): |
9 |
""" |
10 |
@author: John Ngui |
11 |
@author: Lutz Gross |
12 |
""" |
13 |
|
14 |
def __init__(self, open_scene, data_collector): |
15 |
""" |
16 |
@type open_scene: L{OpenScene <openscene.OpenScene>} object |
17 |
@param open_scene: Scene in which components are to be added to |
18 |
@type data_collector: L{DataCollector <datacollector.DataCollector>} |
19 |
object |
20 |
@param data_collector: Source of data for visualization |
21 |
""" |
22 |
|
23 |
Common.__init__(self, open_scene, data_collector) |
24 |
self.setContour() |
25 |
|
26 |
Common.setMapper(self, "self.vtk_contour.GetOutput()") |
27 |
Common.setActor(self) |
28 |
Common.addActor(self) |
29 |
|
30 |
def setContour(self): |
31 |
""" |
32 |
Set up the contour and its input. |
33 |
""" |
34 |
|
35 |
self.vtk_contour = vtk.vtkContourFilter() |
36 |
self.vtk_contour.SetInput(self.data_collector.getReader().GetOutput()) |
37 |
|
38 |
def setValue(self, contour_number, value): |
39 |
""" |
40 |
Set the contour number and its value. |
41 |
|
42 |
@type contour_number: Number |
43 |
@param contour_number: Contour number |
44 |
@type value: Number |
45 |
@param value: Contour value |
46 |
""" |
47 |
|
48 |
self.vtk_contour.SetValue(contour_number, value) |
49 |
|
50 |
def generateValues(self, number_contours, min_range, max_range): |
51 |
""" |
52 |
Generate the specified number of contours within the specified range. |
53 |
|
54 |
@type number_contours: Number |
55 |
@param number_contours: Number of contours to generate |
56 |
@type min_range: Number |
57 |
@param min_range: Minimum contour value |
58 |
@type max_range: Number |
59 |
@param max_range: Maximum contour value |
60 |
""" |
61 |
|
62 |
self.vtk_contour.GenerateValues(number_contours, min_range, max_range) |
63 |
|
64 |
|
65 |
#class ContourOnPlane(Component): |
66 |
""" |
67 |
shows scalar data by contour surfaces on a given plane |
68 |
""" |
69 |
pass |