1 |
ksteube |
1147 |
""" |
2 |
jongui |
1197 |
@var __author__: name of author |
3 |
|
|
@var __copyright__: copyrights |
4 |
|
|
@var __license__: licence agreement |
5 |
|
|
@var __url__: url entry point on documentation |
6 |
|
|
@var __version__: version |
7 |
|
|
@var __date__: date of the version |
8 |
ksteube |
1147 |
""" |
9 |
|
|
|
10 |
jongui |
1197 |
__author__="John Ngui, john.ngui@uq.edu.au" |
11 |
|
|
__copyright__=""" Copyright (c) 2006 by ACcESS MNRF |
12 |
|
|
http://www.access.edu.au |
13 |
|
|
Primary Business: Queensland, Australia""" |
14 |
|
|
__license__="""Licensed under the Open Software License version 3.0 |
15 |
|
|
http://www.opensource.org/licenses/osl-3.0.php""" |
16 |
|
|
__url__="http://www.iservo.edu.au/esys" |
17 |
|
|
__version__="$Revision$" |
18 |
|
|
__date__="$Date$" |
19 |
|
|
|
20 |
|
|
|
21 |
ksteube |
1147 |
import vtk |
22 |
|
|
|
23 |
|
|
class Tube: |
24 |
|
|
""" |
25 |
|
|
Class that defines the tube wrapped around the streamlines. |
26 |
|
|
""" |
27 |
|
|
|
28 |
jongui |
1148 |
def __init__(self): |
29 |
ksteube |
1147 |
""" |
30 |
|
|
Initialise the tube. |
31 |
|
|
""" |
32 |
|
|
|
33 |
|
|
self.__vtk_tube = vtk.vtkTubeFilter() |
34 |
|
|
|
35 |
jongui |
1148 |
def _setupTube(self, object): |
36 |
ksteube |
1147 |
""" |
37 |
|
|
Setup the tube. |
38 |
jongui |
1161 |
|
39 |
|
|
@type object: vtkPolyData, etc |
40 |
|
|
@param object: Input for the tube |
41 |
ksteube |
1147 |
""" |
42 |
|
|
|
43 |
jongui |
1161 |
self.__object = object |
44 |
|
|
|
45 |
|
|
self.__setInput() |
46 |
ksteube |
1147 |
# Default radius of the tube is 0.02. |
47 |
|
|
self.setTubeRadius(0.02) |
48 |
|
|
# Default number of sides for the tube is 12. |
49 |
|
|
self.setTubeNumberOfSides(12) |
50 |
|
|
self.setTubeRadiusToVaryByVector() |
51 |
|
|
|
52 |
jongui |
1161 |
def __setInput(self): |
53 |
ksteube |
1147 |
""" |
54 |
|
|
Set the input for the tube. |
55 |
|
|
""" |
56 |
|
|
|
57 |
jongui |
1161 |
self.__vtk_tube.SetInput(self.__object) |
58 |
ksteube |
1147 |
|
59 |
|
|
def setTubeRadius(self, radius): |
60 |
|
|
""" |
61 |
|
|
Set the radius of the tube. |
62 |
|
|
|
63 |
|
|
@type radius: Number |
64 |
|
|
@param radius: Radius of the tube |
65 |
|
|
""" |
66 |
|
|
|
67 |
|
|
self.__vtk_tube.SetRadius(radius) |
68 |
|
|
|
69 |
|
|
def setTubeNumberOfSides(self, sides): |
70 |
|
|
""" |
71 |
|
|
Set the number of sides for the tube. Minimum number of sides is 3. |
72 |
|
|
The larger the number of sides, the higher the quality. |
73 |
|
|
|
74 |
|
|
@type sides: Number |
75 |
|
|
@param sides: Number of sides for the tube |
76 |
|
|
""" |
77 |
|
|
|
78 |
|
|
self.__vtk_tube.SetNumberOfSides(sides) |
79 |
|
|
|
80 |
|
|
def setTubeRadiusToVaryByVector(self): |
81 |
|
|
""" |
82 |
|
|
Set the radius to vary by vector data. |
83 |
|
|
""" |
84 |
|
|
|
85 |
|
|
self.__vtk_tube.SetVaryRadiusToVaryRadiusByVector() |
86 |
|
|
|
87 |
|
|
def setTubeRadiusToVaryByScalar(self): |
88 |
|
|
""" |
89 |
|
|
Set the radius to vary by scalar data. |
90 |
|
|
""" |
91 |
|
|
|
92 |
|
|
self.__vtk_tube.SetVaryRadiusToVaryRadiusByScalar() |
93 |
|
|
|
94 |
jongui |
1148 |
def _getTubeOutput(self): |
95 |
ksteube |
1147 |
""" |
96 |
|
|
Return the output of the tube. |
97 |
|
|
|
98 |
|
|
@rtype: vtkPolyData |
99 |
|
|
@return: Polygonal data |
100 |
|
|
""" |
101 |
|
|
|
102 |
|
|
return self.__vtk_tube.GetOutput() |