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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1154 - (show annotations)
Fri May 18 02:46:32 2007 UTC (12 years, 6 months ago) by jongui
File MIME type: text/x-python
File size: 1539 byte(s)
Updated the in-line documentation and guide.
1 """
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 def __init__(self):
14 """
15 Initialise the image reslice.
16 """
17
18 self.__vtk_image_reslice = vtk.vtkImageReslice()
19
20 def _setupImageReslice(self, object):
21 """
22 Setup the image reslice.
23
24 @type object: vtkImageData
25 @param object: Image Data
26 """
27
28 self.__object = object
29 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 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
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 def _getImageResliceOutput(self):
61 """
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