Quantcast

PyQt with vtkRectilinearWipeWidget

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

PyQt with vtkRectilinearWipeWidget

Bill Q
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

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Loading...