[vtkusers] PyQt with vtkRectilinearWipeWidget

Bill Q bill.q.hdp at gmail.com
Thu Mar 23 05:27:27 EDT 2017


Hi All,
I am trying to make vtkRectilinearWipeWidget to work with PyQt so the wipe
window can appear inside a Qt application. However, I am have a hard time
to do it. I found this example:
http://www.vtk.org/Wiki/VTK/Examples/Cxx/Qt/BorderWidget. And my code is as
following:

self.vtkWidget = QVTKRenderWindowInteractor()
wipe = vtk.vtkImageRectilinearWipe()
wipe.SetInputConnection(0, img_reader1.GetOutputPort())
wipe.SetInputConnection(1, img_reader2.GetOutputPort())

img_center = get_image_center(img_reader1)

wipe.SetPosition((int)(img_center[0]), (int)(img_center[1]))
wipe.SetWipeToQuad()

ren1 = vtk.vtkRenderer()

style = vtk.vtkInteractorStyleImage()

self.vtkWidget.SetInteractorStyle(style)
self.vtkWidget.GetRenderWindow().AddRenderer(ren1)

wipeActor = vtk.vtkImageActor()
wipeActor.GetMapper().SetInputConnection(wipe.GetOutputPort())

wipeWidget = vtk.vtkRectilinearWipeWidget()
wipeWidget.SetInteractor(self.vtkWidget)

wipeWidgetRep = wipeWidget.GetRepresentation()

wipeWidgetRep.SetImageActor(wipeActor)
wipeWidgetRep.SetRectilinearWipe(wipe)
wipeWidgetRep.GetProperty().SetLineWidth(1.0)
wipeWidgetRep.GetProperty().SetOpacity(0.75)

ren1.AddActor(wipeActor)
ren1.SetBackground(0.1, 0.2, 0.4)

self.vtkWidget.Initialize()
wipeWidget.On()
self.vtkWidget.Start()


But the result is incorrect.  Only image from img_reader1 showed up in the
Qt application and the the wipe line didn't show up either.

Can somebody offer any advices?


Many thanks.


Bill
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170323/5907e2cb/attachment.html>


More information about the vtkusers mailing list