1 |
|
2 |
######################################################## |
3 |
# |
4 |
# Copyright (c) 2003-2010 by University of Queensland |
5 |
# Earth Systems Science Computational Center (ESSCC) |
6 |
# http://www.uq.edu.au/esscc |
7 |
# |
8 |
# Primary Business: Queensland, Australia |
9 |
# Licensed under the Open Software License version 3.0 |
10 |
# http://www.opensource.org/licenses/osl-3.0.php |
11 |
# |
12 |
######################################################## |
13 |
|
14 |
__copyright__="""Copyright (c) 2003-2010 by University of Queensland |
15 |
Earth Systems Science Computational Center (ESSCC) |
16 |
http://www.uq.edu.au/esscc |
17 |
Primary Business: Queensland, Australia""" |
18 |
__license__="""Licensed under the Open Software License version 3.0 |
19 |
http://www.opensource.org/licenses/osl-3.0.php""" |
20 |
__url__="https://launchpad.net/escript-finley" |
21 |
|
22 |
""" |
23 |
:var __author__: name of author |
24 |
:var __copyright__: copyrights |
25 |
:var __license__: licence agreement |
26 |
:var __url__: url entry point on documentation |
27 |
:var __version__: version |
28 |
:var __date__: date of the version |
29 |
""" |
30 |
|
31 |
__author__="John Ngui, john.ngui@uq.edu.au" |
32 |
|
33 |
|
34 |
from esys.escript import getMPISizeWorld |
35 |
if getMPISizeWorld()==1: import vtk |
36 |
|
37 |
class Texture: |
38 |
""" |
39 |
Class that defines the texture for the rendered object. |
40 |
""" |
41 |
|
42 |
def __init__(self): |
43 |
""" |
44 |
Initialise the texture. |
45 |
""" |
46 |
if getMPISizeWorld()>1: |
47 |
raise ValueError,"pyvisi.Texture is not running on more than one processor." |
48 |
self.__vtk_texture = vtk.vtkTexture() |
49 |
|
50 |
def _setupTexture(self, image): |
51 |
""" |
52 |
Setup the texture. |
53 |
|
54 |
:type image: vtkImageData |
55 |
:param image: Image from which data is to be read |
56 |
""" |
57 |
|
58 |
self.__image = image |
59 |
self.__setInput() |
60 |
|
61 |
def __setInput(self): |
62 |
""" |
63 |
Set the input for the texture. |
64 |
""" |
65 |
|
66 |
self.__vtk_texture.SetInput(self.__image) |
67 |
|
68 |
def _getTexture(self): |
69 |
""" |
70 |
Return the texture. |
71 |
|
72 |
:rtype: vtkTexture |
73 |
:return: Texture of the rendered object |
74 |
""" |
75 |
|
76 |
return self.__vtk_texture |
77 |
|