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

Diff of /trunk/pyvisi/py_src/mapper.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1112 by jongui, Thu Apr 19 06:31:49 2007 UTC revision 1113 by jongui, Thu Apr 19 08:53:24 2007 UTC
# Line 76  class DataSetMapper: Line 76  class DataSetMapper:
76    
77    
78  class ImageMapper:  class ImageMapper:
79        """
80        Class that defines a image mapper.
81        """
82    
83      def __init__(self, object):      def __init__(self, object):
84            """
85            Initialise the image mapper.
86            
87            @type object: vtkImageData
88            @param object: Image data
89            """
90    
91          self.__object = object          self.__object = object
92          self.__vtk_image_mapper = vtk.vtkImageMapper()          self.__vtk_image_mapper = vtk.vtkImageMapper()
93    
94          self.__setupImageMapper()          self.__setupImageMapper()
95    
96      def __setupImageMapper(self):      def __setupImageMapper(self):
97            """
98            Setup the image mapper.
99            """
100    
101          self.__setInput()          self.__setInput()
102            # Both color window and color level needs to be set, otherwise only
103            # a black image will be produced. Both values were obtained from
104            # an example found on the VTK site.
105          self.__setColorWindow(255)          self.__setColorWindow(255)
106          self.__setColorLevel(127.5)          self.__setColorLevel(127.5)
107    
108      def __setInput(self):      def __setInput(self):
109            """
110            Set the input for the image mapper.
111            """
112    
113          self.__vtk_image_mapper.SetInput(self.__object)          self.__vtk_image_mapper.SetInput(self.__object)
114    
115      def __setColorWindow(self, color):      def __setColorWindow(self, color):
116            """
117            Set the color of the window.
118            """
119    
120          self.__vtk_image_mapper.SetColorWindow(color)          self.__vtk_image_mapper.SetColorWindow(color)
121    
122      def __setColorLevel(self, color):      def __setColorLevel(self, color):
123            """
124            Set the color level of the window.
125            """
126    
127          self.__vtk_image_mapper.SetColorLevel(color)          self.__vtk_image_mapper.SetColorLevel(color)
128    
129      def _getImageMapper(self):      def _getImageMapper(self):
130            """
131            Return the image mapper.
132    
133            @rtype: vtkImageMapper
134            @return: Image mapper
135            """
136    
137          return self.__vtk_image_mapper          return self.__vtk_image_mapper

Legend:
Removed from v.1112  
changed lines
  Added in v.1113

  ViewVC Help
Powered by ViewVC 1.1.26