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

Annotation of /trunk/pyvisi/py_src/imagereslice.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1154 - (hide annotations)
Fri May 18 02:46:32 2007 UTC (13 years, 11 months ago) by jongui
File MIME type: text/x-python
File size: 1539 byte(s)
Updated the in-line documentation and guide.
1 ksteube 1147 """
2     @author: John NGUI
3     """
4    
5     import vtk
6    
7     class ImageReslice:
8     """
9     Class that defines an image reslice used to resize static
10     (no interaction capability) images.
11     """
12    
13 jongui 1148 def __init__(self):
14 ksteube 1147 """
15     Initialise the image reslice.
16     """
17    
18     self.__vtk_image_reslice = vtk.vtkImageReslice()
19    
20 jongui 1148 def _setupImageReslice(self, object):
21 ksteube 1147 """
22     Setup the image reslice.
23 jongui 1148
24     @type object: vtkImageData
25     @param object: Image Data
26 ksteube 1147 """
27    
28 jongui 1148 self.__object = object
29 ksteube 1147 self.__setInput()
30    
31     def __setInput(self):
32     """
33     Set the input for the image reslice.
34     """
35    
36     self.__vtk_image_reslice.SetInput(self.__object)
37    
38     def setSize(self, size):
39     """
40 jongui 1154 Set the size of the image (logo in particular), between 0 and 2.
41     Size 1 (one) displays the image in its original size
42     (which is the default).
43 ksteube 1147
44     @type size: Number
45     @param size: Size of the static image
46     """
47    
48     # By default, with image reslice, the larger the output spacing, the
49     # smaller the image. Similarly, the smaller the output spacing, the
50     # larger the image. This behaviour is reversed so that the larger the
51     # size the image. Similarly, the smaller the size, the smaller the
52     # image.
53     if(size > 1):
54     size = 1 - (size - 1)
55     self.__vtk_image_reslice.SetOutputSpacing(size, size, size)
56     elif(size < 1):
57     size = (1 - size) + 1
58     self.__vtk_image_reslice.SetOutputSpacing(size, size, size)
59    
60 jongui 1148 def _getImageResliceOutput(self):
61 ksteube 1147 """
62     Return the output of the image reslice.
63    
64     @rtype: vtkImageData
65     @return: Image data
66     """
67    
68     return self.__vtk_image_reslice.GetOutput()

  ViewVC Help
Powered by ViewVC 1.1.26