VTK  9.0.1
vtkImageViewer2.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkImageViewer2.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
58 #ifndef vtkImageViewer2_h
59 #define vtkImageViewer2_h
60 
61 #include "vtkInteractionImageModule.h" // For export macro
62 #include "vtkObject.h"
63 
64 class vtkAlgorithm;
65 class vtkAlgorithmOutput;
66 class vtkImageActor;
67 class vtkImageData;
69 class vtkInformation;
71 class vtkRenderWindow;
72 class vtkRenderer;
74 
75 class VTKINTERACTIONIMAGE_EXPORT vtkImageViewer2 : public vtkObject
76 {
77 public:
78  static vtkImageViewer2* New();
79  vtkTypeMacro(vtkImageViewer2, vtkObject);
80  void PrintSelf(ostream& os, vtkIndent indent) override;
81 
85  virtual const char* GetWindowName();
86 
90  virtual void Render(void);
91 
93 
96  virtual void SetInputData(vtkImageData* in);
97  virtual vtkImageData* GetInput();
98  virtual void SetInputConnection(vtkAlgorithmOutput* input);
100 
105  enum
106  {
107  SLICE_ORIENTATION_YZ = 0,
108  SLICE_ORIENTATION_XZ = 1,
109  SLICE_ORIENTATION_XY = 2
110  };
111 
112  vtkGetMacro(SliceOrientation, int);
113  virtual void SetSliceOrientation(int orientation);
114  virtual void SetSliceOrientationToXY()
115  {
116  this->SetSliceOrientation(vtkImageViewer2::SLICE_ORIENTATION_XY);
117  }
118  virtual void SetSliceOrientationToYZ()
119  {
120  this->SetSliceOrientation(vtkImageViewer2::SLICE_ORIENTATION_YZ);
121  }
122  virtual void SetSliceOrientationToXZ()
123  {
124  this->SetSliceOrientation(vtkImageViewer2::SLICE_ORIENTATION_XZ);
125  }
126 
128 
132  vtkGetMacro(Slice, int);
133  virtual void SetSlice(int s);
135 
148  virtual void UpdateDisplayExtent();
149 
151 
155  virtual int GetSliceMin();
156  virtual int GetSliceMax();
157  virtual void GetSliceRange(int range[2]) { this->GetSliceRange(range[0], range[1]); }
158  virtual void GetSliceRange(int& min, int& max);
159  virtual int* GetSliceRange();
161 
163 
166  virtual double GetColorWindow();
167  virtual double GetColorLevel();
168  virtual void SetColorWindow(double s);
169  virtual void SetColorLevel(double s);
171 
173 
176  virtual void SetDisplayId(void* a);
177  virtual void SetWindowId(void* a);
178  virtual void SetParentId(void* a);
180 
182 
186  virtual int* GetPosition() VTK_SIZEHINT(2);
187 
193  virtual void SetPosition(int x, int y);
194  virtual void SetPosition(int a[2]) { this->SetPosition(a[0], a[1]); }
196 
198 
202  virtual int* GetSize() VTK_SIZEHINT(2);
203 
212  virtual void SetSize(int width, int height);
213  virtual void SetSize(int a[2]) { this->SetSize(a[0], a[1]); }
215 
217 
221  vtkGetObjectMacro(RenderWindow, vtkRenderWindow);
222  vtkGetObjectMacro(Renderer, vtkRenderer);
223  vtkGetObjectMacro(ImageActor, vtkImageActor);
224  vtkGetObjectMacro(WindowLevel, vtkImageMapToWindowLevelColors);
225  vtkGetObjectMacro(InteractorStyle, vtkInteractorStyleImage);
227 
229 
232  virtual void SetRenderWindow(vtkRenderWindow* arg);
233  virtual void SetRenderer(vtkRenderer* arg);
235 
240 
242 
249  vtkBooleanMacro(OffScreenRendering, vtkTypeBool);
251 
252 protected:
254  ~vtkImageViewer2() override;
255 
256  virtual void InstallPipeline();
257  virtual void UnInstallPipeline();
258 
265 
268  int Slice;
269 
270  virtual void UpdateOrientation();
271 
274 
275  friend class vtkImageViewer2Callback;
276 
277 private:
278  vtkImageViewer2(const vtkImageViewer2&) = delete;
279  void operator=(const vtkImageViewer2&) = delete;
280 };
281 
282 #endif
Proxy object to connect input/output ports.
Superclass for all sources, filters, and sinks in VTK.
Definition: vtkAlgorithm.h:54
draw an image in a rendered 3D scene
Definition: vtkImageActor.h:43
topologically and geometrically regular array of data
Definition: vtkImageData.h:42
Map an image through a lookup table and/or a window/level.
Display a 2D image.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void SetDisplayId(void *a)
These are here when using a Tk window.
virtual int GetSliceMin()
Return the minimum and maximum slice values (depending on the orientation this can be in X,...
virtual void SetSliceOrientation(int orientation)
virtual void SetColorLevel(double s)
virtual void UnInstallPipeline()
virtual int * GetSize()
Get the size (width and height) of the rendering window in screen coordinates (in pixels).
virtual void UpdateDisplayExtent()
Update the display extent manually so that the proper slice for the given orientation is displayed.
virtual int * GetPosition()
Get the position (x and y) of the rendering window in screen coordinates (in pixels).
virtual void SetWindowId(void *a)
virtual void SetOffScreenRendering(vtkTypeBool)
Create a window in memory instead of on the screen.
vtkAlgorithm * GetInputAlgorithm()
vtkInformation * GetInputInformation()
vtkRenderer * Renderer
virtual vtkImageData * GetInput()
virtual void SetSlice(int s)
virtual void SetSliceOrientationToXZ()
virtual void GetSliceRange(int &min, int &max)
vtkImageActor * ImageActor
virtual void SetupInteractor(vtkRenderWindowInteractor *)
Attach an interactor for the internal render window.
virtual void SetSize(int a[2])
virtual void SetPosition(int a[2])
virtual double GetColorLevel()
virtual void SetInputConnection(vtkAlgorithmOutput *input)
virtual void SetSliceOrientationToYZ()
~vtkImageViewer2() override
virtual void GetSliceRange(int range[2])
virtual int GetSliceMax()
virtual double GetColorWindow()
Set window and level for mapping pixels to colors.
virtual void SetRenderWindow(vtkRenderWindow *arg)
Set your own renderwindow and renderer.
virtual vtkTypeBool GetOffScreenRendering()
vtkRenderWindow * RenderWindow
virtual void SetColorWindow(double s)
static vtkImageViewer2 * New()
virtual void Render(void)
Render the resulting image.
virtual void SetParentId(void *a)
virtual const char * GetWindowName()
Get the name of rendering window.
vtkRenderWindowInteractor * Interactor
virtual void SetSliceOrientationToXY()
virtual void SetRenderer(vtkRenderer *arg)
virtual void SetInputData(vtkImageData *in)
Set/Get the input image to the viewer.
virtual int * GetSliceRange()
vtkImageMapToWindowLevelColors * WindowLevel
vtkInteractorStyleImage * InteractorStyle
virtual void InstallPipeline()
virtual void UpdateOrientation()
a simple class to control print indentation
Definition: vtkIndent.h:34
Store vtkAlgorithm input/output information.
interactive manipulation of the camera specialized for images
abstract base class for most VTK objects
Definition: vtkObject.h:54
platform-independent render window interaction including picking and frame rate control.
create a window for renderers to draw into
abstract specification for renderers
Definition: vtkRenderer.h:59
@ orientation
Definition: vtkX3D.h:268
@ range
Definition: vtkX3D.h:244
@ height
Definition: vtkX3D.h:260
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_SIZEHINT(...)
#define max(a, b)