• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python vtk.vtkOrientationMarkerWidget函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中vtk.vtkOrientationMarkerWidget函数的典型用法代码示例。如果您正苦于以下问题:Python vtkOrientationMarkerWidget函数的具体用法?Python vtkOrientationMarkerWidget怎么用?Python vtkOrientationMarkerWidget使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了vtkOrientationMarkerWidget函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: renderthis

        def renderthis(self):
            # open a window and create a renderer
            self.ren = vtk.vtkRenderer()
            self.widget.GetRenderWindow().AddRenderer(self.ren)
            
            # Background colour lightgrey
            self.ren.SetBackground(0.9,0.9,0.9)
            
            #create a X,Y,Z axes to show 3d position:
            # create axes variable and load vtk axes actor
            self.axes = vtk.vtkAxesActor()
            self.marker = vtk.vtkOrientationMarkerWidget()
            
            # set the interactor. self.widget._Iren is inbuilt python mechanism for current renderer window.
            self.marker.SetInteractor(self.widget._Iren )
            self.marker.SetOrientationMarker(self.axes )
            
            # set size and position of window (Xmin,Ymin,Xmax,Ymax)
            self.marker.SetViewport(0.75,0,1,0.25)
            
            #Allow user input
            self.marker.SetEnabled(1)

            # #settings for renderer window 
            self.ren.ResetCamera()
            self.ren.ResetCameraClippingRange()         
            self.isplotted = True
            self.p=0
开发者ID:aledj2,项目名称:MedPhysPython,代码行数:28,代码来源:Automatedlinedrawlive3.py


示例2: renderthis

    def renderthis(self):
            # open a window and create a renderer
            ren = vtk.vtkRenderer()
            self.widget.GetRenderWindow().AddRenderer(ren)
   
            # o take the polygonal data from the vtkConeSource and
            # create a rendering for the renderer.
            mapper = vtk.vtkPolyDataMapper()
            mapper.SetInputConnection(self.reader.GetOutputPort())

			#SetInputConnection(reader.GetOutputPort())
 
            # create an actor for our scene
            actor = vtk.vtkActor()
            actor.SetMapper(mapper)
            # Add actor
            ren.AddActor(actor)
 
            axes = vtk.vtkAxesActor()
            self.marker = vtk.vtkOrientationMarkerWidget()
            self.marker.SetInteractor( self.widget._Iren )
            self.marker.SetOrientationMarker( axes )
            self.marker.SetViewport(0.75,0,1,0.25)
            self.marker.SetEnabled(1)
 
            ren.ResetCamera()
            ren.ResetCameraClippingRange()
            cam = ren.GetActiveCamera()
            cam.Elevation(10)
            cam.Azimuth(70)
            self.isploted = True
开发者ID:hillyuan,项目名称:FEComponent,代码行数:31,代码来源:vtkmain.py


示例3: __init__

    def __init__(self, vtk_filename=None, vtk_data=None):
        """
        Initiate Viwer

        Parameters
        ----------
        vtk_filename : str
            Input VTK filename
        """

        QDialog.__init__(self)
        self.initUI()

        ren = vtk.vtkRenderer()
        self.vtkWidget.GetRenderWindow().AddRenderer(ren)
        iren = self.vtkWidget.GetRenderWindow().GetInteractor()

        if vtk_filename is not None:
            # VTK file
            reader = vtk.vtkUnstructuredGridReader()
            reader.SetFileName(vtk_filename)
            reader.Update()
            vtkdata = reader.GetOutput()

        if vtk_data is not None:
            vtkdata = vtk_data

        # VTK surface
        surface = vtk.vtkDataSetSurfaceFilter()
        surface.SetInput(vtkdata)
        surface.Update()

        mapper = vtk.vtkDataSetMapper()
        mapper.SetInput(surface.GetOutput())

        actor = vtk.vtkActor()
        actor.SetMapper(mapper)
        actor.GetProperty().EdgeVisibilityOff()
        # actor.GetProperty().SetEdgeColor(1,1,1)
        # actor.GetProperty().SetLineWidth(0.1)
        ren.AddActor(actor)

        # annot. cube
        axesActor = vtk.vtkAnnotatedCubeActor()
        axesActor.SetXPlusFaceText('R')
        axesActor.SetXMinusFaceText('L')
        axesActor.SetYMinusFaceText('H')
        axesActor.SetYPlusFaceText('F')
        axesActor.SetZMinusFaceText('A')
        axesActor.SetZPlusFaceText('P')
        axesActor.GetTextEdgesProperty().SetColor(1, 1, 0)
        axesActor.GetCubeProperty().SetColor(0, 0, 1)
        self.axes = vtk.vtkOrientationMarkerWidget()
        self.axes.SetOrientationMarker(axesActor)
        self.axes.SetInteractor(iren)
        self.axes.EnabledOn()
        self.axes.InteractiveOn()

        ren.ResetCamera()
        iren.Initialize()
开发者ID:andrlikjirka,项目名称:lisa,代码行数:60,代码来源:viewer.py


示例4: ShowOrientationCube

    def ShowOrientationCube(self):
        cube = vtk.vtkAnnotatedCubeActor()
        cube.GetXMinusFaceProperty().SetColor(1,0,0)
        cube.GetXPlusFaceProperty().SetColor(1,0,0)
        cube.GetYMinusFaceProperty().SetColor(0,1,0)
        cube.GetYPlusFaceProperty().SetColor(0,1,0)
        cube.GetZMinusFaceProperty().SetColor(0,0,1)
        cube.GetZPlusFaceProperty().SetColor(0,0,1)
        cube.GetTextEdgesProperty().SetColor(0,0,0)

        # anatomic labelling
        cube.SetXPlusFaceText ("A")
        cube.SetXMinusFaceText("P")
        cube.SetYPlusFaceText ("L")
        cube.SetYMinusFaceText("R")
        cube.SetZPlusFaceText ("S")
        cube.SetZMinusFaceText("I")

        axes = vtk.vtkAxesActor()
        axes.SetShaftTypeToCylinder()
        axes.SetTipTypeToCone()
        axes.SetXAxisLabelText("X")
        axes.SetYAxisLabelText("Y")
        axes.SetZAxisLabelText("Z")
        #axes.SetNormalizedLabelPosition(.5, .5, .5)

        orientation_widget = vtk.vtkOrientationMarkerWidget()
        orientation_widget.SetOrientationMarker(cube)
        orientation_widget.SetViewport(0.85,0.85,1.0,1.0)
        #orientation_widget.SetOrientationMarker(axes)
        orientation_widget.SetInteractor(self.interactor)
        orientation_widget.SetEnabled(1)
        orientation_widget.On()
        orientation_widget.InteractiveOff()
开发者ID:151706061,项目名称:invesalius3,代码行数:34,代码来源:viewer_volume.py


示例5: adicionaeixos

 def adicionaeixos(self):
     axes = vtk.vtkAxesActor()
     self.marker = vtk.vtkOrientationMarkerWidget()
     self.marker.SetInteractor( self.Interactor )
     self.marker.SetOrientationMarker( axes )
     self.marker.SetViewport(0.75,0,1,0.25)
     self.marker.SetEnabled(1)
开发者ID:jcdinis,项目名称:POMES,代码行数:7,代码来源:app.py


示例6: add_widgets

    def add_widgets(self):
        # axes
        axes = vtk.vtkAxesActor()
        self.marker_widget = vtk.vtkOrientationMarkerWidget()
        self.marker_widget.SetInteractor(self.iren)
        self.marker_widget.SetOrientationMarker(axes)
        self.marker_widget.SetViewport(0.0, 0.0, 0.25, 0.25)

        # scalar bar
        self.scalarbar_actor = vtk.vtkScalarBarActor()
        self.scalarbar_actor.SetLookupTable(self.lut)
        self.scalarbar_widget = vtk.vtkScalarBarWidget()
        self.scalarbar_widget.SetInteractor(self.iren)
        self.scalarbar_widget.SetScalarBarActor(self.scalarbar_actor)

        # contour slider
        self.slider_rep = vtk.vtkSliderRepresentation2D()
        self.slider_rep.SetTitleText("contour")
        self.slider_rep.GetPoint1Coordinate().SetCoordinateSystemToNormalizedViewport()
        self.slider_rep.GetPoint1Coordinate().SetValue(0.65, 0.1)
        self.slider_rep.GetPoint2Coordinate().SetCoordinateSystemToNormalizedViewport()
        self.slider_rep.GetPoint2Coordinate().SetValue(0.95, 0.1)

        self.slider_widget = vtk.vtkSliderWidget()
        self.slider_widget.SetInteractor(self.iren)
        self.slider_widget.SetRepresentation(self.slider_rep)
        self.slider_widget.SetAnimationModeToAnimate()
        self.slider_widget.AddObserver(vtk.vtkCommand.InteractionEvent,
            self.update_contour);
开发者ID:capitalaslash,项目名称:radcal-gui,代码行数:29,代码来源:vtkgui.py


示例7: __init__

 def __init__(self, parent = None):
     QtGui.QMainWindow.__init__(self, parent)
     self.ui = Ui_MainWindow()
     self.ui.setupUi(self)
     self.ren = vtk.vtkRenderer()
     self.ui.vtkWidget.GetRenderWindow().AddRenderer(self.ren)
     self.iren = self.ui.vtkWidget.GetRenderWindow().GetInteractor()
     cube = vtk.vtkCubeSource()
     cube.SetXLength(200)
     cube.SetYLength(200)
     cube.SetZLength(200)
     cube.Update()
     cm = vtk.vtkPolyDataMapper()
     cm.SetInputConnection(cube.GetOutputPort())
     ca = vtk.vtkActor()
     ca.SetMapper(cm)
     self.ren.AddActor(ca)
     self.axesActor = vtk.vtkAnnotatedCubeActor();
     self.axesActor.SetXPlusFaceText('R')
     self.axesActor.SetXMinusFaceText('L')
     self.axesActor.SetYMinusFaceText('H')
     self.axesActor.SetYPlusFaceText('F')
     self.axesActor.SetZMinusFaceText('P')
     self.axesActor.SetZPlusFaceText('A')
     self.axesActor.GetTextEdgesProperty().SetColor(1,1,0)
     self.axesActor.GetTextEdgesProperty().SetLineWidth(2)
     self.axesActor.GetCubeProperty().SetColor(0,0,1)
     self.axes = vtk.vtkOrientationMarkerWidget()
     self.axes.SetOrientationMarker(self.axesActor)
     self.axes.SetInteractor(self.iren)
     self.axes.EnabledOn()
     self.axes.InteractiveOn()
     self.ren.ResetCamera()
开发者ID:kvkenyon,项目名称:projects,代码行数:33,代码来源:OrientationMarkerWidget.py


示例8: PlotGrids_wFEM

def PlotGrids_wFEM(grids):
    """ Plots CFD structured grids with a single FEM """

    N = len(grids)
    HSV_tuples = [(x*1.0/N, 0.5, 0.5) for x in range(N)]
    RGB_tuples = map(lambda x: colorsys.hsv_to_rgb(*x), HSV_tuples)
    
    actors = []
    for i in range(len(grids)):
        
        # Create mapper
        mapper = vtk.vtkDataSetMapper()
        if vtk.vtkVersion().GetVTKMajorVersion() >5:
            mapper.SetInput(grids[i])
        else:
            mapper.SetInputData(grids[i])
        
        # Create actor
        actor = vtk.vtkActor()
        actor.SetMapper(mapper)
        actor.GetProperty().EdgeVisibilityOn()
        if i != 0:
            actor.GetProperty().SetRepresentationToWireframe()
            actor.GetProperty().SetColor(RGB_tuples[i])
        actor.GetProperty().LightingOff()
        actors.append(actor)
        
    # Add FEM Actor to renderer window
    ren = vtk.vtkRenderer()
#    ren.SetBackground(0.3, 0.3, 0.3)
    ren.SetBackground(0.8, 0.8, 0.8)
    renWin = vtk.vtkRenderWindow()
    renWin.AddRenderer(ren)
    iren = vtk.vtkRenderWindowInteractor()
    iren.SetRenderWindow(renWin)
    
    # Allow user to interact
    istyle = vtk.vtkInteractorStyleTrackballCamera()
    iren.SetInteractorStyle(istyle)
    

    
    # Add actor
    for actor in actors:
        ren.AddActor(actor)
    
    axes = vtk.vtkAxesActor()
    widget = vtk.vtkOrientationMarkerWidget()
#    widget.SetOutlineColor( 0.9300, 0.5700, 0.1300 )
    widget.SetOrientationMarker( axes )
    widget.SetInteractor( iren )
    widget.SetViewport( 0.0, 0.0, 0.4, 0.4 )
    widget.SetEnabled( 1 )
    widget.InteractiveOn()
    
    # Render
    iren.Initialize()
    renWin.Render()
    iren.Start()
开发者ID:akaszynski,项目名称:PyACVD,代码行数:59,代码来源:VTK_Plotting.py


示例9: vtk_visualize

def vtk_visualize(point_list, view_thresh):
    point_cloud = VtkPointCloud()
    x_thresh = view_thresh[0]
    y_thresh = view_thresh[1]
    z_thresh = view_thresh[2]

    for i in range(len(point_list)):
        point_coords = point_list[i]

        if (point_coords[0] > x_thresh[0]) and (point_coords[0] < x_thresh[1]) and \
                (point_coords[1] > y_thresh[0]) and (point_coords[1] < y_thresh[1]) and \
                (point_coords[2] > z_thresh[0]) and (point_coords[2] < z_thresh[1]):
            color_num = 0.7
        else:
            color_num = -1
        point_cloud.addPoint(point_list[i], color_num)

    # Add the velodyne plane
    for x in np.linspace(-4, 4, 100):
        for y in np.linspace(0, 2, 25):
            tmp_coords = np.array([x, 0, y])
            point_cloud.addPoint(tmp_coords, 1)
    # Add the floor plane
    plane_center = (-4, -4, -0.55)
    normal = (0, 0, 1)
    point1 = ([-4, 10, -0.55])
    point2 = ([4, -4, -0.55])
    point_cloud.addPlane(plane_center, normal, point1, point2)

    # Renderer
    renderer = vtk.vtkRenderer()
    renderer.AddActor(point_cloud.point_vtkActor)
    renderer.AddActor(point_cloud.plane_vtkActor)

    renderer.SetBackground(0.0, 0.0, 0.0)
    renderer.ResetCamera()

    # Render Window
    render_window = vtk.vtkRenderWindow()
    render_window.AddRenderer(renderer)

    # Interactor
    render_window_interactor = vtk.vtkRenderWindowInteractor()
    render_window_interactor.SetInteractorStyle(vtk.vtkInteractorStyleTrackballCamera())
    render_window_interactor.SetRenderWindow(render_window)

    '''Add camera coordinates'''
    axes = vtk.vtkAxesActor()
    widget = vtk.vtkOrientationMarkerWidget()
    widget.SetOutlineColor(0.9300, 0.5700, 0.1300)
    widget.SetOrientationMarker(axes)
    widget.SetInteractor(render_window_interactor)
    widget.SetViewport(0.0, 0.0, 0.4, 0.4)
    widget.SetEnabled(1)
    widget.InteractiveOn()
    render_window.Render()
    render_window_interactor.Start()
开发者ID:zimpha,项目名称:Velodyne-VLP-16,代码行数:57,代码来源:visualize_point_cloud.py


示例10: _create_orientation_widget

    def _create_orientation_widget(self, view3d):
        """setup orientation widget stuff, the axes in the bottom
        """
        view3d._orientation_widget = vtk.vtkOrientationMarkerWidget()
                
        view3d._axes_actor = vtk.vtkAxesActor()

        view3d._orientation_widget.SetOrientationMarker(view3d._axes_actor)
        view3d._orientation_widget.SetInteractor(view3d)
开发者ID:RalfNieuwenhuizen,项目名称:DeViDe-multiVWR,代码行数:9,代码来源:multiDirectionalSlicedViewSegmentation3dVieWeRFrame.py


示例11: attach_pos

    def attach_pos(self):

        pos = self._pos
        rad = self._rad

        if pos is not None and rad is not None:
            positions_vtk = numpy_support.numpy_to_vtk(num_array=pos.ravel(), deep=True, array_type=vtk.VTK_FLOAT)
            positions_vtk.SetName("positions")

            radius_vtk = numpy_support.numpy_to_vtk(num_array=rad.ravel(), deep=True, array_type=vtk.VTK_FLOAT)
            radius_vtk.SetName("radius")

            sphere = vtk.vtkSphereSource()
            sphere.SetRadius(1.0)

            ballGlyph = vtk.vtkGlyph3D()

            if vtk.VTK_MAJOR_VERSION <= 5:
                ballGlyph.SetSource(sphere.GetOutput())
            else:
                ballGlyph.SetSourceConnection(sphere.GetOutputPort())

            polydata = vtk.vtkPolyData()
            polydata.SetPoints(self._points)
            polydata.GetPointData().AddArray(radius_vtk)
            polydata.GetPointData().SetActiveScalars("radius") # this scales the source (sphere) radius (1.0)
            
            ballGlyph.SetInputData(polydata)

            #ballGlyph.SetScaleModeToDataScalingOn() 
            mapper = vtk.vtkPolyDataMapper()

            if vtk.VTK_MAJOR_VERSION <= 5:
               mapper.SetInput(ballGlyph.GetOutput())
            else:
               mapper.SetInputConnection(ballGlyph.GetOutputPort())

            # Set colors depending on the color transfer functions
            # mapper.SetLookupTable(self.colorTransferFunction)

            # actor
            ballActor = vtk.vtkActor()
            ballActor.GetProperty().SetColor(0,0,1)
            ballActor.SetMapper(mapper)

            #self._ren.AddActor(ballActor)
            self._marker2 = vtk.vtkOrientationMarkerWidget()
            self._marker2.SetInteractor( self.widget._Iren )
            self._marker2.SetOrientationMarker( ballActor )
            self._marker2.SetViewport(0.75,0,1,0.25)
            self._marker2.SetEnabled(1)

        else:
            print("No particles found. Make sure the particles loaded have positions and radii.")
开发者ID:Andrew-AbiMansour,项目名称:PyDEM,代码行数:54,代码来源:visualize.py


示例12: createCubeOrientation

 def createCubeOrientation(self):
     self._cubeOrientationActor = vtk.vtkAnnotatedCubeActor()
     self._cubeOrientationActor.SetXPlusFaceText(QtGui.QApplication.translate("ImagePlane", 
                                                  "L", 
                                                  None, 
                                                  QtGui.QApplication.UnicodeUTF8))      
     self._cubeOrientationActor.SetXMinusFaceText(QtGui.QApplication.translate("ImagePlane", 
                                                  "R", 
                                                  None, 
                                                  QtGui.QApplication.UnicodeUTF8))
     self._cubeOrientationActor.SetYPlusFaceText(QtGui.QApplication.translate("ImagePlane", 
                                                  "P", 
                                                  None, 
                                                  QtGui.QApplication.UnicodeUTF8))
     self._cubeOrientationActor.SetYMinusFaceText(QtGui.QApplication.translate("ImagePlane", 
                                                  "A", 
                                                  None, 
                                                  QtGui.QApplication.UnicodeUTF8))
     self._cubeOrientationActor.SetZPlusFaceText(QtGui.QApplication.translate("ImagePlane", 
                                                  "S", 
                                                  None, 
                                                  QtGui.QApplication.UnicodeUTF8))
     self._cubeOrientationActor.SetZMinusFaceText(QtGui.QApplication.translate("ImagePlane", 
                                                  "I", 
                                                  None, 
                                                  QtGui.QApplication.UnicodeUTF8))
     self._cubeOrientationActor.SetZFaceTextRotation(90)
     self._cubeOrientationActor.SetFaceTextScale(0.67)
     
     property = self._cubeOrientationActor.GetXPlusFaceProperty()
     property.SetColor(0, 0, 1)
     property = self._cubeOrientationActor.GetXMinusFaceProperty()
     property.SetColor(0, 0, 1)
     property = self._cubeOrientationActor.GetYPlusFaceProperty()
     property.SetColor(0, 1, 0)
     property = self._cubeOrientationActor.GetYMinusFaceProperty()
     property.SetColor(0, 1, 0)
     property = self._cubeOrientationActor.GetZPlusFaceProperty()
     property.SetColor(1, 0, 0)
     property = self._cubeOrientationActor.GetZMinusFaceProperty()
     property.SetColor(1, 0, 0)
     
     self._cubeOrientationActor.SetTextEdgesVisibility(1)
     self._cubeOrientationActor.SetCubeVisibility(1)
     self._cubeOrientationActor.SetFaceTextVisibility(1)
     
     self.orientationWidget = vtk.vtkOrientationMarkerWidget()    
     self.orientationWidget.SetInteractor(self._interactor)
     self.orientationWidget.SetViewport(0.85, 0.85, 1, 1)
     self.orientationWidget.SetOrientationMarker(self._cubeOrientationActor)
     self.orientationWidget.SetEnabled(1)
     self.orientationWidget.InteractiveOff()
     
     self.orientationWidget.On();
开发者ID:aevum,项目名称:moonstone,代码行数:54,代码来源:imagevolume.py


示例13: run

 def run(self):
     if self.displayAxes:
         axesActor = vtk.vtkAxesActor()
         axesActor.SetShaftTypeToLine()
         axes = vtk.vtkOrientationMarkerWidget()
         axes.SetOrientationMarker(axesActor);
         axes.SetInteractor(self.interactor);
         axes.EnabledOn();
         axes.InteractiveOn();
     self.window.Render()
     self.window.SetWindowName(self.windowTitle)
     self.interactor.Start()
开发者ID:rmaiko,项目名称:pyvsim,代码行数:12,代码来源:System.py


示例14: addAxes

    def addAxes(self):

        self.widget = vtkOrientationMarkerWidget()
        axes = vtkAxesActor()
        axes.SetShaftTypeToLine()
        axes.SetTotalLength(0.5, 0.5, 0.5)
        self.widget.SetOutlineColor(0.9300,0.5700,0.1300)
        self.widget.SetOrientationMarker(axes)
        self.widget.SetInteractor(self._Iren)
        self.widget.SetViewport(0.80, 0.0, 1.0,0.25)
        self._widgetState = True
        self.widget.SetEnabled(self._widgetState)
        self.widget.InteractiveOff()
开发者ID:mmolero,项目名称:templates,代码行数:13,代码来源:QVTKWidget.py


示例15: renderthis

        def renderthis(self):
            # open a window and create a renderer
            self.ren = vtk.vtkRenderer()
            self.widget.GetRenderWindow().AddRenderer(self.ren)
            # to generate polygonal data for a arrow.
            Arrow = vtk.vtkArrowSource()
            Arrow.SetShaftResolution(100)
            Arrow.SetTipResolution(100)
            #invert arrow so the point which is referenced is the top of the point
            Arrow.InvertOn()
 
            # take the polygonal data from the vtkArrowSource and assign to variable arrowmapper 
            ArrowMapper = vtk.vtkPolyDataMapper()
            ArrowMapper.SetInputConnection(Arrow.GetOutputPort())
 
            # create an actor for our scene (arrowactor)
            self.ArrowActor = vtk.vtkActor()
            self.ArrowActor.SetMapper(ArrowMapper)
            self.ArrowActor.GetProperty().SetColor(1,1,0)
            self.ArrowActor.GetProperty().SetOpacity(0.60)
            self.ArrowActor.GetProperty().EdgeVisibilityOn()
            self.ArrowActor.GetProperty().SetColor(0.1,0.1,0.1)
            # set tip position to (0,0,0)
            self.position=(0,0,0)
            self.ArrowActor.SetPosition(self.position)
            # get and print arrow position
            self.ArrowPos = self.ArrowActor.GetPosition()
            #print self.ArrowPos 
                         
            # Add actor to renderer window
            #self.ren.AddActor(self.ArrowActor)
            # Background colour lightgrey
            self.ren.SetBackground(0.9,0.9,0.9)
            
#create a X,Y,Z axes to show 3d position:
            # create axes variable and load vtk axes actor
            self.axes = vtk.vtkAxesActor()
            self.marker = vtk.vtkOrientationMarkerWidget()
            # set the interactor. self.widget._Iren is inbuilt python mechanism for current renderer window.
            self.marker.SetInteractor(self.widget._Iren )
            self.marker.SetOrientationMarker(self.axes )
            # set size and position of window (Xmin,Ymin,Xmax,Ymax)
            self.marker.SetViewport(0.75,0,1,0.25)
            #Allow user input
            self.marker.SetEnabled(1)

            # #settings for renderer window 
            self.ren.ResetCamera()
            self.ren.ResetCameraClippingRange()         
            self.isplotted = True
            self.p=0
开发者ID:aledj2,项目名称:MedPhysPython,代码行数:51,代码来源:Automatedlinedrawfromacceldata.py


示例16: __init__

    def __init__(self):
        '''
        Constructor
        '''
        vtkPythonViewImage.__init__(self)
        
#        texture mapper in 3D: vtkVolumeMapper
        self.__VolumeMapper = None
#        texture mapper in 3D: vtkVolumeTextureMapper3D
        self.__VolumeTextureMapper = vtk.vtkVolumeTextureMapper3D()
#        volume ray cast mapper vtkFixedPointVolumeRayCastMapper
        self.__VolumeRayCastMapper = vtk.vtkFixedPointVolumeRayCastMapper()
#        volume property: vtkVolumeProperty
        self.__VolumeProperty = vtk.vtkVolumeProperty()
#        volume actor: vtkVolume
        self.__VolumeActor = vtk.vtkVolume()
#        opacity transfer function: vtkPiecewiseFunction
        self.__OpacityFunction = vtk.vtkPiecewiseFunction()
#        color transfer function: vtkColorTransferFunction
        self.__ColorFunction = vtk.vtkColorTransferFunction()
        
#        vtkProp3DCollection
        self.__PhantomCollection = vtk.vtkProp3DCollection()
#        blender: vtkImageBlend
        self.__Blender = None
        
#        image 3D cropping box callback: vtkImage3DCroppingBoxCallback
        self.__Callback = vtkPythonImage3DCroppingBoxCallback()
#        box widget: vtkOrientedBoxWidget
#        self.__BoxWidget = vtkOrientedBoxWidget()    # Now I could not wrap vtkOrientedBoxWidget
        self.__BoxWidget = vtk.vtkBoxWidget()
#        vtkPlane widget: vtkPlaneWidget
        self.__PlaneWidget = vtk.vtkPlaneWidget()
#        annotated cube actor: vtkAnnotatedCubeActor, vtkOrientationMarkerWidget
        self.__Cube = vtk.vtkAnnotatedCubeActor()
        self.__Marker = vtk.vtkOrientationMarkerWidget()
        
        self.SetupVolumeRendering()
        self.SetupWidgets()
        
        self.ShowAnnotationsOn()
        self.getTextProperty().SetColor(0, 0, 0)
        self.SetBackground(0.9, 0.9, 0.9) # white
        
        self.__FirstRender = 1
        self.__RenderingMode = self.PLANAR_RENDERING
        self.__VRQuality = 1
        
        self.__InteractorStyleSwitcher = None
开发者ID:jackyko1991,项目名称:vtkpythonext,代码行数:49,代码来源:vtkPythonViewImage3D.py


示例17: __init__

    def __init__(self, iren):

        # super(Marker, self).__init__()

        self.axes_actor = Axes().axes
        self.cube_actor = Cube().cube

        self.assembly = vtk.vtkPropAssembly()
        self.assembly.AddPart(self.axes_actor)
        self.assembly.AddPart(self.cube_actor)

        self.marker = vtk.vtkOrientationMarkerWidget()
        self.marker.SetOutlineColor(0.93, 0.57, 0.13)
        self.marker.SetOrientationMarker(self.assembly)
        # self.marker.SetViewport(0.0, 0.0, 0.15, 0.3)
        self.marker.SetInteractor(iren)
开发者ID:quentan,项目名称:Work_Test_4,代码行数:16,代码来源:annotation_cube.py


示例18: RenderSTL

    def RenderSTL(self, filename):

        # not relod file
        if (self.filename == filename):
            return

        self.filename = filename
        # render the data
        reader = vtk.vtkSTLReader()
        reader.SetFileName(self.filename)

        # To take the polygonal data from the vtkConeSource and
        # create a rendering for the renderer.
        coneMapper = vtk.vtkPolyDataMapper()
        coneMapper.SetInput(reader.GetOutput())

        # create an actor for our scene
        if self.isploted:
            coneActor=self.ren.GetActors().GetLastActor()
            self.ren.RemoveActor(coneActor)

        coneActor = vtk.vtkActor()
        coneActor.SetMapper(coneMapper)

        # Add actor
        self.ren.AddActor(coneActor)
        # print self.ren.GetActors().GetNumberOfItems()

        if not self.isploted:
            axes = vtk.vtkAxesActor()
            self.marker = vtk.vtkOrientationMarkerWidget()
            self.marker.SetInteractor( self.widget._Iren )
            self.marker.SetOrientationMarker( axes )
            self.marker.SetViewport(0.75,0,1,0.25)
            self.marker.SetEnabled(1)

        self.ren.ResetCamera()
        self.ren.ResetCameraClippingRange()
        cam = self.ren.GetActiveCamera()

        cam.Elevation(10)
        cam.Azimuth(70)
        self.isploted = True
        self.ren.Render()

        # Refresh Panel
        self.Layout()
开发者ID:darkzena,项目名称:MYSTL,代码行数:47,代码来源:Render.py


示例19: renderthis

    def renderthis(self):
            # open a window and create a renderer            
            self.widget.GetRenderWindow().AddRenderer(self.renderer)
  
           # open file             
            self.filename=""
            openFileDialog = wx.FileDialog(self, "Open STL file", "", self.filename,
                                       "*.stl", wx.FD_OPEN | wx.FD_FILE_MUST_EXIST)
            
            if openFileDialog.ShowModal() == wx.ID_CANCEL:
                return
            self.filename = openFileDialog.GetPath()
            # render the data
            reader = vtk.vtkSTLReader()
            reader.SetFileName(self.filename)
  
            # To take the polygonal data from the vtkConeSource and
            # create a rendering for the renderer.
            coneMapper = vtk.vtkPolyDataMapper()
            coneMapper.SetInput(reader.GetOutput())

            # create an actor for our scene
            if self.isploted:
                coneActor=self.renderer.GetActors().GetLastActor()
                self.renderer.RemoveActor(coneActor)
                
            coneActor = vtk.vtkActor()
            coneActor.SetMapper(coneMapper)
            # Add actor
            self.renderer.AddActor(coneActor)
           # print self.ren.GetActors().GetNumberOfItems()

            if not self.isploted:
                axes = vtk.vtkAxesActor()
                self.marker = vtk.vtkOrientationMarkerWidget()
                self.marker.SetInteractor( self.widget._Iren )
                self.marker.SetOrientationMarker( axes )
                self.marker.SetViewport(0.75,0,1,0.25)
                self.marker.SetEnabled(1)

            self.renderer.ResetCamera()
            self.renderer.ResetCameraClippingRange()
            cam = self.renderer.GetActiveCamera()
            cam.Elevation(10)
            cam.Azimuth(70)
            self.isploted = True
            self.renderer.Render()
开发者ID:Hanbusy,项目名称:STLAPP,代码行数:47,代码来源:STL_Veiwer_APP.py


示例20: __init__

	def __init__(self, parent, pointSize=3, zMin=-10.0, zMax=10.0, maxNumPoints=1e6):
		wx.Panel.__init__(self, parent)
		 
		#to interact with the scene using the mouse use an instance of vtkRenderWindowInteractor. 
		self.widget = wxVTKRenderWindowInteractor(self, -1)
		self.widget.Enable(1)
		self.widget.AddObserver("ExitEvent", lambda o,e,f=self: f.Close())
		self.sizer = wx.BoxSizer(wx.VERTICAL)
		self.sizer.Add(self.widget, 1, wx.EXPAND)
		self.SetSizer(self.sizer)
		self.Layout()
		
		wx.YieldIfNeeded()
		
		self.maxNumPoints = maxNumPoints
		self.vtkPolyData = vtk.vtkPolyData()
		self.clearPoints()
		mapper = vtk.vtkPolyDataMapper()
		mapper.SetInput(self.vtkPolyData)
		mapper.SetColorModeToDefault()
		mapper.SetScalarRange(zMin, zMax)
		mapper.SetScalarVisibility(1)
		self.vtkActor = vtk.vtkActor()
		self.vtkActor.GetProperty().SetPointSize(pointSize);
		self.vtkActor.SetMapper(mapper)
		
		# Renderer
		renderer = vtk.vtkRenderer()
		renderer.AddActor(self.vtkActor)
		renderer.SetBackground(0.0, 0.0, 0.0)
		renderer.ResetCamera()

		self.widget.GetRenderWindow().AddRenderer(renderer)
		
		axes = vtk.vtkAxesActor()
		self.marker = vtk.vtkOrientationMarkerWidget()
		self.marker.SetInteractor( self.widget._Iren )
		self.marker.SetOrientationMarker( axes )
		self.marker.SetViewport(0.75,0,1,0.25)
		self.marker.SetEnabled(1)
		
		renderer.ResetCamera()
		renderer.ResetCameraClippingRange()
		cam = renderer.GetActiveCamera()

		cam.Azimuth(180)
开发者ID:mcdonalda1993,项目名称:Individual-Project,代码行数:46,代码来源:vtk_gui.py



注:本文中的vtk.vtkOrientationMarkerWidget函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python vtk.vtkOutlineFilter函数代码示例发布时间:2022-05-26
下一篇:
Python vtk.vtkObject函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap