1 /*=========================================================================
3 Program: Visualization Toolkit
4 Module: $RCSfile: vtkImageViewer.h,v $
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.
11 Copyright (c) 1993-1995 Ken Martin, Will Schroeder, Bill Lorensen.
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.
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.
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.
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.
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.
51 #ifndef __vtkImageViewer_h
52 #define __vtkImageViewer_h
58 #include "vtkImageWindow.h"
59 #include "vtkStructuredPoints.h"
60 #include "vtkStructuredPointsToImage.h"
62 // For placement of origin in the viewer.
63 #define VTK_IMAGE_VIEWER_UPPER_LEFT 0
64 #define VTK_IMAGE_VIEWER_LOWER_LEFT 1
66 class VTK_EXPORT vtkImageViewer : public vtkObject
71 static vtkImageViewer *New() {return new vtkImageViewer;};
73 const char *GetClassName() {return "vtkImageViewer";};
74 void PrintSelf(ostream& os, vtkIndent indent);
77 // Get name of rendering window
78 char *GetWindowName() {return this->ImageWindow->GetWindowName();};
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);};
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);};
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);};
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);};
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();};
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]);
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]);
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;};
137 vtkImageMapper *ImageMapper;
138 vtkImageWindow *ImageWindow;