OSDN Git Service

FIRST REPOSITORY
[eos/hostdependOTHERS.git] / HP / util / HP / include / vtk / vtkImageViewer.h
1 /*=========================================================================
2
3   Program:   Visualization Toolkit
4   Module:    $RCSfile: vtkImageViewer.h,v $
5   Language:  C++
6   Date:      $Date: 2002/02/01 06:33:23 $
7   Version:   $Revision: 1.1.1.1 $
8   Thanks:    Thanks to C. Charles Law who developed this class.
9
10
11 Copyright (c) 1993-1995 Ken Martin, Will Schroeder, Bill Lorensen.
12
13 This software is copyrighted by Ken Martin, Will Schroeder and Bill Lorensen.
14 The following terms apply to all files associated with the software unless
15 explicitly disclaimed in individual files. This copyright specifically does
16 not apply to the related textbook "The Visualization Toolkit" ISBN
17 013199837-4 published by Prentice Hall which is covered by its own copyright.
18
19 The authors hereby grant permission to use, copy, and distribute this
20 software and its documentation for any purpose, provided that existing
21 copyright notices are retained in all copies and that this notice is included
22 verbatim in any distributions. Additionally, the authors grant permission to
23 modify this software and its documentation for any purpose, provided that
24 such modifications are not distributed without the explicit consent of the
25 authors and that existing copyright notices are retained in all copies. Some
26 of the algorithms implemented by this software are patented, observe all
27 applicable patent law.
28
29 IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY FOR
30 DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
31 OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF,
32 EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
34 THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING,
35 BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
36 PARTICULAR PURPOSE, AND NON-INFRINGEMENT.  THIS SOFTWARE IS PROVIDED ON AN
37 "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE
38 MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
39
40
41 =========================================================================*/
42 // .NAME vtkImageViewer - Display a 2d image.
43 // .SECTION Description
44 // vtkImageViewer is a concinience class for displaying a 2d image.
45 // It packages up the functionality found in vtkImageWindow,
46 // vtkImager and vtkImageMapper into a single easy to use class.
47 // Behind the scenes these three classes are actually used to 
48 // to provide the required funcitonality. vtkImageViewer is
49 // simply a wrapper around them.
50
51 #ifndef __vtkImageViewer_h
52 #define __vtkImageViewer_h
53
54 #include <fstream.h>
55 #include <stdlib.h>
56 #include <iostream.h>
57
58 #include "vtkImageWindow.h"
59 #include "vtkStructuredPoints.h"
60 #include "vtkStructuredPointsToImage.h"
61
62 // For placement of origin in the viewer.
63 #define VTK_IMAGE_VIEWER_UPPER_LEFT 0
64 #define VTK_IMAGE_VIEWER_LOWER_LEFT 1
65
66 class VTK_EXPORT vtkImageViewer : public vtkObject 
67 {
68 public:
69   vtkImageViewer();
70   ~vtkImageViewer();
71   static vtkImageViewer *New() {return new vtkImageViewer;};
72   
73   const char *GetClassName() {return "vtkImageViewer";};
74   void PrintSelf(ostream& os, vtkIndent indent);
75
76   // Description:
77   // Get name of rendering window
78   char *GetWindowName() {return this->ImageWindow->GetWindowName();};
79
80   void Render(void);
81   
82   // Description:
83   // Set/Get the input to the viewer.
84   void SetInput(vtkImageCache *in) {this->ImageMapper->SetInput(in);};
85   vtkImageCache *GetInput() { return this->ImageMapper->GetInput();};
86   void SetInput(vtkStructuredPoints *spts) {this->ImageMapper->SetInput(spts);};
87   
88   // Description:
89   // This is for a tcl interface
90   int GetWholeZMin() {return this->ImageMapper->GetWholeZMin();};
91   int GetWholeZMax() {return this->ImageMapper->GetWholeZMax();};
92   int GetZSlice() {return this->ImageMapper->GetZSlice();};
93   void SetZSlice(int s) {this->ImageMapper->SetZSlice(s);};
94   
95   // Description:
96   // Sets window/level for mapping pixels to colors.
97   float GetColorWindow() {return this->ImageMapper->GetColorWindow();};
98   float GetColorLevel() {return this->ImageMapper->GetColorLevel();};
99   void SetColorWindow(float s) {this->ImageMapper->SetColorWindow(s);};
100   void SetColorLevel(float s) {this->ImageMapper->SetColorLevel(s);};
101
102   // Description:
103   // These are here for using a tk window.
104   void SetDisplayId(void *a) {this->ImageWindow->SetDisplayId(a);};
105   void SetWindowId(void *a) {this->ImageWindow->SetWindowId(a);};
106   void SetParentId(void *a) {this->ImageWindow->SetParentId(a);};
107   
108   // Description:
109   // By default this is a color viewer. 
110   // GrayScaleHintOn will improve the appearance
111   // of gray scale images on some systems.
112   int GetGrayScaleHint() {return this->ImageWindow->GetGrayScaleHint();};
113   void SetGrayScaleHint(int a) {this->ImageWindow->SetGrayScaleHint(a);};
114   void GrayScaleHintOn() {this->ImageWindow->GrayScaleHintOn();};
115   void GrayScaleHintOff() {this->ImageWindow->GrayScaleHintOff();};
116
117   // Description:
118   // Set/Get the position in screen coordinates of the rendering window.
119   int *GetPosition() {return this->ImageWindow->GetPosition();};
120   void SetPosition(int a,int b) {this->ImageWindow->SetPosition(a,b);};
121   virtual void SetPosition(int a[2]);
122
123   // Description:
124   // Set/Get the size of the window in screen coordinates.
125   int *GetSize() {return this->ImageWindow->GetSize();};
126   void SetSize(int a,int b) {this->ImageWindow->SetSize(a,b);};
127   virtual void SetSize(int a[2]);
128   
129   // Description:
130   // Get the internal Window Imager and Mapper
131   vtkImageWindow *GetImageWindow() {return this->ImageWindow;};
132   vtkImageMapper *GetImageMapper() {return this->ImageMapper;};
133   vtkImager      *GetImager() {return this->Imager;};
134   vtkActor2D     *GetActor2D() {return this->Actor2D;};
135   
136 protected:
137   vtkImageMapper *ImageMapper;
138   vtkImageWindow *ImageWindow;
139   vtkImager      *Imager;
140   vtkActor2D     *Actor2D;
141 };
142
143 #endif
144
145