FreeMat: vtkImagePlaneWidget

FreeMat

- Main Page
- Related Pages

vtkImagePlaneWidget

Section: Visualization Toolkit Widget Classes

# Usage

This 3D widget defines a plane that can be interactively placed in an image volume. A nice feature of the object is that the vtkImagePlaneWidget, like any 3D widget, will work with the current interactor style. That is, if vtkImagePlaneWidget does not handle an event, then all other registered observers (including the interactor style) have an opportunity to process the event. Otherwise, the vtkImagePlaneWidget will terminate the processing of the event that it handles.

The core functionality of the widget is provided by a vtkImageReslice object which passes its output onto a texture mapping pipeline for fast slicing through volumetric data. See the key methods: GenerateTexturePlane() and UpdatePlane() for implementation details.

To use this object, just invoke SetInteractor() with the argument of the method a vtkRenderWindowInteractor. You may also wish to invoke "PlaceWidget()" to initially position the widget. If the "i" key (for "interactor") is pressed, the vtkImagePlaneWidget will appear. (See superclass documentation for information about changing this behavior.)

Selecting the widget with the middle mouse button with and without holding the shift or control keys enables complex reslicing capablilites. To facilitate use, a set of 'margins' (left, right, top, bottom) are shown as a set of plane-axes aligned lines, the properties of which can be changed as a group. Without keyboard modifiers: selecting in the middle of the margins enables translation of the plane along its normal. Selecting one of the corners within the margins enables spinning around the plane's normal at its center. Selecting within a margin allows rotating about the center of the plane around an axis aligned with the margin (i.e., selecting left margin enables rotating around the plane's local y-prime axis). With control key modifier: margin selection enables edge translation (i.e., a constrained form of scaling). Selecting within the margins enables translation of the entire plane. With shift key modifier: uniform plane scaling is enabled. Moving the mouse up enlarges the plane while downward movement shrinks it.

Window-level is achieved by using the right mouse button. Window-level values can be reset by shift + 'r' or control + 'r' while regular reset camera is maintained with 'r' or 'R'. The left mouse button can be used to query the underlying image data with a snap-to cross-hair cursor. Currently, the nearest point in the input image data to the mouse cursor generates the cross-hairs. With oblique slicing, this behaviour may appear unsatisfactory. Text display of window-level and image coordinates/data values are provided by a text actor/mapper pair.

Events that occur outside of the widget (i.e., no part of the widget is picked) are propagated to any other registered obsevers (such as the interaction style). Turn off the widget by pressing the "i" key again (or invoke the Off() method). To support interactive manipulation of objects, this class invokes the events StartInteractionEvent, InteractionEvent, and EndInteractionEvent as well as StartWindowLevelEvent, WindowLevelEvent, EndWindowLevelEvent and ResetWindowLevelEvent.

The vtkImagePlaneWidget has several methods that can be used in conjunction with other VTK objects. The GetPolyData() method can be used to get the polygonal representation of the plane and can be used as input for other VTK objects. Typical usage of the widget is to make use of the StartInteractionEvent, InteractionEvent, and EndInteractionEvent events. The InteractionEvent is called on mouse motion; the other two events are called on button down and button up (either left or right button).

Some additional features of this class include the ability to control the properties of the widget. You can set the properties of: the selected and unselected representations of the plane's outline; the text actor via its vtkTextProperty; the cross-hair cursor. In addition there are methods to constrain the plane so that it is aligned along the x-y-z axes. Finally, one can specify the degree of interpolation (vtkImageReslice): nearest neighbour, linear, and cubic.

To create an instance of class vtkImagePlaneWidget, simply invoke its constructor as follows

      obj = vtkImagePlaneWidget

# Methods

The class vtkImagePlaneWidget has several methods that can be used. They are listed below. Note that the documentation is translated automatically from the VTK sources, and may not be completely intelligible. When in doubt, consult the VTK website. In the methods listed below, `obj` is an instance of the vtkImagePlaneWidget class.

- `string = obj.GetClassName ()`
- `int = obj.IsA (string name)`
- `vtkImagePlaneWidget = obj.NewInstance ()`
- `vtkImagePlaneWidget = obj.SafeDownCast (vtkObject o)`
- `obj.SetEnabled (int )` - Methods that satisfy the superclass' API.
- `obj.PlaceWidget (double bounds[6])` - Methods that satisfy the superclass' API.
- `obj.PlaceWidget ()` - Methods that satisfy the superclass' API.
- `obj.PlaceWidget (double xmin, double xmax, double ymin, double ymax, double zmin, double zmax)` - Set the vtkImageData* input for the vtkImageReslice.
- `obj.SetInput (vtkDataSet input)` - Set the vtkImageData* input for the vtkImageReslice.
- `obj.SetOrigin (double x, double y, double z)` - Set/Get the origin of the plane.
- `obj.SetOrigin (double xyz[3])` - Set/Get the origin of the plane.
- `double = obj.GetOrigin ()` - Set/Get the origin of the plane.
- `obj.GetOrigin (double xyz[3])` - Set/Get the origin of the plane.
- `obj.SetPoint1 (double x, double y, double z)` - Set/Get the position of the point defining the first axis of the plane.
- `obj.SetPoint1 (double xyz[3])` - Set/Get the position of the point defining the first axis of the plane.
- `double = obj.GetPoint1 ()` - Set/Get the position of the point defining the first axis of the plane.
- `obj.GetPoint1 (double xyz[3])` - Set/Get the position of the point defining the first axis of the plane.
- `obj.SetPoint2 (double x, double y, double z)` - Set/Get the position of the point defining the second axis of the plane.
- `obj.SetPoint2 (double xyz[3])` - Set/Get the position of the point defining the second axis of the plane.
- `double = obj.GetPoint2 ()` - Set/Get the position of the point defining the second axis of the plane.
- `obj.GetPoint2 (double xyz[3])` - Set/Get the position of the point defining the second axis of the plane.
- `double = obj.GetCenter ()` - Get the center of the plane.
- `obj.GetCenter (double xyz[3])` - Get the center of the plane.
- `double = obj.GetNormal ()` - Get the normal to the plane.
- `obj.GetNormal (double xyz[3])` - Get the normal to the plane.
- `obj.GetVector1 (double v1[3])` - Get the vector from the plane origin to point1.
- `obj.GetVector2 (double v2[3])` - Get the vector from the plane origin to point2.
- `int = obj.GetSliceIndex ()` - Get the slice position in terms of the data extent.
- `obj.SetSliceIndex (int index)` - Set the slice position in terms of the data extent.
- `double = obj.GetSlicePosition ()` - Get the position of the slice along its normal.
- `obj.SetSlicePosition (double position)` - Set the position of the slice along its normal.
- `obj.SetResliceInterpolate (int )` - Set the interpolation to use when texturing the plane.
- `int = obj.GetResliceInterpolate ()` - Set the interpolation to use when texturing the plane.
- `obj.SetResliceInterpolateToNearestNeighbour ()` - Set the interpolation to use when texturing the plane.
- `obj.SetResliceInterpolateToLinear ()` - Set the interpolation to use when texturing the plane.
- `obj.SetResliceInterpolateToCubic ()` - Convenience method to get the vtkImageReslice output.
- `vtkImageData = obj.GetResliceOutput ()` - Convenience method to get the vtkImageReslice output.
- `obj.SetRestrictPlaneToVolume (int )` - Make sure that the plane remains within the volume. Default is On.
- `int = obj.GetRestrictPlaneToVolume ()` - Make sure that the plane remains within the volume. Default is On.
- `obj.RestrictPlaneToVolumeOn ()` - Make sure that the plane remains within the volume. Default is On.
- `obj.RestrictPlaneToVolumeOff ()` - Make sure that the plane remains within the volume. Default is On.
- `obj.SetUserControlledLookupTable (int )` - Let the user control the lookup table. NOTE: apply this method BEFORE applying the SetLookupTable method. Default is Off.
- `int = obj.GetUserControlledLookupTable ()` - Let the user control the lookup table. NOTE: apply this method BEFORE applying the SetLookupTable method. Default is Off.
- `obj.UserControlledLookupTableOn ()` - Let the user control the lookup table. NOTE: apply this method BEFORE applying the SetLookupTable method. Default is Off.
- `obj.UserControlledLookupTableOff ()` - Let the user control the lookup table. NOTE: apply this method BEFORE applying the SetLookupTable method. Default is Off.
- `obj.SetTextureInterpolate (int )` - Specify whether to interpolate the texture or not. When off, the reslice interpolation is nearest neighbour regardless of how the interpolation is set through the API. Set before setting the vtkImageData input. Default is On.
- `int = obj.GetTextureInterpolate ()` - Specify whether to interpolate the texture or not. When off, the reslice interpolation is nearest neighbour regardless of how the interpolation is set through the API. Set before setting the vtkImageData input. Default is On.
- `obj.TextureInterpolateOn ()` - Specify whether to interpolate the texture or not. When off, the reslice interpolation is nearest neighbour regardless of how the interpolation is set through the API. Set before setting the vtkImageData input. Default is On.
- `obj.TextureInterpolateOff ()` - Specify whether to interpolate the texture or not. When off, the reslice interpolation is nearest neighbour regardless of how the interpolation is set through the API. Set before setting the vtkImageData input. Default is On.
- `obj.SetTextureVisibility (int )` - Control the visibility of the actual texture mapped reformatted plane. in some cases you may only want the plane outline for example.
- `int = obj.GetTextureVisibility ()` - Control the visibility of the actual texture mapped reformatted plane. in some cases you may only want the plane outline for example.
- `obj.TextureVisibilityOn ()` - Control the visibility of the actual texture mapped reformatted plane. in some cases you may only want the plane outline for example.
- `obj.TextureVisibilityOff ()` - Control the visibility of the actual texture mapped reformatted plane. in some cases you may only want the plane outline for example.
- `obj.GetPolyData (vtkPolyData pd)` - Grab the polydata (including points) that defines the plane. The polydata consists of (res+1)*(res+1) points, and res*res quadrilateral polygons, where res is the resolution of the plane. These point values are guaranteed to be up-to-date when either the InteractionEvent or EndInteraction events are invoked. The user provides the vtkPolyData and the points and polygons are added to it.
- `vtkPolyDataAlgorithm = obj.GetPolyDataAlgorithm ()` - Satisfies superclass API. This returns a pointer to the underlying vtkPolyData. Make changes to this before calling the initial PlaceWidget() to have the initial placement follow suit. Or, make changes after the widget has been initialised and call UpdatePlacement() to realise.
- `obj.UpdatePlacement (void )` - Satisfies superclass API. This will change the state of the widget to match changes that have been made to the underlying vtkPolyDataSource
- `vtkTexture = obj.GetTexture ()` - Convenience method to get the texture used by this widget. This can be used in external slice viewers.
- `vtkImageMapToColors = obj.GetColorMap ()` - Convenience method to get the vtkImageMapToColors filter used by this widget. The user can properly render other transparent actors in a scene by calling the filter's SetOutputFormatToRGB and PassAlphaToOutputOff.
- `obj.SetColorMap (vtkImageMapToColors )` - Convenience method to get the vtkImageMapToColors filter used by this widget. The user can properly render other transparent actors in a scene by calling the filter's SetOutputFormatToRGB and PassAlphaToOutputOff.
- `obj.SetPlaneProperty (vtkProperty )` - Set/Get the plane's outline properties. The properties of the plane's outline when selected and unselected can be manipulated.
- `vtkProperty = obj.GetPlaneProperty ()` - Set/Get the plane's outline properties. The properties of the plane's outline when selected and unselected can be manipulated.
- `obj.SetSelectedPlaneProperty (vtkProperty )` - Set/Get the plane's outline properties. The properties of the plane's outline when selected and unselected can be manipulated.
- `vtkProperty = obj.GetSelectedPlaneProperty ()` - Set/Get the plane's outline properties. The properties of the plane's outline when selected and unselected can be manipulated.
- `obj.SetPlaneOrientation (int )` - Convenience method sets the plane orientation normal to the x, y, or z axes. Default is XAxes (0).
- `int = obj.GetPlaneOrientation ()` - Convenience method sets the plane orientation normal to the x, y, or z axes. Default is XAxes (0).
- `obj.SetPlaneOrientationToXAxes ()` - Convenience method sets the plane orientation normal to the x, y, or z axes. Default is XAxes (0).
- `obj.SetPlaneOrientationToYAxes ()` - Convenience method sets the plane orientation normal to the x, y, or z axes. Default is XAxes (0).
- `obj.SetPlaneOrientationToZAxes ()` - Set the internal picker to one defined by the user. In this way, a set of three orthogonal planes can share the same picker so that picking is performed correctly. The default internal picker can be re-set/allocated by setting to 0 (NULL).
- `obj.SetPicker (vtkAbstractPropPicker )` - Set the internal picker to one defined by the user. In this way, a set of three orthogonal planes can share the same picker so that picking is performed correctly. The default internal picker can be re-set/allocated by setting to 0 (NULL).
- `obj.SetLookupTable (vtkLookupTable )` - Set/Get the internal lookuptable (lut) to one defined by the user, or, alternatively, to the lut of another vtkImgePlaneWidget. In this way, a set of three orthogonal planes can share the same lut so that window-levelling is performed uniformly among planes. The default internal lut can be re- set/allocated by setting to 0 (NULL).
- `vtkLookupTable = obj.GetLookupTable ()` - Set/Get the internal lookuptable (lut) to one defined by the user, or, alternatively, to the lut of another vtkImgePlaneWidget. In this way, a set of three orthogonal planes can share the same lut so that window-levelling is performed uniformly among planes. The default internal lut can be re- set/allocated by setting to 0 (NULL).
- `obj.SetDisplayText (int )` - Enable/disable text display of window-level, image coordinates and scalar values in a render window.
- `int = obj.GetDisplayText ()` - Enable/disable text display of window-level, image coordinates and scalar values in a render window.
- `obj.DisplayTextOn ()` - Enable/disable text display of window-level, image coordinates and scalar values in a render window.
- `obj.DisplayTextOff ()` - Enable/disable text display of window-level, image coordinates and scalar values in a render window.
- `obj.SetCursorProperty (vtkProperty )` - Set the properties of the cross-hair cursor.
- `vtkProperty = obj.GetCursorProperty ()` - Set the properties of the cross-hair cursor.
- `obj.SetMarginProperty (vtkProperty )` - Set the properties of the margins.
- `vtkProperty = obj.GetMarginProperty ()` - Set the properties of the margins.
- `obj.SetMarginSizeX (double )` - Set the size of the margins based on a percentage of the plane's width and height, limited between 0 and 50%.
- `double = obj.GetMarginSizeXMinValue ()` - Set the size of the margins based on a percentage of the plane's width and height, limited between 0 and 50%.
- `double = obj.GetMarginSizeXMaxValue ()` - Set the size of the margins based on a percentage of the plane's width and height, limited between 0 and 50%.
- `double = obj.GetMarginSizeX ()` - Set the size of the margins based on a percentage of the plane's width and height, limited between 0 and 50%.
- `obj.SetMarginSizeY (double )` - Set the size of the margins based on a percentage of the plane's width and height, limited between 0 and 50%.
- `double = obj.GetMarginSizeYMinValue ()` - Set the size of the margins based on a percentage of the plane's width and height, limited between 0 and 50%.
- `double = obj.GetMarginSizeYMaxValue ()` - Set the size of the margins based on a percentage of the plane's width and height, limited between 0 and 50%.
- `double = obj.GetMarginSizeY ()` - Set the size of the margins based on a percentage of the plane's width and height, limited between 0 and 50%.
- `obj.SetTextProperty (vtkTextProperty tprop)` - Set/Get the text property for the image data and window-level annotation.
- `vtkTextProperty = obj.GetTextProperty ()` - Set/Get the text property for the image data and window-level annotation.
- `obj.SetTexturePlaneProperty (vtkProperty )` - Set/Get the property for the resliced image.
- `vtkProperty = obj.GetTexturePlaneProperty ()` - Set/Get the property for the resliced image.
- `obj.SetWindowLevel (double window, double level, int copy)` - Set/Get the current window and level values. SetWindowLevel should only be called after SetInput. If a shared lookup table is being used, a callback is required to update the window level values without having to update the lookup table again.
- `obj.GetWindowLevel (double wl[2])` - Set/Get the current window and level values. SetWindowLevel should only be called after SetInput. If a shared lookup table is being used, a callback is required to update the window level values without having to update the lookup table again.
- `double = obj.GetWindow ()` - Set/Get the current window and level values. SetWindowLevel should only be called after SetInput. If a shared lookup table is being used, a callback is required to update the window level values without having to update the lookup table again.
- `double = obj.GetLevel ()` - Get the image coordinate position and voxel value. Currently only supports single component image data.
- `int = obj.GetCursorData (double xyzv[4])` - Get the image coordinate position and voxel value. Currently only supports single component image data.
- `int = obj.GetCursorDataStatus ()` - Get the status of the cursor data. If this returns 1 the CurrentCursorPosition and CurrentImageValue will have current data. If it returns 0, these values are invalid.
- `double = obj. GetCurrentCursorPosition ()` - Get the current cursor position. To be used in conjunction with GetCursorDataStatus.
- `double = obj.GetCurrentImageValue ()` - Get the current image value at the current cursor position. To be used in conjunction with GetCursorDataStatus. The value is VTK_DOUBLE_MAX when the data is invalid.
- `obj.SetUseContinuousCursor (int )` - Choose between voxel centered or continuous cursor probing. With voxel centered probing, the cursor snaps to the nearest voxel and the reported cursor coordinates are extent based. With continuous probing, voxel data is interpolated using vtkDataSetAttributes' InterpolatePoint method and the reported coordinates are 3D spatial continuous.
- `int = obj.GetUseContinuousCursor ()` - Choose between voxel centered or continuous cursor probing. With voxel centered probing, the cursor snaps to the nearest voxel and the reported cursor coordinates are extent based. With continuous probing, voxel data is interpolated using vtkDataSetAttributes' InterpolatePoint method and the reported coordinates are 3D spatial continuous.
- `obj.UseContinuousCursorOn ()` - Choose between voxel centered or continuous cursor probing. With voxel centered probing, the cursor snaps to the nearest voxel and the reported cursor coordinates are extent based. With continuous probing, voxel data is interpolated using vtkDataSetAttributes' InterpolatePoint method and the reported coordinates are 3D spatial continuous.
- `obj.UseContinuousCursorOff ()` - Choose between voxel centered or continuous cursor probing. With voxel centered probing, the cursor snaps to the nearest voxel and the reported cursor coordinates are extent based. With continuous probing, voxel data is interpolated using vtkDataSetAttributes' InterpolatePoint method and the reported coordinates are 3D spatial continuous.
- `obj.SetInteraction (int interact)` - Enable/disable mouse interaction so the widget remains on display.
- `int = obj.GetInteraction ()` - Enable/disable mouse interaction so the widget remains on display.
- `obj.InteractionOn ()` - Enable/disable mouse interaction so the widget remains on display.
- `obj.InteractionOff ()` - Enable/disable mouse interaction so the widget remains on display.
- `obj.SetLeftButtonAction (int )` - Set action associated to buttons.
- `int = obj.GetLeftButtonActionMinValue ()` - Set action associated to buttons.
- `int = obj.GetLeftButtonActionMaxValue ()` - Set action associated to buttons.
- `int = obj.GetLeftButtonAction ()` - Set action associated to buttons.
- `obj.SetMiddleButtonAction (int )` - Set action associated to buttons.
- `int = obj.GetMiddleButtonActionMinValue ()` - Set action associated to buttons.
- `int = obj.GetMiddleButtonActionMaxValue ()` - Set action associated to buttons.
- `int = obj.GetMiddleButtonAction ()` - Set action associated to buttons.
- `obj.SetRightButtonAction (int )` - Set action associated to buttons.
- `int = obj.GetRightButtonActionMinValue ()` - Set action associated to buttons.
- `int = obj.GetRightButtonActionMaxValue ()` - Set action associated to buttons.
- `int = obj.GetRightButtonAction ()` - Set action associated to buttons.
- `obj.SetLeftButtonAutoModifier (int )` - Set the auto-modifiers associated to buttons. This allows users to bind some buttons to actions that are usually triggered by a key modifier. For example, if you do not need cursoring, you can bind the left button action to VTK_SLICE_MOTION_ACTION (see above) and the left button auto modifier to VTK_CONTROL_MODIFIER: you end up with the left button controling panning without pressing a key.
- `int = obj.GetLeftButtonAutoModifierMinValue ()` - Set the auto-modifiers associated to buttons. This allows users to bind some buttons to actions that are usually triggered by a key modifier. For example, if you do not need cursoring, you can bind the left button action to VTK_SLICE_MOTION_ACTION (see above) and the left button auto modifier to VTK_CONTROL_MODIFIER: you end up with the left button controling panning without pressing a key.
- `int = obj.GetLeftButtonAutoModifierMaxValue ()` - Set the auto-modifiers associated to buttons. This allows users to bind some buttons to actions that are usually triggered by a key modifier. For example, if you do not need cursoring, you can bind the left button action to VTK_SLICE_MOTION_ACTION (see above) and the left button auto modifier to VTK_CONTROL_MODIFIER: you end up with the left button controling panning without pressing a key.
- `int = obj.GetLeftButtonAutoModifier ()` - Set the auto-modifiers associated to buttons. This allows users to bind some buttons to actions that are usually triggered by a key modifier. For example, if you do not need cursoring, you can bind the left button action to VTK_SLICE_MOTION_ACTION (see above) and the left button auto modifier to VTK_CONTROL_MODIFIER: you end up with the left button controling panning without pressing a key.
- `obj.SetMiddleButtonAutoModifier (int )` - Set the auto-modifiers associated to buttons. This allows users to bind some buttons to actions that are usually triggered by a key modifier. For example, if you do not need cursoring, you can bind the left button action to VTK_SLICE_MOTION_ACTION (see above) and the left button auto modifier to VTK_CONTROL_MODIFIER: you end up with the left button controling panning without pressing a key.
- `int = obj.GetMiddleButtonAutoModifierMinValue ()` - Set the auto-modifiers associated to buttons. This allows users to bind some buttons to actions that are usually triggered by a key modifier. For example, if you do not need cursoring, you can bind the left button action to VTK_SLICE_MOTION_ACTION (see above) and the left button auto modifier to VTK_CONTROL_MODIFIER: you end up with the left button controling panning without pressing a key.
- `int = obj.GetMiddleButtonAutoModifierMaxValue ()` - Set the auto-modifiers associated to buttons. This allows users to bind some buttons to actions that are usually triggered by a key modifier. For example, if you do not need cursoring, you can bind the left button action to VTK_SLICE_MOTION_ACTION (see above) and the left button auto modifier to VTK_CONTROL_MODIFIER: you end up with the left button controling panning without pressing a key.
- `int = obj.GetMiddleButtonAutoModifier ()` - Set the auto-modifiers associated to buttons. This allows users to bind some buttons to actions that are usually triggered by a key modifier. For example, if you do not need cursoring, you can bind the left button action to VTK_SLICE_MOTION_ACTION (see above) and the left button auto modifier to VTK_CONTROL_MODIFIER: you end up with the left button controling panning without pressing a key.
- `obj.SetRightButtonAutoModifier (int )` - Set the auto-modifiers associated to buttons. This allows users to bind some buttons to actions that are usually triggered by a key modifier. For example, if you do not need cursoring, you can bind the left button action to VTK_SLICE_MOTION_ACTION (see above) and the left button auto modifier to VTK_CONTROL_MODIFIER: you end up with the left button controling panning without pressing a key.
- `int = obj.GetRightButtonAutoModifierMinValue ()` - Set the auto-modifiers associated to buttons. This allows users to bind some buttons to actions that are usually triggered by a key modifier. For example, if you do not need cursoring, you can bind the left button action to VTK_SLICE_MOTION_ACTION (see above) and the left button auto modifier to VTK_CONTROL_MODIFIER: you end up with the left button controling panning without pressing a key.
- `int = obj.GetRightButtonAutoModifierMaxValue ()` - Set the auto-modifiers associated to buttons. This allows users to bind some buttons to actions that are usually triggered by a key modifier. For example, if you do not need cursoring, you can bind the left button action to VTK_SLICE_MOTION_ACTION (see above) and the left button auto modifier to VTK_CONTROL_MODIFIER: you end up with the left button controling panning without pressing a key.
- `int = obj.GetRightButtonAutoModifier ()` - Set the auto-modifiers associated to buttons. This allows users to bind some buttons to actions that are usually triggered by a key modifier. For example, if you do not need cursoring, you can bind the left button action to VTK_SLICE_MOTION_ACTION (see above) and the left button auto modifier to VTK_CONTROL_MODIFIER: you end up with the left button controling panning without pressing a key.