VTK  9.3.0
vtkImageViewer2.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
58 #ifndef vtkImageViewer2_h
59 #define vtkImageViewer2_h
60 
61 #include "vtkInteractionImageModule.h" // For export macro
62 #include "vtkObject.h"
63 
64 VTK_ABI_NAMESPACE_BEGIN
65 class vtkAlgorithm;
66 class vtkAlgorithmOutput;
67 class vtkImageActor;
68 class vtkImageData;
70 class vtkInformation;
72 class vtkRenderWindow;
73 class vtkRenderer;
75 
76 class VTKINTERACTIONIMAGE_EXPORT vtkImageViewer2 : public vtkObject
77 {
78 public:
79  static vtkImageViewer2* New();
80  vtkTypeMacro(vtkImageViewer2, vtkObject);
81  void PrintSelf(ostream& os, vtkIndent indent) override;
82 
86  virtual const char* GetWindowName();
87 
91  virtual void Render();
92 
94 
97  virtual void SetInputData(vtkImageData* in);
98  virtual vtkImageData* GetInput();
99  virtual void SetInputConnection(vtkAlgorithmOutput* input);
101 
106  enum
107  {
108  SLICE_ORIENTATION_YZ = 0,
109  SLICE_ORIENTATION_XZ = 1,
110  SLICE_ORIENTATION_XY = 2
111  };
112 
113  vtkGetMacro(SliceOrientation, int);
114  virtual void SetSliceOrientation(int orientation);
115  virtual void SetSliceOrientationToXY()
116  {
117  this->SetSliceOrientation(vtkImageViewer2::SLICE_ORIENTATION_XY);
118  }
119  virtual void SetSliceOrientationToYZ()
120  {
121  this->SetSliceOrientation(vtkImageViewer2::SLICE_ORIENTATION_YZ);
122  }
123  virtual void SetSliceOrientationToXZ()
124  {
125  this->SetSliceOrientation(vtkImageViewer2::SLICE_ORIENTATION_XZ);
126  }
127 
129 
133  vtkGetMacro(Slice, int);
134  virtual void SetSlice(int s);
136 
149  virtual void UpdateDisplayExtent();
150 
152 
156  virtual int GetSliceMin();
157  virtual int GetSliceMax();
158  virtual void GetSliceRange(int range[2]) { this->GetSliceRange(range[0], range[1]); }
159  virtual void GetSliceRange(int& min, int& max);
160  virtual int* GetSliceRange();
162 
164 
167  virtual double GetColorWindow();
168  virtual double GetColorLevel();
169  virtual void SetColorWindow(double s);
170  virtual void SetColorLevel(double s);
172 
174 
177  virtual void SetDisplayId(void* a);
178  virtual void SetWindowId(void* a);
179  virtual void SetParentId(void* a);
181 
183 
187  virtual int* GetPosition() VTK_SIZEHINT(2);
188 
194  virtual void SetPosition(int x, int y);
195  virtual void SetPosition(int a[2]) { this->SetPosition(a[0], a[1]); }
197 
199 
203  virtual int* GetSize() VTK_SIZEHINT(2);
204 
213  virtual void SetSize(int width, int height);
214  virtual void SetSize(int a[2]) { this->SetSize(a[0], a[1]); }
216 
218 
222  vtkGetObjectMacro(RenderWindow, vtkRenderWindow);
223  vtkGetObjectMacro(Renderer, vtkRenderer);
224  vtkGetObjectMacro(ImageActor, vtkImageActor);
225  vtkGetObjectMacro(WindowLevel, vtkImageMapToWindowLevelColors);
226  vtkGetObjectMacro(InteractorStyle, vtkInteractorStyleImage);
228 
230 
233  virtual void SetRenderWindow(vtkRenderWindow* arg);
234  virtual void SetRenderer(vtkRenderer* arg);
236 
241 
243 
250  vtkBooleanMacro(OffScreenRendering, vtkTypeBool);
252 
253 protected:
255  ~vtkImageViewer2() override;
256 
257  virtual void InstallPipeline();
258  virtual void UnInstallPipeline();
259 
266 
269  int Slice;
270 
271  virtual void UpdateOrientation();
272 
275 
276  friend class vtkImageViewer2Callback;
277 
278 private:
279  vtkImageViewer2(const vtkImageViewer2&) = delete;
280  void operator=(const vtkImageViewer2&) = delete;
281 };
282 
283 VTK_ABI_NAMESPACE_END
284 #endif
Proxy object to connect input/output ports.
Superclass for all sources, filters, and sinks in VTK.
Definition: vtkAlgorithm.h:61
draw an image in a rendered 3D scene
Definition: vtkImageActor.h:47
topologically and geometrically regular array of data
Definition: vtkImageData.h:52
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 Render()
Render the resulting image.
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 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:38
Store vtkAlgorithm input/output information.
interactive manipulation of the camera specialized for images
abstract base class for most VTK objects
Definition: vtkObject.h:61
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:71
@ orientation
Definition: vtkX3D.h:262
@ range
Definition: vtkX3D.h:238
@ height
Definition: vtkX3D.h:254
int vtkTypeBool
Definition: vtkABI.h:64
#define VTK_SIZEHINT(...)
#define max(a, b)