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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1197 - (show annotations)
Mon Jun 18 02:08:34 2007 UTC (12 years, 2 months ago) by jongui
File MIME type: text/x-python
File size: 2681 byte(s)
Update the way movies are generated. Please refer to the examples. 

The user can now either specify the image range(first and last images inclusive):
mov.imageRange(input_directory = PYVISI_EXAMPLE_IMAGES_PATH,
        first_image = IMAGE_NAME + "000938.jpg",
		last_image = IMAGE_NAME + "000948.jpg")
mov.makeMovie(os.path.join(PYVISI_EXAMPLE_IMAGES_PATH, "movie.mpg"))

or the user can specify a list of images:

lst = ['image1.jpg', 'image5.jpg', 'image7.jpg]
mov.imageList(input_directory = PYVISI_EXAMPLE_IMAGES_PATH, image_list = lst)
mov.makeMovie(os.path.join(PYVISI_EXAMPLE_IMAGES_PATH, "movie.mpg"))


1 """
2 @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 """
9
10 __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 import vtk
22 from mapper import ImageMapper
23 from imagereslice import ImageReslice
24 from actor import Actor2D
25 from constant import Viewport
26
27 # NOTE: ImageMapper, ImageReslice and Actor2D were inherited to allow access
28 # to their public methods from the driver.
29 class Logo(ImageMapper, ImageReslice, Actor2D):
30 """
31 Class that displays a static image, in particular a logo
32 (i.e. company symbol) and has NO interaction capability. The position and
33 size of the logo can be specified.
34 """
35
36 # The SOUTH_WEST default viewport is used when there is only one viewport.
37 # This saves the user from specifying the viewport when there is only one.
38 def __init__(self, scene, image_reader, viewport = Viewport.SOUTH_WEST):
39 """
40 @type scene: L{Scene <scene.Scene>} object
41 @param scene: Scene in which the logo is to be displayed
42 @type image_reader: L{ImageReader <imagereader.ImageReader>}
43 object
44 @param image_reader: Deal with source of data for vizualisation
45 @type viewport: L{Viewport <constant.Viewport>} constant
46 @param viewport: Viewport in which the logo is to be displayed
47 """
48
49 self.__image_reader = image_reader
50 self.__viewport = viewport
51
52 self.__modified = True # Keeps track whether Logo has been modified.
53 ImageReslice.__init__(self)
54 ImageMapper.__init__(self)
55 Actor2D.__init__(self)
56 scene._addVisualizationModules(self)
57
58 # ----- Logo -----
59
60 self._setupImageReslice(self.__image_reader._getImageReaderOutput())
61 self._setupImageMapper(self._getImageResliceOutput())
62
63 self._setupActor2D(self._getImageMapper())
64 scene._addActor2D(self.__viewport, self._getActor2D())
65
66 def _isModified(self):
67 """
68 Return whether the Logo or DataCollector has been modified.
69
70 @rtype: Boolean
71 @return: True or False
72 """
73
74 return self.__modified or self.__data_collector._isModified()
75
76 def _render(self, scene):
77 """
78 Render the logo.
79
80 @type scene: L{Scene <scene.Scene>} object
81 @param scene: Scene in which the logo is to be displayed
82 """
83
84 if (self._isModified() == True):
85 self.__modified = False
86
87
88

  ViewVC Help
Powered by ViewVC 1.1.26