<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div></div><div><br><div><div>On Jan 24, 2013, at 3:45 PM, Eric E. Monson <<a href="mailto:emonson@cs.duke.edu">emonson@cs.duke.edu</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html charset=windows-1252"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hey Willi,<div><br></div><div>I don't have the time or knowledge to address the problem, but I played around for a while with it and I can verify that I can't get it to work, either. The only similar thing I've run into in the past is that it was sometimes tricky to get the vtkContextView() stuff (like the VTK Charts) working in Python with PyQt4 with the QVTKWidget() or QVTKRenderWindowInteractor() – very picky with respect to setting interactor and render windows… So, there's some small chance there's just some magic order in which things need to be set. The only tip I have is to try translating the C++ Qt ImagePlaneWidget example over to Python and see if you have more luck starting with that code:</div><div><br></div><div><a href="http://vtk.org/gitweb?">http://vtk.org/gitweb?</a>p=VTK.git;a=blob;f=Examples/GUI/Qt/FourPaneViewer/QtVTKRenderWindows.cxx</div><div><br></div><div>It is a little surprising, though, that nobody would have this widget working with Python and PyQt4, so hopefully someone else will chime in with a working example.</div><div><br></div><div>Good luck,</div><div>-Eric</div><div><br><div apple-content-edited="true">
<span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; border-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·</div><div>Eric E Monson</div><div>Duke Visualization Technology Group</div><div><br></div></div></span></span>
</div>
<br><div><div>On Jan 22, 2013, at 10:52 AM, Willi Huber <<a href="mailto:surfersparadise85-vtk@yahoo.com">surfersparadise85-vtk@yahoo.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div><div style="background-color: rgb(255, 255, 255); font-family: tahoma, 'new york', times, serif; font-size: 10pt; "><div style="font-family: tahoma, 'new york', times, serif; font-size: 10pt;"><span>Still no one interested in this topic?</span></div><div style="font-family: tahoma, 'new york', times, serif; font-size: 13px; background-color: transparent; font-style: normal; "><span><br></span></div><div style="font-family: tahoma, 'new york', times, serif; font-size: 13px; background-color: transparent; font-style: normal; "><span>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? </span></div><div style="font-family: tahoma, 'new york', times, serif; font-size: 13px; background-color: transparent; font-style: normal; "><span><br></span></div><div style="font-family: tahoma, 'new york', times, serif; font-size: 13px; background-color: transparent; font-style: normal; "><span>I have debugged into the error and it always occurs when vtkCallbackCommand::Execute is called (this is the callback registered by the widget):</span></div><div style="font-family: tahoma, 'new york', times, serif; font-size: 13px; background-color: transparent; font-style: normal; "><span><br></span></div><div style="background-color: transparent; font-size: 13px; font-family: tahoma, 'new york', times, serif; font-style: normal; "><span><div style="font-family: tahoma, 'new york', times, serif; font-size: 13px; font-style: normal; background-color: transparent; "><font size="2"> <span class="Apple-tab-span" style="white-space: pre;">        </span>ntdll.dll!77b9013d() <span class="Apple-tab-span" style="white-space: pre;">        </span></font></div><div style="font-family: tahoma, 'new york', times, serif; font-size: 13px; font-style: normal; background-color: transparent; "><font size="2"> <span class="Apple-tab-span" style="white-space:pre">        </span>[Unten angegebene Rahmen sind möglicherweise nicht korrekt und/oder fehlen, keine Symbole geladen für ntdll.dll]<span class="Apple-tab-span" style="white-space:pre">        </span></font></div><div style="font-family: tahoma, 'new york', times, serif; font-size: 13px; font-style: normal; background-color: transparent; "><font size="2"> <span class="Apple-tab-span" style="white-space:pre">        </span>ntdll.dll!77b9013d() <span class="Apple-tab-span" style="white-space:pre">        </span></font></div><div style="font-family: tahoma, 'new york', times, serif; font-size: 13px; font-style: normal; background-color: transparent; "><font size="2"> <span class="Apple-tab-span" style="white-space:pre">        </span>KernelBase.dll!763015e9() <span class="Apple-tab-span" style="white-space:pre">        </span></font></div><div style="font-family: tahoma, 'new york', times, serif; font-size: 13px; font-style: normal; background-color: transparent; "><font size="2"> <span class="Apple-tab-span" style="white-space:pre">        </span>ntdll.dll!77be74df() <span class="Apple-tab-span" style="white-space:pre">        </span></font></div><div style="font-family: tahoma, 'new york', times, serif; font-size: 13px; font-style: normal; background-color: transparent; "><font size="2"> <span class="Apple-tab-span" style="white-space:pre">        </span>ntdll.dll!77be73bc() <span class="Apple-tab-span" style="white-space:pre">        </span></font></div><div style="font-family: tahoma, 'new york', times, serif; font-size: 13px; font-style: normal; background-color: transparent; "><font size="2"> <span class="Apple-tab-span" style="white-space:pre">
        </span>ntdll.dll!77be7261() <span class="Apple-tab-span" style="white-space:pre">        </span></font></div><div style="font-family: tahoma, 'new york', times, serif; font-size: 13px; font-style: normal; background-color: transparent; "><font size="2"> <span class="Apple-tab-span" style="white-space:pre">        </span>ntdll.dll!77bcb459() <span class="Apple-tab-span" style="white-space:pre">        </span></font></div><div style="font-family: tahoma, 'new york', times, serif; font-size: 13px; font-style: normal; background-color: transparent; "><font size="2"> <span class="Apple-tab-span" style="white-space:pre">        </span>ntdll.dll!77bcb42b() <span class="Apple-tab-span" style="white-space:pre">        </span></font></div><div style="font-family: tahoma, 'new york', times, serif; font-size: 13px; font-style: normal; background-color: transparent; "><font size="2"> <span class="Apple-tab-span" style="white-space:pre">        </span>ntdll.dll!77bcb3ce() <span class="Apple-tab-span" style="white-space:pre">        </span></font></div><div style="font-family: tahoma, 'new york', times, serif; font-size: 13px; font-style: normal; background-color: transparent; "><font size="2"> <span class="Apple-tab-span" style="white-space:pre">        </span>ntdll.dll!77b80133() <span class="Apple-tab-span" style="white-space:pre">        </span></font></div><div style="font-family: tahoma, 'new york', times, serif; font-size: 13px; font-style: normal; background-color: transparent; "><font size="2">><span class="Apple-tab-span" style="white-space:pre">        </span>vtkCommon.dll!vtkCallbackCommand::Execute(vtkObject * caller=0x04262ed0, unsigned long event=26, void * callData=0x00000000) Zeile 42 + 0x15 Bytes<span class="Apple-tab-span" style="white-space:pre">        </span>C++</font></div><div style="font-family: tahoma, 'new york', times, serif; font-size: 13px; font-style: normal; background-color: transparent; "><font size="2"> <span class="Apple-tab-span" style="white-space:pre">        </span>vtkCommon.dll!vtkSubjectHelper::InvokeEvent(unsigned long event=26, void * callData=0x00000000, vtkObject * self=0x04262ed0) Zeile 605<span class="Apple-tab-span" style="white-space:pre">        </span>C++</font></div><div style="font-family: tahoma, 'new york', times, serif; font-size: 13px; font-style: normal; background-color: transparent; "><font size="2"> <span class="Apple-tab-span" style="white-space:pre">        </span>vtkCommon.dll!vtkObject::InvokeEvent(unsigned long event=37718944, void * callData=0x01d51030) Zeile 773<span class="Apple-tab-span" style="white-space:pre">        </span>C++</font></div><div style="font-family: tahoma, 'new york', times, serif; font-size: 13px; font-style: normal; "><br></div><div style="font-family: tahoma, 'new york', times, serif; font-size: 13px; font-style: normal; ">This is the code:</div><div style="font-family: tahoma, 'new york', times, serif; font-size: 13px; font-style: normal; "><br></div><div><div><font size="2"><span class="Apple-tab-span" style="white-space: pre;">        </span>self.widget = QVTKRenderWindowInteractor( self )</font></div><div><font size="2"><br></font></div><div><font size="2"><span class="Apple-tab-span" style="white-space:pre">        </span>######VTK#####</font></div><div><font size="2"><span class="Apple-tab-span" style="white-space:pre">        </span>from vtk.util.misc import vtkGetDataRoot</font></div><div><font size="2"><span class="Apple-tab-span" style="white-space:pre">        </span>VTK_DATA_ROOT = vtkGetDataRoot()</font></div><div><font size="2"><br></font></div><div><font size="2"><span class="Apple-tab-span" style="white-space:pre">        </span># Start by loading some data.</font></div><div><font size="2"><span class="Apple-tab-span" style="white-space:pre">        </span>v16 = tvtk.Volume16Reader()</font></div><div><font size="2"><span class="Apple-tab-span" style="white-space:pre">        </span>v16.data_dimensions = ( 64, 64 )</font></div><div><font size="2"><span class="Apple-tab-span" style="white-space:pre">        </span>v16.data_byte_order = 'little_endian'</font></div><div><font size="2"><span class="Apple-tab-span" style="white-space:pre">        </span>v16.file_prefix = VTK_DATA_ROOT + "/Data/headsq/quarter"</font></div><div><font size="2"><span class="Apple-tab-span" style="white-space:pre">        </span>v16.image_range = ( 1, 93 )</font></div><div><font size="2"><span class="Apple-tab-span" style="white-space:pre">        </span>v16.data_spacing = ( 3.2, 3.2, 1.5 )</font></div><div><font size="2"><span class="Apple-tab-span" style="white-space:pre">        </span>v16.update()</font></div><div><font size="2"><br></font></div><div><font size="2"><span class="Apple-tab-span" style="white-space:pre">        </span>xMin, xMax, yMin, yMax, zMin, zMax = v16.output.whole_extent</font></div><div><font size="2"><br></font></div><div><font size="2"><span class="Apple-tab-span" style="white-space:pre">        </span>spacing = v16.output.spacing</font></div><div><font size="2"><span class="Apple-tab-span" style="white-space:pre">        </span>sx, sy, sz = spacing</font></div><div><font size="2"><br></font></div><div><font size="2"><span class="Apple-tab-span" style="white-space:pre">        </span>origin = v16.output.origin</font></div><div><font size="2"><span class="Apple-tab-span" style="white-space:pre">        </span>ox, oy, oz = origin</font></div><div><font size="2"><br></font></div><div><font size="2"><span class="Apple-tab-span" style="white-space:pre">        </span># An outline is shown for context.</font></div><div><font size="2"><span class="Apple-tab-span" style="white-space:pre">        </span>outline = tvtk.OutlineFilter()</font></div><div><font size="2"><span class="Apple-tab-span" style="white-space:pre">        </span>outline.input_connection = v16.output_port</font></div><div><font size="2"><br></font></div><div><font size="2"><span class="Apple-tab-span" style="white-space:pre">        </span>outlineMapper = tvtk.PolyDataMapper()</font></div><div><font size="2"><span class="Apple-tab-span" style="white-space:pre">        </span>outlineMapper.input_connection = outline.output_port</font></div><div><font size="2"><br></font></div><div><font size="2"><span class="Apple-tab-span" style="white-space:pre">        </span>outlineActor = tvtk.Actor()</font></div><div><font size="2"><span class="Apple-tab-span" style="white-space:pre">        </span>outlineActor.mapper = outlineMapper</font></div><div><font size="2"><br></font></div><div><font size="2"><span class="Apple-tab-span" style="white-space:pre">        </span># The shared picker enables us to use 3 planes at one time</font></div><div><font size="2"><span class="Apple-tab-span" style="white-space:pre">        </span># and gets the picking order right</font></div><div><font size="2"><span class="Apple-tab-span" style="white-space:pre">        </span>picker = tvtk.CellPicker()</font></div><div><font size="2"><span class="Apple-tab-span" style="white-space:pre">        </span>picker.tolerance = 0.005</font></div><div><font size="2"><br></font></div><div><font size="2"><span class="Apple-tab-span" style="white-space:pre">        </span># The 3 image plane widgets are used to probe the dataset.</font></div><div><font size="2"><span class="Apple-tab-span" style="white-space:pre">        </span>planeWidgetX = tvtk.ImagePlaneWidget()</font></div><div><font size="2"><span class="Apple-tab-span" style="white-space:pre">        </span>planeWidgetX.display_text = 'on'</font></div><div><font size="2"><span class="Apple-tab-span" style="white-space:pre">        </span>planeWidgetX.input = v16.output</font></div><div><font size="2"><span class="Apple-tab-span" style="white-space:pre">
        </span>planeWidgetX.plane_orientation = 'x'</font></div><div><font size="2"><span class="Apple-tab-span" style="white-space:pre">        </span>planeWidgetX.slice_index = 32</font></div><div><font size="2"><span class="Apple-tab-span" style="white-space:pre">        </span>planeWidgetX.set_picker( picker )</font></div><div><font size="2"><span class="Apple-tab-span" style="white-space:pre">        </span># planeWidgetX.SetKeyPressActivationValue( "x" )</font></div><div><font size="2"><span class="Apple-tab-span" style="white-space:pre">        </span>prop1 = planeWidgetX.plane_property</font></div><div><font size="2"><span class="Apple-tab-span" style="white-space:pre">        </span>prop1.color = ( 1, 0, 0 )</font></div><div><font size="2"><br></font></div><div><font size="2"><br></font></div><div><font size="2"><span class="Apple-tab-span" style="white-space:pre">        </span># Create the RenderWindow and Renderer</font></div><div><font size="2"><span class="Apple-tab-span" style="white-space:pre">        </span>ren = tvtk.Renderer()</font></div><div><font size="2"><span class="Apple-tab-span" style="white-space:pre">        </span>self.widget.GetRenderWindow().AddRenderer( tvtk.to_vtk( ren ) )</font></div><div><font size="2"><br></font></div><div><font size="2"><span class="Apple-tab-span" style="white-space:pre">        </span># Add the outline actor to the renderer, set the background color and size</font></div><div><font size="2"><span class="Apple-tab-span" style="white-space:pre">        </span>ren.add_actor( outlineActor )</font></div><div><font size="2"><span class="Apple-tab-span" style="white-space:pre">        </span>self.widget.GetRenderWindow().SetSize( 600, 600 )</font></div><div><font size="2"><span class="Apple-tab-span" style="white-space:pre">        </span>ren.background = ( 0.1, 0.1, 0.2 )</font></div><div><font size="2"><br></font></div><div><font size="2"><span class="Apple-tab-span" style="white-space:pre">        </span>interactor =
self.widget.GetRenderWindow().GetInteractor()</font></div><div><font size="2"><br></font></div><div><font size="2"><span class="Apple-tab-span" style="white-space:pre">        </span>planeWidgetX.interactor = tvtk.to_tvtk( interactor )</font></div><div><font size="2"><span class="Apple-tab-span" style="white-space: pre;">        </span>planeWidgetX.on()</font></div><div><font size="2"><br></font></div><div><font size="2">Try mouse over the window and it suddenly crashes.</font></div></div></span></div><div style="font-family: tahoma, 'new york', times, serif; font-size: 10pt;"><span style="background-color: transparent;">So if one might be gentle an advice would be helpful. Maybe its a simple problme but I can't see it.</span><br></div><div style="font-family: tahoma, 'new york', times, serif; font-size: 13px; background-color: transparent; font-style: normal; "><span style="background-color: transparent;"><br></span></div><div style="font-family: tahoma, 'new york', times, serif; font-size: 13px; background-color: transparent; font-style: normal; "><span style="background-color: transparent;">Thanks in advance,</span></div><div style="font-family: tahoma, 'new york', times, serif; font-size: 13px; background-color: transparent; font-style: normal; "><span style="background-color: transparent;">Willi</span></div><div style="font-family: tahoma, 'new york', times, serif; font-size: 13px; background-color: transparent; font-style: normal; "><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; margin-top: 5px; padding-left: 5px;"> <div style="font-family: tahoma, 'new york', times, serif; font-size: 10pt;"> <div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"> <div dir="ltr"> <font size="2" face="Arial"> <hr size="1"> <b><span style="font-weight:bold;">Von:</span></b> Willi Huber
<<a href="mailto:surfersparadise85-vtk@yahoo.com">surfersparadise85-vtk@yahoo.com</a>><br> <b><span style="font-weight: bold;">An:</span></b> "<a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a>" <<a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a>> <br> <b><span style="font-weight: bold;">Gesendet:</span></b> 20:39 Montag, 21.Januar 2013<br> <b><span style="font-weight: bold;">Betreff:</span></b> [vtkusers] General problems using VTK widgets in PyQt<br> </font> </div> <br><div id="yiv918204575"><div style="background-color: rgb(255, 255, 255); font-family: tahoma, 'new york', times, serif; font-size: 10pt; "><div>Hello all,</div><div><br></div><div style="font-size: 13px; font-family: tahoma, 'new york', times, serif; background-color: transparent; font-style: normal; ">I 've come across a problem that occurs with all so far tested VTK widgets in combination with Python and PyQt.</div><div style="font-size: 13px; font-family: tahoma, 'new york', times, serif; background-color: transparent; font-style: normal; ">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.</div><div style="font-size: 13px; ">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.</div><div style="font-size: 13px; font-family: tahoma, 'new york', times, serif; background-color: transparent; font-style: normal; "><br></div><div style="font-size: 13px; font-family: tahoma, 'new york', times, serif; background-color: transparent; font-style: normal; ">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.</div><div style="font-size: 13px; font-family: tahoma, 'new york', times, serif; background-color: transparent; font-style: normal; "><br></div><div style="font-size: 13px; font-family: tahoma, 'new york', times, serif; background-color: transparent; font-style: normal; ">Would be nice if someone could assist me with this problem since this could be a major one.</div><div style="font-size: 13px; font-family: tahoma, 'new york', times, serif; background-color: transparent; font-style: normal; "><br></div><div style="font-size: 13px; font-family: tahoma, 'new york', times, serif; background-color: transparent; font-style: normal; ">Cheers,</div><div style="font-size: 13px; font-family: tahoma, 'new york', times, serif; background-color: transparent; font-style: normal; ">Willi</div></div></div><br>_______________________________________________<br>Powered by <a href="http://www.kitware.com/">www.kitware.com</a><br><br>Visit other Kitware
open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br><br>Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br><br>Follow this link to subscribe/unsubscribe:<br><a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br><br><br> </div> </div> </blockquote></div> </div></div>_______________________________________________<br>Powered by <a href="http://www.kitware.com/">www.kitware.com</a><br><br>Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br><br>Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a><br><br>Follow this link to subscribe/unsubscribe:<br><a href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a><br></blockquote></div><br></div></div>_______________________________________________<br>Powered by <a href="http://www.kitware.com">www.kitware.com</a><br><br>Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br><br>Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a><br><br>Follow this link to subscribe/unsubscribe:<br><a href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a><br></blockquote></div><br></div></body></html>