/[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 1147 - (hide annotations)
Wed May 16 06:39:11 2007 UTC (14 years ago) by ksteube
File MIME type: text/x-python
File size: 1534 byte(s)
Added back in some files that were accidentally deleted.

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     def __init__(self, object):
14     """
15     Initialise the image reslice.
16    
17     @type object: vtkImageData
18     @param object: Image Data
19     """
20    
21     self.__object = object
22     self.__vtk_image_reslice = vtk.vtkImageReslice()
23    
24     self.__setupImageReslice()
25    
26     def __setupImageReslice(self):
27     """
28     Setup the image reslice.
29     """
30    
31     self.__setInput()
32    
33     def __setInput(self):
34     """
35     Set the input for the image reslice.
36     """
37    
38     self.__vtk_image_reslice.SetInput(self.__object)
39    
40     def setSize(self, size):
41     """
42     Set the size of the image, between 0 and 2. Size 1 (one) displays the
43     image in its original size (which is the default).
44    
45     @type size: Number
46     @param size: Size of the static image
47     """
48    
49     # By default, with image reslice, the larger the output spacing, the
50     # smaller the image. Similarly, the smaller the output spacing, the
51     # larger the image. This behaviour is reversed so that the larger the
52     # size the image. Similarly, the smaller the size, the smaller the
53     # image.
54     if(size > 1):
55     size = 1 - (size - 1)
56     self.__vtk_image_reslice.SetOutputSpacing(size, size, size)
57     elif(size < 1):
58     size = (1 - size) + 1
59     self.__vtk_image_reslice.SetOutputSpacing(size, size, size)
60    
61     def _getOutput(self):
62     """
63     Return the output of the image reslice.
64    
65     @rtype: vtkImageData
66     @return: Image data
67     """
68    
69     return self.__vtk_image_reslice.GetOutput()

  ViewVC Help
Powered by ViewVC 1.1.26