[vtkusers] vtkImagePlaneWidget: plane translation doesn't work

Miguel Sotaquira msotaquira at gmail.com
Mon Jun 18 01:23:45 EDT 2012


Hello everybody,

I'm using vtkImagePlaneWidget to visualize a set of orthonormal (sagittal,
coronal, axial) planes from a 3D grayscale volume. The documentation for
this class states that  selection of the widget with the middle mouse
button "enables translation of the plane along its normal". However I'm not
getting this behavior: clicking on the widget with the middle mouse button
doesn't do anything.

Heres a piece of my python code:

#Initialize the renderer
renderer = vtk.vtkRenderer()
renderWindow = vtk.vtkRenderWindow()
renderWindow.AddRenderer(renderer)
renderWindowInteractor = vtk.vtkRenderWindowInteractor()
renderWindow.SetInteractor(renderWindowInteractor)
interactorStyle = vtk.vtkInteractorStyleTrackballCamera()
renderWindowInteractor.SetInteractorStyle(interactorStyle)

#Initialize image plane widgets
picker = vtk.vtkCellPicker()
picker.SetTolerance(0.005)

planeWidgetX = vtk.vtkImagePlaneWidget()
planeWidgetX.SetResliceInterpolateToLinear()
planeWidgetX.SetTextureInterpolate(1)
planeWidgetX.SetUseContinuousCursor(0)
planeWidgetX.SetInput(image)
planeWidgetX.SetPlaneOrientationToXAxes()
planeWidgetX.SetSliceIndex(wholeExtent[1]/2)
planeWidgetX.DisplayTextOn()
planeWidgetX.SetPicker(picker)
planeWidgetX.KeyPressActivationOff()
planeWidgetX.SetInteractor(renderWindowInteractor)
planeWidgetX.SetMarginSizeX(0.0)
planeWidgetX.SetMarginSizeY(0.0)
planeWidgetX.On()

... and similar for planeWidgetY and planeWidgetZ

# Render
renderWindowInteractor.Initialize()
renderWindow.Render()
renderWindowInteractor.Start()

Is there something with my code? What am I missing?

Thanks for your suggestions,
Miguel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120618/b8a11d4f/attachment.htm>


More information about the vtkusers mailing list