VTK  9.1.20220527
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 =========================================================================*/
170 #ifndef vtkImageViewer2_h
171 #define vtkImageViewer2_h
172 
173 #include "vtkInteractionImageModule.h" // For export macro
174 #include "vtkObject.h"
175 
176 class vtkAlgorithm;
177 class vtkAlgorithmOutput;
178 class vtkImageActor;
179 class vtkImageData;
181 class vtkInformation;
183 class vtkRenderWindow;
184 class vtkRenderer;
186 
187 class VTKINTERACTIONIMAGE_EXPORT vtkImageViewer2 : public vtkObject
188 {
189 public:
190  static vtkImageViewer2* New();
191  vtkTypeMacro(vtkImageViewer2, vtkObject);
192  void PrintSelf(ostream& os, vtkIndent indent) override;
193 
197  virtual const char* GetWindowName();
198 
202  virtual void Render(void);
203 
205 
208  virtual void SetInputData(vtkImageData* in);
209  virtual vtkImageData* GetInput();
212 
217  enum
218  {
219  SLICE_ORIENTATION_YZ = 0,
220  SLICE_ORIENTATION_XZ = 1,
221  SLICE_ORIENTATION_XY = 2
222  };
223 
224  vtkGetMacro(SliceOrientation, int);
225  virtual void SetSliceOrientation(int orientation);
226  virtual void SetSliceOrientationToXY()
227  {
228  this->SetSliceOrientation(vtkImageViewer2::SLICE_ORIENTATION_XY);
229  }
230  virtual void SetSliceOrientationToYZ()
231  {
232  this->SetSliceOrientation(vtkImageViewer2::SLICE_ORIENTATION_YZ);
233  }
234  virtual void SetSliceOrientationToXZ()
235  {
236  this->SetSliceOrientation(vtkImageViewer2::SLICE_ORIENTATION_XZ);
237  }
238 
240 
244  vtkGetMacro(Slice, int);
245  virtual void SetSlice(int s);
247 
260  virtual void UpdateDisplayExtent();
261 
263 
267  virtual int GetSliceMin();
268  virtual int GetSliceMax();
269  virtual void GetSliceRange(int range[2]) { this->GetSliceRange(range[0], range[1]); }
270  virtual void GetSliceRange(int& min, int& max);
271  virtual int* GetSliceRange();
273 
275 
278  virtual double GetColorWindow();
279  virtual double GetColorLevel();
280  virtual void SetColorWindow(double s);
281  virtual void SetColorLevel(double s);
283 
285 
288  virtual void SetDisplayId(void* a);
289  virtual void SetWindowId(void* a);
290  virtual void SetParentId(void* a);
292 
294 
298  virtual int* GetPosition() VTK_SIZEHINT(2);
299 
305  virtual void SetPosition(int x, int y);
306  virtual void SetPosition(int a[2]) { this->SetPosition(a[0], a[1]); }
308 
310 
314  virtual int* GetSize() VTK_SIZEHINT(2);
315 
324  virtual void SetSize(int width, int height);
325  virtual void SetSize(int a[2]) { this->SetSize(a[0], a[1]); }
327 
329 
333  vtkGetObjectMacro(RenderWindow, vtkRenderWindow);
334  vtkGetObjectMacro(Renderer, vtkRenderer);
335  vtkGetObjectMacro(ImageActor, vtkImageActor);
336  vtkGetObjectMacro(WindowLevel, vtkImageMapToWindowLevelColors);
337  vtkGetObjectMacro(InteractorStyle, vtkInteractorStyleImage);
339 
341 
344  virtual void SetRenderWindow(vtkRenderWindow* arg);
345  virtual void SetRenderer(vtkRenderer* arg);
347 
352 
354 
361  vtkBooleanMacro(OffScreenRendering, vtkTypeBool);
363 
364 protected:
366  ~vtkImageViewer2() override;
367 
368  virtual void InstallPipeline();
369  virtual void UnInstallPipeline();
370 
377 
380  int Slice;
381 
382  virtual void UpdateOrientation();
383 
386 
387  friend class vtkImageViewer2Callback;
388 
389 private:
390  vtkImageViewer2(const vtkImageViewer2&) = delete;
391  void operator=(const vtkImageViewer2&) = delete;
392 };
393 
394 #endif
Proxy object to connect input/output ports.
Superclass for all sources, filters, and sinks in VTK.
Definition: vtkAlgorithm.h:122
draw an image in a rendered 3D scene
topologically and geometrically regular array of data
Definition: vtkImageData.h:163
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)
Set window and level for mapping pixels to colors.
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)
These are here when using a Tk window.
virtual void SetOffScreenRendering(vtkTypeBool)
Create a window in memory instead of on the screen.
vtkAlgorithm * GetInputAlgorithm()
vtkInformation * GetInputInformation()
vtkRenderer * Renderer
virtual vtkImageData * GetInput()
Set/Get the input image to the viewer.
virtual void SetSlice(int s)
Set/Get the current slice to display (depending on the orientation this can be in X,...
virtual void SetSliceOrientationToXZ()
virtual void GetSliceRange(int &min, int &max)
Return the minimum and maximum slice values (depending on the orientation this can be in X,...
vtkImageActor * ImageActor
virtual void SetupInteractor(vtkRenderWindowInteractor *)
Attach an interactor for the internal render window.
virtual void SetSize(int a[2])
Get the size (width and height) of the rendering window in screen coordinates (in pixels).
virtual void SetPosition(int a[2])
Get the position (x and y) of the rendering window in screen coordinates (in pixels).
virtual double GetColorLevel()
Set window and level for mapping pixels to colors.
virtual void SetInputConnection(vtkAlgorithmOutput *input)
Set/Get the input image to the viewer.
virtual void SetSliceOrientationToYZ()
~vtkImageViewer2() override
virtual void GetSliceRange(int range[2])
Return the minimum and maximum slice values (depending on the orientation this can be in X,...
virtual int GetSliceMax()
Return the minimum and maximum slice values (depending on the orientation this can be in X,...
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()
Create a window in memory instead of on the screen.
vtkRenderWindow * RenderWindow
virtual void SetColorWindow(double s)
Set window and level for mapping pixels to colors.
static vtkImageViewer2 * New()
virtual void Render(void)
Render the resulting image.
virtual void SetParentId(void *a)
These are here when using a Tk window.
virtual const char * GetWindowName()
Get the name of rendering window.
vtkRenderWindowInteractor * Interactor
virtual void SetSliceOrientationToXY()
virtual void SetRenderer(vtkRenderer *arg)
Set your own renderwindow and renderer.
virtual void SetInputData(vtkImageData *in)
Set/Get the input image to the viewer.
virtual int * GetSliceRange()
Return the minimum and maximum slice values (depending on the orientation this can be in X,...
vtkImageMapToWindowLevelColors * WindowLevel
vtkInteractorStyleImage * InteractorStyle
virtual void InstallPipeline()
virtual void UpdateOrientation()
a simple class to control print indentation
Definition: vtkIndent.h:119
Store vtkAlgorithm input/output information.
interactive manipulation of the camera specialized for images
abstract base class for most VTK objects
Definition: vtkObject.h:82
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:182
@ 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)