[vtkusers] General problems using VTK widgets in PyQt

Willi Huber surfersparadise85-vtk at yahoo.com
Tue Jan 22 10:52:37 EST 2013


Still no one interested in this topic?

I also tried it with the Enthought Suite. No chance. The same error. I compiled VTK myself. No chance. Do I have to compile VTK in a special way? 

I have debugged into the error and it always occurs when vtkCallbackCommand::Execute is called (this is the callback registered by the widget):

 ntdll.dll!77b9013d() 
 [Unten angegebene Rahmen sind möglicherweise nicht korrekt und/oder fehlen, keine Symbole geladen für ntdll.dll]
 ntdll.dll!77b9013d() 
 KernelBase.dll!763015e9() 
 ntdll.dll!77be74df() 
 ntdll.dll!77be73bc() 
 ntdll.dll!77be7261() 
 ntdll.dll!77bcb459() 
 ntdll.dll!77bcb42b() 
 ntdll.dll!77bcb3ce() 
 ntdll.dll!77b80133() 
>vtkCommon.dll!vtkCallbackCommand::Execute(vtkObject * caller=0x04262ed0, unsigned long event=26, void * callData=0x00000000)  Zeile 42 + 0x15 BytesC++
 vtkCommon.dll!vtkSubjectHelper::InvokeEvent(unsigned long event=26, void * callData=0x00000000, vtkObject * self=0x04262ed0)  Zeile 605C++
 vtkCommon.dll!vtkObject::InvokeEvent(unsigned long event=37718944, void * callData=0x01d51030)  Zeile 773C++

This is the code:

self.widget = QVTKRenderWindowInteractor( self )

######VTK#####
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()

# Start by loading some data.
v16 = tvtk.Volume16Reader()
v16.data_dimensions = ( 64, 64 )
v16.data_byte_order = 'little_endian'
v16.file_prefix = VTK_DATA_ROOT + "/Data/headsq/quarter"
v16.image_range = ( 1, 93 )
v16.data_spacing = ( 3.2, 3.2, 1.5 )
v16.update()

xMin, xMax, yMin, yMax, zMin, zMax = v16.output.whole_extent

spacing = v16.output.spacing
sx, sy, sz = spacing

origin = v16.output.origin
ox, oy, oz = origin

# An outline is shown for context.
outline = tvtk.OutlineFilter()
outline.input_connection = v16.output_port

outlineMapper = tvtk.PolyDataMapper()
outlineMapper.input_connection = outline.output_port

outlineActor = tvtk.Actor()
outlineActor.mapper = outlineMapper

# The shared picker enables us to use 3 planes at one time
# and gets the picking order right
picker = tvtk.CellPicker()
picker.tolerance = 0.005

# The 3 image plane widgets are used to probe the dataset.
planeWidgetX = tvtk.ImagePlaneWidget()
planeWidgetX.display_text = 'on'
planeWidgetX.input = v16.output
planeWidgetX.plane_orientation = 'x'
planeWidgetX.slice_index = 32
planeWidgetX.set_picker( picker )
# planeWidgetX.SetKeyPressActivationValue( "x" )
prop1 = planeWidgetX.plane_property
prop1.color = ( 1, 0, 0 )


# Create the RenderWindow and Renderer
ren = tvtk.Renderer()
self.widget.GetRenderWindow().AddRenderer( tvtk.to_vtk( ren ) )

# Add the outline actor to the renderer, set the background color and size
ren.add_actor( outlineActor )
self.widget.GetRenderWindow().SetSize( 600, 600 )
ren.background = ( 0.1, 0.1, 0.2 )

interactor = self.widget.GetRenderWindow().GetInteractor()

planeWidgetX.interactor = tvtk.to_tvtk( interactor )
planeWidgetX.on()

Try mouse over the window and it suddenly crashes.
So if one might be gentle an advice would be helpful. Maybe its a simple problme but I can't see it.


Thanks in advance,
Willi

>________________________________
> Von: Willi Huber <surfersparadise85-vtk at yahoo.com>
>An: "vtkusers at vtk.org" <vtkusers at vtk.org> 
>Gesendet: 20:39 Montag, 21.Januar 2013
>Betreff: [vtkusers] General problems using VTK widgets in PyQt
> 
>
>Hello all,
>
>
>I 've come across a problem that occurs with all so far tested VTK widgets in combination with Python and PyQt.
>I was trying to embedd a lot of widgets (vtkResliceImageViewer, vtkImageViewer, vtkImagePlaneWidget, ...) into my application without success. Every time I have the problem that if an event (like MouseMove oder LeftButtonDown) is handled by one of these widgets the whole app crashes without any information why.
>I know so far that it is definitely in combination with events that are handled by the widgets. Whenever I delete the observer for such an event the previously problematic action doesn't crash the app anymore.
>
>
>I am curious why this is only happening with PyQt and not with Tk as this are the samples I tried. Next I want to debug into this problem using either Visual Studio or gdb. Has anyone had such problems using widgets in these combinations? Is it only a problem with pythonxy as this is what I was using all the time.
>
>
>Would be nice if someone could assist me with this problem since this could be a major one.
>
>
>Cheers,
>Willi
>_______________________________________________
>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
>
>Follow this link to subscribe/unsubscribe:
>http://www.vtk.org/mailman/listinfo/vtkusers
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130122/5d1be25b/attachment.htm>


More information about the vtkusers mailing list