Beispiel #1
0
    def test_image_plane_image_actor_with_vti(self):
        logging.debug("In VtkAxialSceneTest::test_image_plane_image_actor_with_vti()")
        from PySide import QtCore, QtGui
        
        from bloodstone.scenes.gui.qt.component.qvtkwidget import QVtkWidget

        reader = reader_vti(self.vtidir2)
        imagedata = reader_to_imagedata(reader)
        
        app = QtGui.QApplication(sys.argv)
        
        actions = {}
        actions["Slice"] = 0
        
        widget = QVtkWidget()
        widget.setWindowTitle("Test VtkAxial with image actor")
        widget.AddObserver("ExitEvent", lambda o, e, a=app: a.quit())
    
        scene = VtkImagePlane(widget)
        scene.input = reader
        scene.interactorStyle = vtk.vtkInteractorStyleTrackballCamera()
        scene.planeOrientation = VtkImagePlane.PLANE_ORIENTATION_AXIAL
        scene.enabled()
            
        def slotMouseWheelForwardEvent(obj, event, scene):
            #scene.pushByScalar += scene._imageData.GetSpacing()[2]*1
            #transform = vtk.vtkTransform()
            #transform.RotateWXYZ(356.084381104, -0.0432691946626, -0.052828669548, 0.0)
            #scene.transform = transform
            scene.updatePlane()
            scene.highlightPlane(True)
            scene.activateMargins(True)
            scene.updateMargins()
            scene.buildRepresentation()
            scene.window.Render()
            
        def slotMouseWheelBackwardEvent(obj, event, scene):
            scene.pushByScalar -= scene._imageData.GetSpacing()[2]*1
            scene.updatePlane()
            scene.highlightPlane(True)
            scene.activateMargins(True)
            scene.updateMargins()
            scene.buildRepresentation()
            scene.window.Render()
            
        #scene.interactorStyle = vtk.vtkInteractorStyleTrackballCamera()
        scene.interactorStyle.AddObserver('MouseWheelForwardEvent', 
            lambda o, e, i=scene: slotMouseWheelForwardEvent(o, e, i))
        scene.interactorStyle.AddObserver('MouseWheelBackwardEvent', 
            lambda o, e, i=scene: slotMouseWheelBackwardEvent(o, e, i))
        
        widget.show()
        
        app.exec_()
Beispiel #2
0
    def test_qvtkwidget(self):
        logging.debug("In SimpleTest::test_qvtkwidget()")
        app = QtGui.QApplication(sys.argv)

        ren = vtk.vtkRenderer()
        ren.AddActor(self.coneActor)

        win = QVtkWidget()
        win.setWindowTitle("Test QVtkWidget")
        win.AddObserver("ExitEvent", lambda o, e, a=app: a.quit())
        win.GetRenderWindow().AddRenderer(ren)
        win.Initialize()
        win.Start()
        win.show()

        app.exec_()
Beispiel #3
0
 def test_scene(self):
     logging.debug("In VtkSceneTest::test_scene()")
     from PySide import QtCore, QtGui
     
     from bloodstone.scenes.gui.qt.component.qvtkwidget import QVtkWidget
     
     app = QtGui.QApplication(sys.argv)
 
     widget = QVtkWidget()
     widget.setWindowTitle("Test VtkScene")
     widget.AddObserver("ExitEvent", lambda o, e, a=app: a.quit())
     
     scene = VtkScene(widget)
     scene.actor = self.coneActor
     scene.renderer.ResetCamera()
     scene.initialize()
     
     widget.show()
     
     app.exec_()