/[escript]/tags/trunk_2172_checkpoint/pyvisi/py_src/imagereslice.py
ViewVC logotype

Contents of /tags/trunk_2172_checkpoint/pyvisi/py_src/imagereslice.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2175 - (show annotations)
Wed Dec 17 09:22:40 2008 UTC (12 years, 2 months ago) by phornby
File MIME type: text/x-python
File size: 2541 byte(s)
Try again at conforming to naming convention.
1
2 ########################################################
3 #
4 # Copyright (c) 2003-2008 by University of Queensland
5 # Earth Systems Science Computational Center (ESSCC)
6 # http://www.uq.edu.au/esscc
7 #
8 # Primary Business: Queensland, Australia
9 # Licensed under the Open Software License version 3.0
10 # http://www.opensource.org/licenses/osl-3.0.php
11 #
12 ########################################################
13
14 __copyright__="""Copyright (c) 2003-2008 by University of Queensland
15 Earth Systems Science Computational Center (ESSCC)
16 http://www.uq.edu.au/esscc
17 Primary Business: Queensland, Australia"""
18 __license__="""Licensed under the Open Software License version 3.0
19 http://www.opensource.org/licenses/osl-3.0.php"""
20 __url__="http://www.uq.edu.au/esscc/escript-finley"
21
22 """
23 @var __author__: name of author
24 @var __copyright__: copyrights
25 @var __license__: licence agreement
26 @var __url__: url entry point on documentation
27 @var __version__: version
28 @var __date__: date of the version
29 """
30
31 __author__="John Ngui, john.ngui@uq.edu.au"
32
33
34 import vtk
35
36 class ImageReslice:
37 """
38 Class that defines an image reslice used to resize static
39 (no interaction capability) images (i.e. logo).
40 """
41
42 def __init__(self):
43 """
44 Initialise the image reslice.
45 """
46
47 self.__vtk_image_reslice = vtk.vtkImageReslice()
48
49 def _setupImageReslice(self, object):
50 """
51 Setup the image reslice.
52
53 @type object: vtkImageData
54 @param object: Image Data
55 """
56
57 self.__object = object
58 self.__setInput()
59
60 def __setInput(self):
61 """
62 Set the input for the image reslice.
63 """
64
65 self.__vtk_image_reslice.SetInput(self.__object)
66
67 def setSize(self, size):
68 """
69 Set the size of the image, between 0 and 2.
70 Size 1 (one) displays the image in its original size
71 (which is the default).
72
73 @type size: Number
74 @param size: Size of the static image
75 """
76
77 # By default, with image reslice, the larger the output spacing, the
78 # smaller the image. Similarly, the smaller the output spacing, the
79 # larger the image. This behaviour is reversed so that the larger the
80 # size the larger the image. Similarly, the smaller the size, the
81 # smaller the image.
82 if(size > 1):
83 size = 1 - (size - 1)
84 self.__vtk_image_reslice.SetOutputSpacing(size, size, size)
85 elif(size < 1):
86 size = (1 - size) + 1
87 self.__vtk_image_reslice.SetOutputSpacing(size, size, size)
88
89 def _getImageResliceOutput(self):
90 """
91 Return the output of the image reslice.
92
93 @rtype: vtkImageData
94 @return: Image data
95 """
96
97 return self.__vtk_image_reslice.GetOutput()

  ViewVC Help
Powered by ViewVC 1.1.26