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

Annotation of /trunk/pyvisi/py_src/image.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1199 - (hide annotations)
Wed Jun 20 05:01:30 2007 UTC (12 years, 1 month ago) by jongui
File MIME type: text/x-python
File size: 3312 byte(s)
- Updated the epydocs and guide.
Deleted redundant files and methods.
Tidied up the codes.
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     from mapper import DataSetMapper
23     from actor import Actor3D
24     from constant import Viewport
25     from texture import Texture
26     from plane import PlaneSource
27     from transform import Transform, TransformFilter
28    
29     # NOTE: DataSetMapper, Actor3D, Texture, PlaneSource, Transform and
30     # TransformFilter were inherited to allow access to their public methods
31     # from the driver.
32     class Image(DataSetMapper, Actor3D, Texture, PlaneSource, Transform,
33     TransformFilter):
34     """
35     Class that displays an image which can be scaled (upwards and downwards)
36     and has interaction capability. The image can also be translated and
37     rotated along the X, Y and Z axes.
38    
39 jongui 1197 @attention: Translating an image works differently (opposite) compared to
40 ksteube 1147 translating a plane. For example, a positive translation along the
41 jongui 1199 z-axis moves a plane up. However, if the identical translation is applied
42     on an image, the image moves down.
43 ksteube 1147 """
44    
45     # The SOUTH_WEST default viewport is used when there is only one viewport.
46     # This saves the user from specifying the viewport when there is only one.
47     def __init__(self, scene, image_reader, viewport = Viewport.SOUTH_WEST):
48     """
49     @type scene: L{Scene <scene.Scene>} object
50     @param scene: Scene in which the image is to be displayed
51     @type image_reader: L{ImageReader <imagereader.ImageReader>}
52     object
53     @param image_reader: Deal with source of data for vizualisation
54     @type viewport: L{Viewport <constant.Viewport>} constant
55     @param viewport: Viewport in which the image is to be displayed
56     """
57    
58 jongui 1148 self.__image_reader = image_reader
59     self.__viewport = viewport
60 ksteube 1147
61 jongui 1148 # Keeps track whether Image has been modified.
62     self.__modified = True
63     Texture.__init__(self)
64 ksteube 1147 PlaneSource.__init__(self)
65     Transform.__init__(self)
66 jongui 1148 TransformFilter.__init__(self)
67     DataSetMapper.__init__(self)
68     Actor3D.__init__(self)
69     scene._addVisualizationModules(self)
70 ksteube 1147
71 jongui 1148 # ----- Image -----
72 ksteube 1147
73 jongui 1148 self._setupTexture(image_reader._getImageReaderOutput())
74     self._setupTransformFilter(self._getPlaneSourceOutput(),
75     self._getTransform())
76 ksteube 1147
77 jongui 1148 self._setupDataSetMapper(self._getTransformFilterOutput())
78     self._setupActor3D(self._getDataSetMapper())
79 ksteube 1147
80 jongui 1148 self._setTexture(self._getTexture())
81 jongui 1158 scene._addActor3D(self.__viewport, self._getActor3D())
82 jongui 1148
83     def _isModified(self):
84     """
85     Return whether the Image has been modified.
86    
87     @rtype: Boolean
88     @return: True or False
89     """
90    
91     if (self.__modified == True):
92     return True
93     else:
94     return False
95    
96 jongui 1158 def _render(self, scene):
97 jongui 1148 """
98     Render the image.
99 jongui 1158
100     @type scene: L{Scene <scene.Scene>} object
101     @param scene: Scene in which the image is to be displayed
102 jongui 1148 """
103    
104     if(self._isModified() == True):
105     self.__isModified = False
106    
107    

  ViewVC Help
Powered by ViewVC 1.1.26