/[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 860 - (show annotations)
Thu Sep 28 08:17:29 2006 UTC (13 years, 6 months ago) by jongui
File MIME type: text/x-python
File size: 1716 byte(s)
- added sample drivers on how to use all of the currently available modules.
- completed the epydocs for all the currently available modules.
- added the rotation feature for camera and plane cutting.


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 @type lower_range: Number
20 @param lower_range: Lower range of the hue
21 @type upper_range: Number
22 @param upper_range: Upper range of the hue
23 """
24
25 self.vtk_lut.SetHueRange(lower_range, upper_range)
26
27 def setSaturation(self, lower_range, upper_range):
28 """
29 Set the upper and lower saturation(vibrancy) range.
30 @type lower_range: Number
31 @param lower_range: Lower range of the saturation
32 @type upper_range: Number
33 @param upper_range: Higher range of the saturation
34 """
35
36 self.vtk_lut.SetSaturationRange(lower_range, upper_range)
37
38 def setValue(self, lower_range, upper_range):
39 """
40 Set the upper and lower value(brightness) range.
41
42 @type lower_range: Number
43 @param lower_range: Lower range of the value
44 @type upper_range: Number
45 @param upper_range: Upper range of the value
46 """
47
48 self.vtk_lut.SetValueRange(lower_range, upper_range)
49
50 def getLut(self):
51 """
52 Return the lookup table.
53
54 @rtype: vtkLookupTable
55 @return: VTK Lookup table that changes the color spectrum
56 """
57
58 return self.vtk_lut
59
60 from colormap import 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 from colormap import Lut
72
73 class RedToBlue(Lut):
74 """
75 Class that creates a map with spectrum from red to blue.
76 """
77
78 def __init__(self):
79 Lut.__init__(self)
80 self.setHue(0.0, 0.667)
81

  ViewVC Help
Powered by ViewVC 1.1.26