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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 852 - (show annotations)
Wed Sep 20 03:23:16 2006 UTC (14 years, 10 months ago) by jongui
File MIME type: text/x-python
File size: 1641 byte(s)
added carpet and isosurface


1 """
2 @author: John Ngui
3 @author: Lutz Gross
4 """
5
6 import vtk
7
8 class Lut:
9 """
10 Class that provides the functions to create a map spectrum.
11 """
12
13 def __init__(self):
14 self.vtk_lut = vtk.vtkLookupTable()
15
16 def setHue(self, lower_range, upper_range):
17 """
18 Set the upper and lower hue(color) range.
19
20 @type lower_range: Number
21 @param lower_range: Lower range of the hue
22 @type upper_range: Number
23 @param upper_range: Upper range of the hue
24 """
25
26 self.vtk_lut.SetHueRange(lower_range, upper_range)
27
28 def setSaturation(self, lower_range, upper_range):
29 """
30 Set the upper and lower saturation(vibrancy) range.
31
32 @type lower_range: Number
33 @param lower_range: Lower range of the saturation
34 @type upper_range: Number
35 @param upper_range: Higher range of the saturation
36 """
37
38 self.vtk_lut.SetSaturationRange(lower_range, upper_range)
39
40 def setValue(self, lower_range, upper_range):
41 """
42 Set the upper and lower value(brightness) range.
43
44 @type lower_range: Number
45 @param lower_range: Lower range of the value
46 @type upper_range: Number
47 @param upper_range: Upper range of the value
48 """
49
50 self.vtk_lut.SetValueRange(lower_range, upper_range)
51
52 def getLut(self):
53 """
54 Return the VTK lookup table.
55
56 @rtype: vtkLookupTable
57 @return: VTK Lookup table
58 """
59
60 return self.vtk_lut
61
62 class BlueToRed(Lut):
63 """
64 Class that creates a map with spectrum from blue to red.
65 """
66
67 def __init__(self):
68 Lut.__init__(self)
69 self.setHue(0.667, 0.0)
70
71 class RedToBlue(Lut):
72 """
73 Class that creates a map with spectrum from red to blue.
74 """
75
76 def __init__(self):
77 Lut.__init__(self)
78 self.setHue(0.0, 0.667)
79
80
81

  ViewVC Help
Powered by ViewVC 1.1.26