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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1197 - (show annotations)
Mon Jun 18 02:08:34 2007 UTC (14 years, 3 months ago) by jongui
File MIME type: text/x-python
File size: 2140 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
23 class Clipper:
24 """
25 Class that defines a clipper.
26 """
27
28 def __init__(self):
29 """
30 Initialise the clipper.
31 """
32
33 self.__vtk_clipper = vtk.vtkClipDataSet()
34
35 def _setupClipper(self, object, plane):
36 """
37 Setup the clipper.
38
39 @type object: vtkUnstructuredGrid, etc
40 @param object: Input for the clipper
41 @type plane: vtkPlane
42 @param plane: Plane to clip the object
43 """
44
45 self.__object = object
46 # True only if a plane is used to perform clipping. False for
47 # scalar clipping.
48 if(plane != None):
49 self.__plane = plane
50
51 self.__setInput()
52 self.setInsideOutOn()
53
54 def __setInput(self):
55 """
56 Set the input for the clipper.
57 """
58
59 self.__vtk_clipper.SetInput(self.__object)
60
61 def _setClipFunction(self):
62 """
63 Set the clip function (using a plane) for the clipper.
64 """
65
66 self.__vtk_clipper.SetClipFunction(self.__plane)
67
68 def setInsideOutOn(self):
69 """
70 Clip one side of the rendered object.
71 """
72
73 self.__vtk_clipper.InsideOutOn()
74
75 def setInsideOutOff(self):
76 """
77 Clips the other side of the rendered object.
78 """
79
80 self.__vtk_clipper.InsideOutOff()
81
82 def setClipValue(self, value):
83 """
84 Set the scalar clip value (intead of using a plane) for the clipper.
85
86 @type value: Number
87 @param value: Scalar clip value
88 """
89
90 self.__vtk_clipper.SetValue(value)
91
92 def _getClipperOutput(self):
93 """
94 Return the output of the clipper.
95
96 @rtype: vtkUnstructuredGrid
97 @return: Unstructured grid
98 """
99
100 return self.__vtk_clipper.GetOutput()
101

  ViewVC Help
Powered by ViewVC 1.1.26