/[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 1199 - (hide annotations)
Wed Jun 20 05:01:30 2007 UTC (13 years, 9 months ago) by jongui
File MIME type: text/x-python
File size: 2147 byte(s)
- Updated the epydocs and guide.
Deleted redundant files and methods.
Tidied up the codes.
1 ksteube 1147 """
2 jongui 1197 @var __author__: name of author
3     @var __copyright__: copyrights
4     @var __license__: licence agreement
5     @var __url__: url entry point on documentation
6     @var __version__: version
7     @var __date__: date of the version
8 ksteube 1147 """
9    
10 jongui 1197 __author__="John Ngui, john.ngui@uq.edu.au"
11     __copyright__=""" Copyright (c) 2006 by ACcESS MNRF
12     http://www.access.edu.au
13     Primary Business: Queensland, Australia"""
14     __license__="""Licensed under the Open Software License version 3.0
15     http://www.opensource.org/licenses/osl-3.0.php"""
16     __url__="http://www.iservo.edu.au/esys"
17     __version__="$Revision$"
18     __date__="$Date$"
19    
20    
21 ksteube 1147 import vtk
22    
23     class ImageReslice:
24     """
25     Class that defines an image reslice used to resize static
26 jongui 1199 (no interaction capability) images (i.e. logo).
27 ksteube 1147 """
28    
29 jongui 1148 def __init__(self):
30 ksteube 1147 """
31     Initialise the image reslice.
32     """
33    
34     self.__vtk_image_reslice = vtk.vtkImageReslice()
35    
36 jongui 1148 def _setupImageReslice(self, object):
37 ksteube 1147 """
38     Setup the image reslice.
39 jongui 1148
40     @type object: vtkImageData
41     @param object: Image Data
42 ksteube 1147 """
43    
44 jongui 1148 self.__object = object
45 ksteube 1147 self.__setInput()
46    
47     def __setInput(self):
48     """
49     Set the input for the image reslice.
50     """
51    
52     self.__vtk_image_reslice.SetInput(self.__object)
53    
54     def setSize(self, size):
55     """
56 jongui 1199 Set the size of the image, between 0 and 2.
57 jongui 1154 Size 1 (one) displays the image in its original size
58     (which is the default).
59 ksteube 1147
60     @type size: Number
61     @param size: Size of the static image
62     """
63    
64     # By default, with image reslice, the larger the output spacing, the
65     # smaller the image. Similarly, the smaller the output spacing, the
66     # larger the image. This behaviour is reversed so that the larger the
67 jongui 1199 # size the larger the image. Similarly, the smaller the size, the
68     # smaller the image.
69 ksteube 1147 if(size > 1):
70     size = 1 - (size - 1)
71     self.__vtk_image_reslice.SetOutputSpacing(size, size, size)
72     elif(size < 1):
73     size = (1 - size) + 1
74     self.__vtk_image_reslice.SetOutputSpacing(size, size, size)
75    
76 jongui 1148 def _getImageResliceOutput(self):
77 ksteube 1147 """
78     Return the output of the image reslice.
79    
80     @rtype: vtkImageData
81     @return: Image data
82     """
83    
84     return self.__vtk_image_reslice.GetOutput()

  ViewVC Help
Powered by ViewVC 1.1.26