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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 845 - (show annotations)
Fri Sep 8 07:13:01 2006 UTC (14 years ago) by jongui
File MIME type: text/x-python
File size: 845 byte(s)
Display an image is partially completed.

1 import vtk
2 from common import *
3
4 class Image(Common):
5
6 def __init__(self, scene, format):
7 Common.__init__(self, scene)
8 self.vtk_image_reader = self.determineReader(format)
9 self.vtk_texture = None
10 self.vtk_plane = None
11
12 def determineReader(self, format):
13 if(format == "jpg"):
14 return vtk.vtkJPEGReader()
15 elif(format == "bmp"):
16 return vtk.vtkBMPReader()
17
18 def setFileName(self, file_name):
19 self.vtk_image_reader.SetFileName(file_name)
20
21 self.setTexture()
22 self.setPlane()
23
24 Common.setMapper(self, "self.vtk_plane.GetOutput()")
25 Common.setActor(self)
26 Common.setTexture(self.vtk_texture)
27 Common.addActor(self)
28
29 def setTexture(self):
30 self.vtk_texture = vtk.vtkTexture()
31 self.vtk_texture.SetInput(self.vtk_image_reader.GetOutput())
32
33 def setPlane(self):
34 self.vtk_plane = vtk.vtkPlaneSource()
35
36
37
38
39
40
41
42

  ViewVC Help
Powered by ViewVC 1.1.26