#include <vtkImageViewer2.h>
vtkImageViewer2 is a convenience class for displaying a 2D image. It packages up the functionality found in vtkRenderWindow, vtkRenderer, vtkImageActor and vtkImageMapToWindowLevelColors into a single easy to use class. This class also creates an image interactor style (vtkInteractorStyleImage) that allows zooming and panning of images, and supports interactive window/level operations on the image. Note that vtkImageViewer2 is simply a wrapper around these classes.
vtkImageViewer2 uses the 3D rendering and texture mapping engine to draw an image on a plane. This allows for rapid rendering, zooming, and panning. The image is placed in the 3D scene at a depth based on the z-coordinate of the particular image slice. Each call to SetSlice() changes the image data (slice) displayed AND changes the depth of the displayed slice in the 3D scene. This can be controlled by the AutoAdjustCameraClippingRange ivar of the InteractorStyle member.
It is possible to mix images and geometry, using the methods:
viewer->SetInput( myImage ); viewer->GetRenderer()->AddActor( myActor );
This can be used to annotate an image with a PolyData of "edges" or or highlight sections of an image or display a 3D isosurface with a slice from the volume, etc. Any portions of your geometry that are in front of the displayed slice will be visible; any portions of your geometry that are behind the displayed slice will be obscured. A more general framework (with respect to viewing direction) for achieving this effect is provided by the vtkImagePlaneWidget .
Note that pressing 'r' will reset the window/level and pressing shift+'r' or control+'r' will reset the camera.
Definition at line 73 of file vtkImageViewer2.h.
enum | { SLICE_ORIENTATION_YZ = 0, SLICE_ORIENTATION_XZ = 1, SLICE_ORIENTATION_XY = 2 } |
virtual int | GetSliceOrientation () |
virtual void | SetSliceOrientation (int orientation) |
virtual void | SetSliceOrientationToXY () |
virtual void | SetSliceOrientationToYZ () |
virtual void | SetSliceOrientationToXZ () |
Public Types | |
typedef vtkObject | Superclass |
Public Member Functions | |
virtual const char * | GetClassName () |
virtual int | IsA (const char *type) |
void | PrintSelf (ostream &os, vtkIndent indent) |
virtual const char * | GetWindowName () |
virtual void | Render (void) |
virtual void | UpdateDisplayExtent () |
virtual void | SetupInteractor (vtkRenderWindowInteractor *) |
int | GetWholeZMin () |
int | GetWholeZMax () |
int | GetZSlice () |
void | SetZSlice (int) |
virtual void | SetInput (vtkImageData *in) |
virtual vtkImageData * | GetInput () |
virtual void | SetInputConnection (vtkAlgorithmOutput *input) |
virtual int | GetSlice () |
virtual void | SetSlice (int s) |
virtual int | GetSliceMin () |
virtual int | GetSliceMax () |
virtual void | GetSliceRange (int range[2]) |
virtual void | GetSliceRange (int &min, int &max) |
virtual int * | GetSliceRange () |
virtual double | GetColorWindow () |
virtual double | GetColorLevel () |
virtual void | SetColorWindow (double s) |
virtual void | SetColorLevel (double s) |
virtual void | SetDisplayId (void *a) |
virtual void | SetWindowId (void *a) |
virtual void | SetParentId (void *a) |
virtual int * | GetPosition () |
virtual void | SetPosition (int a, int b) |
virtual void | SetPosition (int a[2]) |
virtual int * | GetSize () |
virtual void | SetSize (int a, int b) |
virtual void | SetSize (int a[2]) |
virtual vtkRenderWindow * | GetRenderWindow () |
virtual vtkRenderer * | GetRenderer () |
virtual vtkImageActor * | GetImageActor () |
virtual vtkImageMapToWindowLevelColors * | GetWindowLevel () |
virtual vtkInteractorStyleImage * | GetInteractorStyle () |
virtual void | SetRenderWindow (vtkRenderWindow *arg) |
virtual void | SetRenderer (vtkRenderer *arg) |
virtual void | SetOffScreenRendering (int) |
virtual int | GetOffScreenRendering () |
virtual void | OffScreenRenderingOn () |
virtual void | OffScreenRenderingOff () |
Static Public Member Functions | |
static vtkImageViewer2 * | New () |
static int | IsTypeOf (const char *type) |
static vtkImageViewer2 * | SafeDownCast (vtkObject *o) |
Protected Member Functions | |
vtkImageViewer2 () | |
~vtkImageViewer2 () | |
virtual void | InstallPipeline () |
virtual void | UnInstallPipeline () |
virtual void | UpdateOrientation () |
Protected Attributes | |
vtkImageMapToWindowLevelColors * | WindowLevel |
vtkRenderWindow * | RenderWindow |
vtkRenderer * | Renderer |
vtkImageActor * | ImageActor |
vtkRenderWindowInteractor * | Interactor |
vtkInteractorStyleImage * | InteractorStyle |
int | SliceOrientation |
int | FirstRender |
int | Slice |
typedef vtkObject vtkImageViewer2::Superclass |
anonymous enum |
Set/get the slice orientation BTX
Definition at line 95 of file vtkImageViewer2.h.
vtkImageViewer2::vtkImageViewer2 | ( | ) | [protected] |
vtkImageViewer2::~vtkImageViewer2 | ( | ) | [protected] |
static vtkImageViewer2* vtkImageViewer2::New | ( | ) | [static] |
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
Reimplemented from vtkObject.
virtual const char* vtkImageViewer2::GetClassName | ( | ) | [virtual] |
Reimplemented from vtkObject.
static int vtkImageViewer2::IsTypeOf | ( | const char * | name | ) | [static] |
Return 1 if this class type is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.
Reimplemented from vtkObject.
virtual int vtkImageViewer2::IsA | ( | const char * | name | ) | [virtual] |
Return 1 if this class is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.
Reimplemented from vtkObject.
static vtkImageViewer2* vtkImageViewer2::SafeDownCast | ( | vtkObject * | o | ) | [static] |
Reimplemented from vtkObject.
void vtkImageViewer2::PrintSelf | ( | ostream & | os, | |
vtkIndent | indent | |||
) | [virtual] |
virtual const char* vtkImageViewer2::GetWindowName | ( | ) | [virtual] |
Get the name of rendering window.
virtual void vtkImageViewer2::Render | ( | void | ) | [virtual] |
Render the resulting image.
virtual void vtkImageViewer2::SetInput | ( | vtkImageData * | in | ) | [virtual] |
Set/Get the input image to the viewer.
virtual vtkImageData* vtkImageViewer2::GetInput | ( | ) | [virtual] |
Set/Get the input image to the viewer.
virtual void vtkImageViewer2::SetInputConnection | ( | vtkAlgorithmOutput * | input | ) | [virtual] |
Set/Get the input image to the viewer.
virtual int vtkImageViewer2::GetSliceOrientation | ( | ) | [virtual] |
Set/get the slice orientation BTX
virtual void vtkImageViewer2::SetSliceOrientation | ( | int | orientation | ) | [virtual] |
Set/get the slice orientation BTX
virtual void vtkImageViewer2::SetSliceOrientationToXY | ( | ) | [inline, virtual] |
Set/get the slice orientation BTX
Definition at line 104 of file vtkImageViewer2.h.
virtual void vtkImageViewer2::SetSliceOrientationToYZ | ( | ) | [inline, virtual] |
Set/get the slice orientation BTX
Definition at line 106 of file vtkImageViewer2.h.
virtual void vtkImageViewer2::SetSliceOrientationToXZ | ( | ) | [inline, virtual] |
Set/get the slice orientation BTX
Definition at line 108 of file vtkImageViewer2.h.
virtual int vtkImageViewer2::GetSlice | ( | ) | [virtual] |
Set/Get the current slice to display (depending on the orientation this can be in X, Y or Z).
virtual void vtkImageViewer2::SetSlice | ( | int | s | ) | [virtual] |
Set/Get the current slice to display (depending on the orientation this can be in X, Y or Z).
virtual void vtkImageViewer2::UpdateDisplayExtent | ( | ) | [virtual] |
Update the display extent manually so that the proper slice for the given orientation is displayed. It will also try to set a reasonable camera clipping range. This method is called automatically when the Input is changed, but most of the time the input of this class is likely to remain the same, i.e. connected to the output of a filter, or an image reader. When the input of this filter or reader itself is changed, an error message might be displayed since the current display extent is probably outside the new whole extent. Calling this method will ensure that the display extent is reset properly.
virtual int vtkImageViewer2::GetSliceMin | ( | ) | [virtual] |
Return the minimum and maximum slice values (depending on the orientation this can be in X, Y or Z).
virtual int vtkImageViewer2::GetSliceMax | ( | ) | [virtual] |
Return the minimum and maximum slice values (depending on the orientation this can be in X, Y or Z).
virtual void vtkImageViewer2::GetSliceRange | ( | int | range[2] | ) | [inline, virtual] |
Return the minimum and maximum slice values (depending on the orientation this can be in X, Y or Z).
Definition at line 135 of file vtkImageViewer2.h.
virtual void vtkImageViewer2::GetSliceRange | ( | int & | min, | |
int & | max | |||
) | [virtual] |
Return the minimum and maximum slice values (depending on the orientation this can be in X, Y or Z).
virtual int* vtkImageViewer2::GetSliceRange | ( | ) | [virtual] |
Return the minimum and maximum slice values (depending on the orientation this can be in X, Y or Z).
virtual double vtkImageViewer2::GetColorWindow | ( | ) | [virtual] |
Set window and level for mapping pixels to colors.
virtual double vtkImageViewer2::GetColorLevel | ( | ) | [virtual] |
Set window and level for mapping pixels to colors.
virtual void vtkImageViewer2::SetColorWindow | ( | double | s | ) | [virtual] |
Set window and level for mapping pixels to colors.
virtual void vtkImageViewer2::SetColorLevel | ( | double | s | ) | [virtual] |
Set window and level for mapping pixels to colors.
virtual void vtkImageViewer2::SetDisplayId | ( | void * | a | ) | [virtual] |
These are here when using a Tk window.
virtual void vtkImageViewer2::SetWindowId | ( | void * | a | ) | [virtual] |
These are here when using a Tk window.
virtual void vtkImageViewer2::SetParentId | ( | void * | a | ) | [virtual] |
These are here when using a Tk window.
virtual int* vtkImageViewer2::GetPosition | ( | ) | [virtual] |
Set/Get the position in screen coordinates of the rendering window.
virtual void vtkImageViewer2::SetPosition | ( | int | a, | |
int | b | |||
) | [virtual] |
Set/Get the position in screen coordinates of the rendering window.
virtual void vtkImageViewer2::SetPosition | ( | int | a[2] | ) | [inline, virtual] |
Set/Get the position in screen coordinates of the rendering window.
Definition at line 160 of file vtkImageViewer2.h.
virtual int* vtkImageViewer2::GetSize | ( | ) | [virtual] |
Set/Get the size of the window in screen coordinates in pixels.
virtual void vtkImageViewer2::SetSize | ( | int | a, | |
int | b | |||
) | [virtual] |
Set/Get the size of the window in screen coordinates in pixels.
virtual void vtkImageViewer2::SetSize | ( | int | a[2] | ) | [inline, virtual] |
Set/Get the size of the window in screen coordinates in pixels.
Definition at line 167 of file vtkImageViewer2.h.
virtual vtkRenderWindow* vtkImageViewer2::GetRenderWindow | ( | ) | [virtual] |
Get the internal render window, renderer, image actor, and image map instances.
virtual vtkRenderer* vtkImageViewer2::GetRenderer | ( | ) | [virtual] |
Get the internal render window, renderer, image actor, and image map instances.
virtual vtkImageActor* vtkImageViewer2::GetImageActor | ( | ) | [virtual] |
Get the internal render window, renderer, image actor, and image map instances.
virtual vtkImageMapToWindowLevelColors* vtkImageViewer2::GetWindowLevel | ( | ) | [virtual] |
Get the internal render window, renderer, image actor, and image map instances.
virtual vtkInteractorStyleImage* vtkImageViewer2::GetInteractorStyle | ( | ) | [virtual] |
Get the internal render window, renderer, image actor, and image map instances.
virtual void vtkImageViewer2::SetRenderWindow | ( | vtkRenderWindow * | arg | ) | [virtual] |
Set your own renderwindow and renderer
virtual void vtkImageViewer2::SetRenderer | ( | vtkRenderer * | arg | ) | [virtual] |
Set your own renderwindow and renderer
virtual void vtkImageViewer2::SetupInteractor | ( | vtkRenderWindowInteractor * | ) | [virtual] |
Attach an interactor for the internal render window.
virtual void vtkImageViewer2::SetOffScreenRendering | ( | int | ) | [virtual] |
Create a window in memory instead of on the screen. This may not be supported for every type of window and on some windows you may need to invoke this prior to the first render.
virtual int vtkImageViewer2::GetOffScreenRendering | ( | ) | [virtual] |
Create a window in memory instead of on the screen. This may not be supported for every type of window and on some windows you may need to invoke this prior to the first render.
virtual void vtkImageViewer2::OffScreenRenderingOn | ( | ) | [virtual] |
Create a window in memory instead of on the screen. This may not be supported for every type of window and on some windows you may need to invoke this prior to the first render.
virtual void vtkImageViewer2::OffScreenRenderingOff | ( | ) | [virtual] |
Create a window in memory instead of on the screen. This may not be supported for every type of window and on some windows you may need to invoke this prior to the first render.
int vtkImageViewer2::GetWholeZMin | ( | ) |
int vtkImageViewer2::GetWholeZMax | ( | ) |
int vtkImageViewer2::GetZSlice | ( | ) |
void vtkImageViewer2::SetZSlice | ( | int | ) |
virtual void vtkImageViewer2::InstallPipeline | ( | ) | [protected, virtual] |
virtual void vtkImageViewer2::UnInstallPipeline | ( | ) | [protected, virtual] |
virtual void vtkImageViewer2::UpdateOrientation | ( | ) | [protected, virtual] |
Definition at line 217 of file vtkImageViewer2.h.
vtkRenderWindow* vtkImageViewer2::RenderWindow [protected] |
Definition at line 218 of file vtkImageViewer2.h.
vtkRenderer* vtkImageViewer2::Renderer [protected] |
Definition at line 219 of file vtkImageViewer2.h.
vtkImageActor* vtkImageViewer2::ImageActor [protected] |
Definition at line 220 of file vtkImageViewer2.h.
vtkRenderWindowInteractor* vtkImageViewer2::Interactor [protected] |
Definition at line 221 of file vtkImageViewer2.h.
vtkInteractorStyleImage* vtkImageViewer2::InteractorStyle [protected] |
Definition at line 222 of file vtkImageViewer2.h.
int vtkImageViewer2::SliceOrientation [protected] |
Definition at line 224 of file vtkImageViewer2.h.
int vtkImageViewer2::FirstRender [protected] |
Definition at line 225 of file vtkImageViewer2.h.
int vtkImageViewer2::Slice [protected] |
Definition at line 226 of file vtkImageViewer2.h.