/[escript]/temp_trunk_copy/pyvisi/py_src/warp.py
ViewVC logotype

Contents of /temp_trunk_copy/pyvisi/py_src/warp.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1197 - (show annotations)
Mon Jun 18 02:08:34 2007 UTC (12 years, 3 months ago) by jongui
Original Path: trunk/pyvisi/py_src/warp.py
File MIME type: text/x-python
File size: 1884 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 constant import WarpMode
23
24 class Warp:
25 """
26 Class that defines the deformation of a scalar field.
27 """
28
29 def __init__(self, warp_mode):
30 """
31 Initialise the warp scalar/vector.
32
33 @type warp_mode: L{WarpMode <constant.WarpMode>} constant
34 @param warp_mode: Mode in which to deform the data
35 """
36
37 if(warp_mode == WarpMode.SCALAR): # Deform data with scalar data.
38 self.__vtk_warp = vtk.vtkWarpScalar()
39 elif(warp_mode == WarpMode.VECTOR): # Deform data with vector data.
40 self.__vtk_warp = vtk.vtkWarpVector()
41
42 def _setupWarp(self, object):
43 """
44 Setup the warp.
45
46 @type object: vtkPolyData, etc
47 @param object: Input for the warp scalar/vector
48 """
49
50 self.__object = object
51 self.__setInput()
52
53 def __setInput(self):
54 """
55 Set the input for the warp scalar/vector.
56 """
57
58 self.__vtk_warp.SetInput(self.__object)
59
60 def setScaleFactor(self, scale_factor):
61 """
62 Set the displacement scale factor.
63
64 @type scale_factor: Number
65 @param scale_factor: Scale factor of the displacement
66 """
67
68 self.__vtk_warp.SetScaleFactor(scale_factor)
69
70 def _getWarpOutput(self):
71 """
72 Return the output of the deformed data.
73
74 @rtype: vtkPointSet
75 @return: PointSet data
76 """
77
78 return self.__vtk_warp.GetOutput()
79

  ViewVC Help
Powered by ViewVC 1.1.26