<html><body><div style="color:#000; background-color:#fff; font-family:tahoma, new york, times, serif;font-size:10pt"><div style="font-family: tahoma, 'new york', times, serif; font-size: 10pt;">Dear Users of the VTK world,</div><div style="font-family: tahoma, 'new york', times, serif; font-size: 13px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;"><br></div><div style="font-family: tahoma, 'new york', times, serif; font-size: 13px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;">I have tried a lot now and my conclusion is that all the problems I am facing have to do<span style="background-color: transparent;"> with the combination of VTK and Qt. Whenever I let Qt go and I use a usual RenderWindow and do the setup as intended everything is just fine.</span></div><div style="font-family: tahoma, 'new york', times, serif; font-size: 13px; color: rgb(0, 0, 0); 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; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;">I now switched to using the QVTKWidget and tried to rebuild the Examples\GUI\Qt\FourPaneViewer Example of the vtk-source-tree in Python (because of the vtkResliceImageViewer) with just one widget now . All the settings are the same. Also the Observer or rather the Callback is there. Still the same error. I am desperately searching for an answer how to make it work. </div><div style="font-family: tahoma, 'new york', times, serif; font-size: 13px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;"><br></div><div style="font-family: tahoma, 'new york', times, serif; font-size: 13px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;"><br></div><div style="font-family: tahoma,
'new york', times, serif; font-size: 13px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;">My current code:</div><div style="font-family: tahoma, 'new york', times, serif; font-size: 13px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;"><br></div><div style="font-family: tahoma, 'new york', times, serif; font-size: 13px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;"><pre style="font-size: 10pt; font-family: 'Courier New';">==== python code ====</pre></div><div style="background-color: transparent;"><div style="background-color: transparent;"><font size="2"> reader = vtk.vtkMetaImageReader()</font></div><div style="background-color: transparent;"><font size="2"> reader.SetFileName( file )</font></div><div style="background-color: transparent;"><font size="2">
reader.Update()</font></div><div style="background-color: transparent;"><font size="2"><br></font></div><div style="background-color: transparent;"><font size="2"> widget = qvtk.QVTKWidget( self.widget )</font></div><div style="background-color: transparent;"><font size="2"><br></font></div><div style="background-color: transparent;"><font size="2"> layout = QtGui.QVBoxLayout()</font></div><div style="background-color: transparent;"><font size="2"> layout.addWidget( widget )</font></div><div style="background-color: transparent;"><font size="2"><br></font></div><div style="background-color: transparent;"><font size="2"> self.slider = QtGui.QSlider( Qt.Horizontal, self.widget )</font></div><div style="background-color: transparent;"><font size="2"> layout.addWidget( self.slider )</font></div><div style="background-color:
transparent;"><font size="2"><br></font></div><div style="background-color: transparent;"><font size="2"> self.widget.setLayout( layout )</font></div><div style="background-color: transparent;"><font size="2"><br></font></div><div style="background-color: transparent;"><font size="2"> viewer = vtk.vtkResliceImageViewer()</font></div><div style="background-color: transparent;"><font size="2"> widget.SetRenderWindow( viewer.GetRenderWindow() )</font></div><div style="background-color: transparent;"><font size="2"> viewer.SetupInteractor( widget.GetRenderWindow().GetInteractor() )</font></div><div style="background-color: transparent;"><font size="2"><br></font></div><div style="background-color: transparent;"><font size="2"> vtk.vtkResliceCursorLineRepresentation.SafeDownCast(
viewer.GetResliceCursorWidget().GetRepresentation() ).GetResliceCursorActor().GetCursorAlgorithm().SetReslicePlaneNormal( 2 )</font></div><div style="background-color: transparent;"><font size="2"> viewer.SetInputConnection( reader.GetOutputPort() )</font></div><div style="background-color: transparent;"><font size="2"> viewer.SetSlice( 50 )</font></div><div style="background-color: transparent;"><font size="2"> viewer.SetSliceOrientation( 2 )</font></div><div style="background-color: transparent;"><font size="2"> viewer.SetResliceModeToAxisAligned()</font></div><div style="background-color: transparent;"><font size="2"><br></font></div><div style="background-color: transparent;"><font size="2"> cbk = vtkResliceCursorCallback()</font></div><div style="background-color: transparent;"><font size="2"><br></font></div><div
style="background-color: transparent;"><font size="2"> viewer.GetResliceCursorWidget().AddObserver( 'vtkResliceCursorWidget::ResliceAxesChangedEvent', cbk )</font></div><div style="background-color: transparent;"><font size="2"> viewer.GetResliceCursorWidget().AddObserver( 'vtkResliceCursorWidget::WindowLevelEvent', cbk )</font></div><div style="background-color: transparent;"><font size="2"> viewer.GetResliceCursorWidget().AddObserver( 'vtkResliceCursorWidget::ResliceThicknessChangedEvent', cbk )</font></div><div style="background-color: transparent;"><font size="2"> viewer.GetResliceCursorWidget().AddObserver( 'vtkResliceCursorWidget::ResetCursorEvent', cbk )</font></div><div style="background-color: transparent;"><font size="2"> viewer.GetInteractorStyle().AddObserver( 'vtkCommand::WindowLevelEvent', cbk
)</font></div><div style="background-color: transparent;"><font size="2"><br></font></div><div style="background-color: transparent;"><font size="2"> widget.show()</font></div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 13px; font-family: tahoma, 'new york', times, serif; font-style: normal;"><font size="2"><br></font></div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 13px; font-family: tahoma, 'new york', times, serif; font-style: normal;"><font size="2"><pre style="font-size: 10pt; font-family: 'Courier New';">==== end code ====</pre></font></div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 13px; font-family: tahoma, 'new york', times, serif; font-style: normal;"><font size="2"><br></font></div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 13px; font-family: tahoma, 'new york', times, serif;
font-style: normal;"><font size="2">Where vtkResliceCursorCallback is this:</font></div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 13px; font-family: tahoma, 'new york', times, serif; font-style: normal;"><font size="2"><br></font></div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 13px; font-family: tahoma, 'new york', times, serif; font-style: normal;"><font size="2"><pre style="font-size: 10pt; font-family: 'Courier New';">==== python code ====</pre></font></div><div style="background-color: transparent;"><font size="2"><div style="background-color: transparent;">class vtkResliceCursorCallback:</div><div style="background-color: transparent;"> def __init__( self ):</div><div style="background-color: transparent;"> self.CallDataType = 'string0'</div><div style="background-color: transparent;"><br></div><div style="background-color:
transparent;"> # Execute method usually</div><div style="background-color: transparent;"> def __call__( self, obj, event, message ):</div><div style="background-color: transparent;"> print event</div><div style="background-color: transparent;"><br></div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 13px; font-family: tahoma, 'new york', times, serif; font-style: normal;"><span style="font-family: 'Courier New'; font-size: 10pt; background-color: transparent;">==== end code ====</span><br></div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 13px; font-family: tahoma, 'new york', times, serif; font-style: normal;"><span style="font-family: 'Courier New'; font-size: 10pt; background-color: transparent;"><br></span></div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 13px; font-family: 'Courier New'; font-style:
normal;"><span style="font-family: tahoma, 'new york', times, serif;">I used the ErrorObserver of David Gobbi as guide.</span><br></div></font></div></div><div style="font-family: tahoma, 'new york', times, serif; font-size: 13px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;"><br></div><div style="font-family: tahoma, 'new york', times, serif; font-size: 13px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;"><br></div><div style="font-family: tahoma, 'new york', times, serif; font-size: 13px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;">Please can anyone help me? Please Please.<br></div><div style="font-family: tahoma, 'new york', times, serif; font-size: 13px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;"><br></div><div style="font-family: tahoma, 'new york', times, serif; font-size: 13px; color: rgb(0, 0, 0); background-color: transparent;
font-style: normal;"><br></div><div style="font-family: tahoma, 'new york', times, serif; font-size: 13px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;"><br><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 <surfersparadise85-vtk@yahoo.com><br> <b><span style="font-weight: bold;">An:</span></b> surfersparadise85-vtk@yahoo.com; vtkusers@vtk.org <br> <b><span style="font-weight: bold;">Gesendet:</span></b> 12:07 Mittwoch, 16.Januar 2013<br> <b><span style="font-weight: bold;">Betreff:</span></b> AW: [vtkusers] Again python debugging<br> </font> </div>
<br><br>Anyone?<br><br><br><br>------------------------------<br>Willi Huber schrieb am Di., 15. Jan 2013 04:55 MEZ:<br><br>>Hello all,<br>><br>>I am trying to do some new stuff and I am again hitting the debugging barriers of vtk in python.<br>><br>>My code:<br>><br>> file = "test.mhd"<br>><br>> reader = vtk.vtkMetaImageReader()<br>> reader.SetFileName(file)<br>> reader.Update() #just for checking because I had an observer attached to reader<br>> <br>><br>> iren = QVTKRenderWindowInteractor(self.widget)<br>> ren = vtk.vtkRenderer()<br>><br>> iren.GetRenderWindow().AddRenderer(ren)<br>><br>>
<br>><br>> viewer = vtk.vtkResliceImageViewer()<br>> viewer.SetRenderWindow(iren.GetRenderWindow())<br>><br>> viewer.SetRenderer(ren)<br>> viewer.SetupInteractor(iren)<br>> viewer.SetInput(reader.GetOutput())<br>> <br>> viewer.SetSlice(50)<br>> viewer.SetColorWindow(2000.0)<br>> viewer.SetColorLevel(1000.0)<br>> <br>> layout = QtGui.QVBoxLayout()<br>><br>> layout.addWidget(iren)<br>> <br>> self.slider = QtGui.QSlider(Qt.Horizontal, self.widget)<br>>
layout.addWidget(self.slider)<br>> <br>> self.widget.setLayout(layout)<br>> <br>> iren.Initialize()<br>> iren.Start()<br>><br>>I can see the image in the first place.<br>>When I use the right mouse button everything is fine and I can zoom in and out but when using the left mouse button the app suddenly freezes and the debugging window of Win7 appears - not the VTK window. It is sth. with a malloc at least this is what the debugger told me or rather stepped in.<br>>I tried using the Error Observer suggested by David and mined every object I've access to. I also used the vtk.vtkFileOutputWindow() without any success. No file was written.<br>>(The slider isn't currently attached to any object so you can ignore it.) Am I doing sth. wrong with the initialization?<br>><br>>Can
someone help me with this?<br>><br>>Cheers,<br>>Willi<br><br><br> </div> </div> </blockquote></div> </div></body></html>