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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1108 by jongui, Thu Apr 19 04:02:11 2007 UTC revision 1110 by jongui, Thu Apr 19 05:24:28 2007 UTC
# Line 1  Line 1 
1    """
2    @author: John NGUI
3    """
4    
5  import vtk  import vtk
6    
7  class ImageReslice:  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):      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          self.__object = object
22          self.__vtk_image_reslice = vtk.vtkImageReslice()          self.__vtk_image_reslice = vtk.vtkImageReslice()
23    
24          self.__setupImageReslice()          self.__setupImageReslice()
25    
26      def __setupImageReslice(self):      def __setupImageReslice(self):
27            """
28            Setup the image reslice.
29            """
30    
31          self.__setInput()          self.__setInput()
32    
33      def __setInput(self):      def __setInput(self):
34            """
35            Set the input for the image reslice.
36            """
37    
38          self.__vtk_image_reslice.SetInput(self.__object)                  self.__vtk_image_reslice.SetInput(self.__object)        
39    
40      def setSize(self, size):      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 object: 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):          if(size > 1):
55              size = 1 - (size - 1)              size = 1 - (size - 1)
56              self.__vtk_image_reslice.SetOutputSpacing(size, size, size)              self.__vtk_image_reslice.SetOutputSpacing(size, size, size)
# Line 24  class ImageReslice: Line 59  class ImageReslice:
59              self.__vtk_image_reslice.SetOutputSpacing(size, size, size)              self.__vtk_image_reslice.SetOutputSpacing(size, size, size)
60    
61      def _getOutput(self):      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()          return self.__vtk_image_reslice.GetOutput()

Legend:
Removed from v.1108  
changed lines
  Added in v.1110

  ViewVC Help
Powered by ViewVC 1.1.26