VTK  9.3.20240329
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
158 #ifndef vtkImageViewer2_h
159 #define vtkImageViewer2_h
160 
161 #include "vtkInteractionImageModule.h" // For export macro
162 #include "vtkObject.h"
163 
164 VTK_ABI_NAMESPACE_BEGIN
165 class vtkAlgorithm;
166 class vtkAlgorithmOutput;
167 class vtkImageActor;
168 class vtkImageData;
170 class vtkInformation;
172 class vtkRenderWindow;
173 class vtkRenderer;
175 
176 class VTKINTERACTIONIMAGE_EXPORT vtkImageViewer2 : public vtkObject
177 {
178 public:
179  static vtkImageViewer2* New();
180  vtkTypeMacro(vtkImageViewer2, vtkObject);
181  void PrintSelf(ostream& os, vtkIndent indent) override;
182 
186  virtual const char* GetWindowName();
187 
191  virtual void Render();
192 
194 
197  virtual void SetInputData(vtkImageData* in);
198  virtual vtkImageData* GetInput();
201 
206  enum
207  {
208  SLICE_ORIENTATION_YZ = 0,
209  SLICE_ORIENTATION_XZ = 1,
210  SLICE_ORIENTATION_XY = 2
211  };
212 
213  vtkGetMacro(SliceOrientation, int);
214  virtual void SetSliceOrientation(int orientation);
215  virtual void SetSliceOrientationToXY()
216  {
217  this->SetSliceOrientation(vtkImageViewer2::SLICE_ORIENTATION_XY);
218  }
219  virtual void SetSliceOrientationToYZ()
220  {
221  this->SetSliceOrientation(vtkImageViewer2::SLICE_ORIENTATION_YZ);
222  }
223  virtual void SetSliceOrientationToXZ()
224  {
225  this->SetSliceOrientation(vtkImageViewer2::SLICE_ORIENTATION_XZ);
226  }
227 
229 
233  vtkGetMacro(Slice, int);
234  virtual void SetSlice(int s);
236 
249  virtual void UpdateDisplayExtent();
250 
252 
256  virtual int GetSliceMin();
257  virtual int GetSliceMax();
258  virtual void GetSliceRange(int range[2]) { this->GetSliceRange(range[0], range[1]); }
259  virtual void GetSliceRange(int& min, int& max);
260  virtual int* GetSliceRange();
262 
264 
267  virtual double GetColorWindow();
268  virtual double GetColorLevel();
269  virtual void SetColorWindow(double s);
270  virtual void SetColorLevel(double s);
272 
274 
277  virtual void SetDisplayId(void* a);
278  virtual void SetWindowId(void* a);
279  virtual void SetParentId(void* a);
281 
283 
287  virtual int* GetPosition() VTK_SIZEHINT(2);
288 
294  virtual void SetPosition(int x, int y);
295  virtual void SetPosition(int a[2]) { this->SetPosition(a[0], a[1]); }
297 
299 
303  virtual int* GetSize() VTK_SIZEHINT(2);
304 
313  virtual void SetSize(int width, int height);
314  virtual void SetSize(int a[2]) { this->SetSize(a[0], a[1]); }
316 
318 
322  vtkGetObjectMacro(RenderWindow, vtkRenderWindow);
323  vtkGetObjectMacro(Renderer, vtkRenderer);
324  vtkGetObjectMacro(ImageActor, vtkImageActor);
325  vtkGetObjectMacro(WindowLevel, vtkImageMapToWindowLevelColors);
326  vtkGetObjectMacro(InteractorStyle, vtkInteractorStyleImage);
328 
330 
333  virtual void SetRenderWindow(vtkRenderWindow* arg);
334  virtual void SetRenderer(vtkRenderer* arg);
336 
341 
343 
350  vtkBooleanMacro(OffScreenRendering, vtkTypeBool);
352 
353 protected:
355  ~vtkImageViewer2() override;
356 
357  virtual void InstallPipeline();
358  virtual void UnInstallPipeline();
359 
366 
369  int Slice;
370 
371  virtual void UpdateOrientation();
372 
375 
376  friend class vtkImageViewer2Callback;
377 
378 private:
379  vtkImageViewer2(const vtkImageViewer2&) = delete;
380  void operator=(const vtkImageViewer2&) = delete;
381 };
382 
383 VTK_ABI_NAMESPACE_END
384 #endif
Proxy object to connect input/output ports.
Superclass for all sources, filters, and sinks in VTK.
Definition: vtkAlgorithm.h:162
draw an image in a rendered 3D scene
topologically and geometrically regular array of data
Definition: vtkImageData.h:156
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:108
Store vtkAlgorithm input/output information.
interactive manipulation of the camera specialized for images
abstract base class for most VTK objects
Definition: vtkObject.h:162
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:172
@ 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)