当前位置: 首页>>代码示例>>Python>>正文


Python vtk.vtkBoxWidget函数代码示例

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


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

示例1: createRenderer

 def createRenderer(self, **args ):
     background_color = args.get( 'background_color', VTK_BACKGROUND_COLOR )
     self.renderer.SetBackground(*background_color)   
     self.textDisplayMgr = TextDisplayMgr( self.renderer ) 
     self.renderWindowInitSize = args.get( 'window_size', None ) 
     if self.renderWindowInitSize <> None:
         self.renderWindow.SetSize( self.renderWindowInitSize )                             
     self.pointPicker = vtk.vtkPointPicker()
     self.pointPicker.PickFromListOn()   
     try:        self.pointPicker.SetUseCells(True)  
     except:     print>>sys.stderr,  "Warning, vtkPointPicker patch not installed, picking will not work properly."
     self.pointPicker.InitializePickList()             
     self.renderWindowInteractor.SetPicker(self.pointPicker) 
     self.addObserver( self.renderer, 'ModifiedEvent', self.activateEvent )
     self.clipper = vtk.vtkBoxWidget()
     self.clipper.RotationEnabledOff()
     self.clipper.SetPlaceFactor( 1.0 ) 
     self.clipper.KeyPressActivationOff()
     self.clipper.SetInteractor( self.renderWindowInteractor )    
     self.clipper.SetHandleSize( 0.005 )
     self.clipper.SetEnabled( True )
     self.clipper.InsideOutOn()  
     self.clipper.AddObserver( 'StartInteractionEvent', self.startClip )
     self.clipper.AddObserver( 'EndInteractionEvent', self.endClip )
     self.clipper.AddObserver( 'InteractionEvent', self.executeClip )           
     self.clipOff() 
开发者ID:arulalant,项目名称:uvcdat,代码行数:26,代码来源:DV3DPlot.py

示例2: Execute

    def Execute(self):

        if self.Image == None:
            self.PrintError('Error: no Image.')

        if self.Interactive == 1:
            
            if not self.vmtkRenderer:
                self.vmtkRenderer = vmtkrenderer.vmtkRenderer()
                self.vmtkRenderer.Initialize()
                self.OwnRenderer = 1

            self.vmtkRenderer.RegisterScript(self)                 

            self.PlaneWidgetX = vtkvmtk.vtkvmtkImagePlaneWidget()
            self.PlaneWidgetX.SetInteractor(self.vmtkRenderer.RenderWindowInteractor)
            self.PlaneWidgetY = vtkvmtk.vtkvmtkImagePlaneWidget()
            self.PlaneWidgetY.SetInteractor(self.vmtkRenderer.RenderWindowInteractor)
            self.PlaneWidgetZ = vtkvmtk.vtkvmtkImagePlaneWidget()
            self.PlaneWidgetZ.SetInteractor(self.vmtkRenderer.RenderWindowInteractor)
            self.BoxWidget = vtk.vtkBoxWidget()
            self.BoxWidget.SetInteractor(self.vmtkRenderer.RenderWindowInteractor)
            self.vmtkRenderer.AddKeyBinding('i','Interact.', self.InteractCallback)

            self.Display()
            while (self.BoxActive == 1):
                self.PaintVOI()
                self.Display()
        else:
            self.PaintVOI()

        if self.OwnRenderer:
            self.vmtkRenderer.Deallocate()
开发者ID:vmtk,项目名称:vmtk,代码行数:33,代码来源:vmtkimagevoipainter.py

示例3: Execute

    def Execute(self):

        if self.Image == None:
            self.PrintError('Error: no Image.')

        self.CroppedImage.DeepCopy(self.Image)

        if self.Interactive == 1:
            
            if not self.vmtkRenderer:
                self.vmtkRenderer = vmtkrenderer.vmtkRenderer()
                self.vmtkRenderer.Initialize()
                self.OwnRenderer = 1
                
            self.PlaneWidgetX = vtk.vtkImagePlaneWidget()
            self.PlaneWidgetX.SetInteractor(self.vmtkRenderer.RenderWindowInteractor)
            self.PlaneWidgetY = vtk.vtkImagePlaneWidget()
            self.PlaneWidgetY.SetInteractor(self.vmtkRenderer.RenderWindowInteractor)
            self.PlaneWidgetZ = vtk.vtkImagePlaneWidget()
            self.PlaneWidgetZ.SetInteractor(self.vmtkRenderer.RenderWindowInteractor)
            self.BoxWidget = vtk.vtkBoxWidget()
            self.BoxWidget.SetInteractor(self.vmtkRenderer.RenderWindowInteractor)

            self.Display()
            while (self.BoxActive == 1):
                self.ExtractVOI()
                self.Image = self.CroppedImage
                self.Display()
        else:
            self.ExtractVOI()

        if self.OwnRenderer:
            self.vmtkRenderer.Deallocate()

        self.Image = self.CroppedImage
开发者ID:ValentinaRossi,项目名称:vmtk,代码行数:35,代码来源:vmtkimagevoiselector.py

示例4: Execute

    def Execute(self):

        if self.Surface == None:
            self.PrintError('Error: no Surface.')

        if self.WidgetType == "box":
            self.ClipFunction = vtk.vtkPlanes()
        elif self.WidgetType == "sphere":
            self.ClipFunction = vtk.vtkSphere()

        self.Clipper = vtk.vtkClipPolyData()
        self.Clipper.SetInput(self.Surface)
        self.Clipper.SetClipFunction(self.ClipFunction)
        self.Clipper.GenerateClippedOutputOn()
        self.Clipper.InsideOutOn()
        
        if not self.vmtkRenderer:
            self.vmtkRenderer = vmtkrenderer.vmtkRenderer()
            self.vmtkRenderer.Initialize()
            self.OwnRenderer = 1

        mapper = vtk.vtkPolyDataMapper()
        mapper.SetInput(self.Surface)
        mapper.ScalarVisibilityOff()
        self.Actor = vtk.vtkActor()
        self.Actor.SetMapper(mapper)
        self.vmtkRenderer.Renderer.AddActor(self.Actor)

        if self.WidgetType == "box":
            self.ClipWidget = vtk.vtkBoxWidget()
            self.ClipWidget.GetFaceProperty().SetColor(0.6,0.6,0.2)
            self.ClipWidget.GetFaceProperty().SetOpacity(0.25)
        elif self.WidgetType == "sphere":
            self.ClipWidget = vtk.vtkSphereWidget()
            self.ClipWidget.GetSphereProperty().SetColor(0.6,0.6,0.2)
            self.ClipWidget.GetSphereProperty().SetOpacity(0.25)
            self.ClipWidget.GetSelectedSphereProperty().SetColor(0.6,0.0,0.0)
            self.ClipWidget.GetSelectedSphereProperty().SetOpacity(0.75)
            self.ClipWidget.SetRepresentationToSurface()
            self.ClipWidget.SetPhiResolution(20)
            self.ClipWidget.SetThetaResolution(20)

        self.ClipWidget.SetInteractor(self.vmtkRenderer.RenderWindowInteractor)
        self.Display()

        self.Transform = vtk.vtkTransform()
        self.ClipWidget.GetTransform(self.Transform)

        if self.OwnRenderer:
            self.vmtkRenderer.Deallocate()

        if self.CleanOutput == 1:
            cleaner = vtk.vtkCleanPolyData()
            cleaner.SetInput(self.Surface)
            cleaner.Update()
            self.Surface = cleaner.GetOutput()

        if self.Surface.GetSource():
            self.Surface.GetSource().UnRegisterAllOutputs()
开发者ID:ValentinaRossi,项目名称:vmtk,代码行数:59,代码来源:vmtksurfaceclipper.py

示例5: createContent

 def createContent( self ):
     input =  self.module.inputModule.getOutput()  
     self.boxWidget = vtk.vtkBoxWidget()
     self.boxWidget.SetRotationEnabled(0)
     self.boxWidget.SetPlaceFactor(1.0)
     self.boxWidget.SetInput( input )
     self.planes = vtk.vtkPlanes()
     self.boxWidget.AddObserver("StartInteractionEvent", self.startConfiguration )
     self.boxWidget.AddObserver("InteractionEvent",      self.updateConfiguration )
     self.boxWidget.AddObserver("EndInteractionEvent",   self.endConfiguration ) 
开发者ID:imclab,项目名称:vistrails,代码行数:10,代码来源:ResampleModule.py

示例6: __init__

	def __init__(self):
		super(ClippingBox, self).__init__()
		self.widget = None

		self.clippingBox = vtkBoxWidget()
		self.planes = [vtkImagePlaneWidget() for _ in range(6)]
		self.transform = vtkTransform()  # For future functionality

		self._clippingBoxState = False
		self._clippingPlanesState = False
开发者ID:berendkleinhaneveld,项目名称:Registrationshop,代码行数:10,代码来源:ClippingBox.py

示例7: __init__

    def __init__( self, parent, imode_callback, rmode_callback, ppos_callback, ao, **kwargs ):
        # initialize Panel
        if 'id' not in kwargs:
            kwargs['id'] = wx.ID_ANY
        wx.Panel.__init__( self, parent, **kwargs )

        self.setInteractionMode = imode_callback
        self.setInteractionMode(True)
        
        self.recordingMode = False
        self.setRecordingMode = rmode_callback
        self.setRecordingMode(False)
        
        self.setPickerPos = ppos_callback
        
        self.ao = ao
        self.aa = False
        self.firstRender = True

        self.vtkWidget = wxVTKRenderWindowInteractor(self, wx.ID_ANY)
        self.iren = self.vtkWidget._Iren
        self.iren.SetInteractorStyle(vtk.vtkInteractorStyleTrackballCamera())
        
        self.renderer = vtk.vtkRenderer()
        self.renderer.SetBackground(0,0,0)
        self.imageLayer = {}
        self.CISID = -1  # Current Image Set ID
        self.imageLayer[self.CISID] = IBCRenderer(self.renderer, self.iren.Render)
        self.bacteriaLayer = BacteriaLayer(self.renderer, self.iren.Render)
        
        self.viewCamActive = True
        
        # for interactive clipping
        self.planes = vtk.vtkPlanes()
        
        self.ellipsoid = None
        self.ellipsoidTextActor = None
        
        # The SetInteractor method is how 3D widgets are associated with the
        # render window interactor. Internally, SetInteractor sets up a bunch
        # of callbacks using the Command/Observer mechanism (AddObserver()).
        self.boxWidget = vtk.vtkBoxWidget()
        self.boxWidget.SetInteractor(self.iren)
        self.boxWidget.SetPlaceFactor(1.0)

        # init vtk window
        self.vtkWidget.Enable(1)
        self.vtkWidget.AddObserver("ExitEvent", lambda o,e,f=parent: f.Close())
        self.vtkWidget.GetRenderWindow().AddRenderer(self.renderer)
        
        # Bind VTK events
        self.iren.AddObserver("KeyPressEvent", self.OnKeyDown)
        
        self.Sizer = wx.BoxSizer()
        self.Sizer.Add(self.vtkWidget, 1, wx.EXPAND)
开发者ID:smdabdoub,项目名称:ProkaryMetrics,代码行数:55,代码来源:vtkRender.py

示例8: processVerticalScalingCommand

    def processVerticalScalingCommand( self, args, config_function ):
#        print "processVerticalScalingCommand: ", str(args)
        verticalScale = config_function.value
        if args and args[0] == "StartConfig":
            ispec = self.inputSpecs[ 0 ]
            wbounds = ispec.getDataBounds()
            self.zscaleBoxWidget = vtk.vtkBoxWidget()
            self.zscaleBoxWidget.SetInteractor( self.renderWindowInteractor )
            self.zscaleBoxWidget.SetPlaceFactor(1.0)
            self.zscaleBoxWidget.HandlesOff()
            self.zscaleBoxWidget.SetEnabled(1)
            oprop = self.zscaleBoxWidget.GetOutlineProperty()
            oprop.SetColor( 0.0, 0.0, 0.0 )
            oprop.SetLineWidth( 2.0 )
            self.zscaleBoxWidget.On()
            self.zscaleBoxWidget.PlaceWidget(wbounds)
#            print "  >>>>>>>>>>>>>>>>>>>>> Place box widget: ", str( wbounds )
        elif args and args[0] == "Init":
            self.parameter_initializing = True
            ispec = self.inputSpecs[ 0 ]
            zsval = config_function.initial_value
#             plotType = ispec.getMetadata('plotType')
#             if plotType == 'xyt':
#                 tval = ispec.getMetadata('time')
#                 if tval: zsval = 10.0 / len( tval )
#             else:
#                 lval = ispec.getMetadata('lev')
#                 if tval: zsval = 10.0 / len( lval )
#             verticalScale.setValues( [ zsval ] )
            self.setZScale( zsval  )
            verticalScale.setValue( 'count', 1 )
            self.parameter_initializing = False
        elif args and args[0] == "EndConfig":
            vscale = verticalScale.getValues()
            self.setZScale( vscale )
            self.zscaleBoxWidget.Off()
            self.zscaleBoxWidget.SetEnabled(0)
            self.zscaleBoxWidget = None
            self.processConfigParameterChange( verticalScale )
        elif args and args[0] == "InitConfig":
            self.updateTextDisplay( config_function.label )
            bbar = self.getInteractionButtons()
            self.skipIndex = 2
            for islider in range(4): bbar.setSliderVisibility(  islider, islider < len(config_function.sliderLabels)  )
        elif args and args[0] == "Open":
            pass
        elif args and args[0] == "Close":
            pass
        elif args and args[0] == "UpdateConfig":
            ispec = self.inputSpecs[ 0 ]
            vscale = args[2].GetValue()
            verticalScale.setValues( [ vscale ] )
            wbounds = ispec.getDataBounds( zscale=vscale )
            self.zscaleBoxWidget.PlaceWidget( wbounds )
开发者ID:NESII,项目名称:uvcdat,代码行数:54,代码来源:StructuredGridPlot.py

示例9: setImageData

	def setImageData(self, imageData):
		self.transformBox = vtkBoxWidget()
		self.transformBox.SetInteractor(self.widget.rwi)
		self.transformBox.SetPlaceFactor(1.01)
		self.transformBox.SetInputData(imageData)
		self.transformBox.SetDefaultRenderer(self.widget.rendererOverlay)
		self.transformBox.InsideOutOn()
		self.transformBox.PlaceWidget()

		self.AddObserver(self.transformBox, "InteractionEvent", self.transformCallback)
		self.transformBox.GetSelectedFaceProperty().SetOpacity(0.3)
		self.transformBox.EnabledOn()
开发者ID:berendkleinhaneveld,项目名称:Registrationshop,代码行数:12,代码来源:TransformBox.py

示例10: __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

示例11: Execute

    def Execute(self):

        if (self.Mesh == None):
            self.PrintError('Error: no Mesh.')

        self.Planes = vtk.vtkPlanes()
        self.Clipper = vtk.vtkClipDataSet()
        self.Clipper.SetInput(self.Mesh)
        self.Clipper.SetClipFunction(self.Planes)
        self.Clipper.GenerateClippedOutputOn()
        self.Clipper.InsideOutOn()
        
        if not self.vmtkRenderer:
            self.vmtkRenderer = vmtkrenderer.vmtkRenderer()
            self.vmtkRenderer.Initialize()
            self.OwnRenderer = 1

        self.vmtkRenderer.RegisterScript(self) 

        mapper = vtk.vtkDataSetMapper()
        mapper.SetInput(self.Mesh)
        mapper.ScalarVisibilityOff()
        self.Actor = vtk.vtkActor()
        self.Actor.SetMapper(mapper)
        self.vmtkRenderer.Renderer.AddActor(self.Actor)

        self.BoxWidget = vtk.vtkBoxWidget()
        self.BoxWidget.SetInteractor(self.vmtkRenderer.RenderWindowInteractor)
        self.BoxWidget.GetFaceProperty().SetColor(0.6,0.6,0.2)
        self.BoxWidget.GetFaceProperty().SetOpacity(0.25)

        self.vmtkRenderer.AddKeyBinding('i','Interact.', self.InteractCallback)
        self.vmtkRenderer.AddKeyBinding('space','Clip.', self.ClipCallback)

        self.Display()

        if self.OwnRenderer:
            self.vmtkRenderer.Deallocate()
        
        if self.Mesh.GetSource():
            self.Mesh.GetSource().UnRegisterAllOutputs()
开发者ID:SaraZanchi,项目名称:vmtk,代码行数:41,代码来源:vmtkmeshclipper.py

示例12: OnBox

 def OnBox(self, event):
     boxWidget = vtk.vtkBoxWidget()
     # change handle properties
     boxWidget.SetHandleSize(0.005) # default is 0.01
     boxWidget.SetInteractor(self.widget)
     boxWidget.SetPlaceFactor(1.25)
     boxWidget.SetInput(self.normals.GetOutput())
     boxWidget.PlaceWidget()
     boxCallback = self.BoxSelectPolygons()
     boxWidget.AddObserver("EndInteractionEvent", boxCallback)
     boxWidget.KeyPressActivationOff()
     plane = vtk.vtkPlanes()
     self.boxes.append(boxWidget)
     self.planes[boxWidget.GetAddressAsString('')] = plane
     self.region.AddFunction(plane)
     newId = self.GateMenu.AppendCheckItem(-1, "Box #" + str(self.boxCount))
     self.boxCount = self.boxCount + 1
     self.boxIds[newId.GetId()] = boxWidget.GetAddressAsString('')
     newId.Check(True)
     self.Bind(wx.EVT_MENU, self.OnBoxSelect, newId)
     boxWidget.On()
开发者ID:cliburn,项目名称:flow,代码行数:21,代码来源:Main.py

示例13: __init__

	def __init__(self, parent, visualizer, **kws):
		"""
		Initialization
		"""
		self.boxWidget = None
		VisualizationModule.__init__(self, parent, visualizer, **kws)   

		self.descs = {"ShowControls": "Show controls",
					  "ClippedModule": "Module to clip",
					  "AllModules": "Clip all modules",
					  "InsideOut": "Clip from outside"}
		boxWidget = self.boxWidget = vtk.vtkBoxWidget()
		self.cut = 0
	  
		self.clippedMappers = []

		self.renderer = self.parent.getRenderer()
		iactor = parent.wxrenwin.GetRenderWindow().GetInteractor()
		self.boxWidget.SetInteractor(iactor)
		self.boxWidget.SetPlaceFactor(1.0)
		
		outlineProperty = boxWidget.GetOutlineProperty()
		outlineProperty.SetRepresentationToWireframe()
		outlineProperty.SetAmbient(1.0)
		outlineProperty.SetAmbientColor(1, 1, 1)
		outlineProperty.SetLineWidth(3)
		
		selectedOutlineProperty = boxWidget.GetSelectedOutlineProperty()
		selectedOutlineProperty.SetRepresentationToWireframe()
		selectedOutlineProperty.SetAmbient(1.0)
		selectedOutlineProperty.SetAmbientColor(1, 0, 0)
		selectedOutlineProperty.SetLineWidth(3)
#        iactor = self.wxrenwin.GetRenderWindow().GetInteractor()
		boxWidget.AddObserver("InteractionEvent", self.clipVolumeRender)
		self.renew = 0
		self.filterDesc = "Clip rendering using a box"
开发者ID:chalkie666,项目名称:bioimagexd-svn-import-from-sourceforge,代码行数:36,代码来源:CutWidget.py

示例14: __init__

    def __init__(self, module_manager):
        # call base constructor
        ModuleBase.__init__(self, module_manager)
        ColourDialogMixin.__init__(
            self, module_manager.get_module_view_parent_window())
        self._numDataInputs = self.NUM_INPUTS
        # use list comprehension to create list keeping track of inputs
        self._inputs = [{'Connected' : None, 'inputData' : None,
                         'vtkActor' : None, 'ipw' : None}
                       for i in range(self._numDataInputs)]
        # then the window containing the renderwindows
        self.threedFrame = None

        # the renderers corresponding to the render windows
        self._threedRenderer = None

        self._outline_source = vtk.vtkOutlineSource()
        om = vtk.vtkPolyDataMapper()
        om.SetInputConnection(self._outline_source.GetOutputPort())
        self._outline_actor = vtk.vtkActor()
        self._outline_actor.SetMapper(om)
        self._cube_axes_actor2d = vtk.vtkCubeAxesActor2D()
        self._cube_axes_actor2d.SetFlyModeToOuterEdges()
        #self._cube_axes_actor2d.SetFlyModeToClosestTriad()


        # use box widget for VOI selection
        self._voi_widget = vtk.vtkBoxWidget()
        # we want to keep it aligned with the cubic volume, thanks
        self._voi_widget.SetRotationEnabled(0)
        self._voi_widget.AddObserver('InteractionEvent',
                                     self.voiWidgetInteractionCallback)
        self._voi_widget.AddObserver('EndInteractionEvent',
                                     self.voiWidgetEndInteractionCallback)
        self._voi_widget.NeedsPlacement = True

        # also create the VTK construct for actually extracting VOI from data
        #self._extractVOI = vtk.vtkExtractVOI()
        self._currentVOI = 6 * [0]

        # set the whole UI up!
        self._create_window()

        # our interactor styles (we could add joystick or something too)
        self._cInteractorStyle = vtk.vtkInteractorStyleTrackballCamera()


        # set the default
        self.threedFrame.threedRWI.SetInteractorStyle(self._cInteractorStyle)
        
        rwi = self.threedFrame.threedRWI
        rwi.Unbind(wx.EVT_MOUSEWHEEL)
        rwi.Bind(wx.EVT_MOUSEWHEEL, self._handler_mousewheel)        

        # initialise our sliceDirections, this will also setup the grid and
        # bind all slice UI events
        self.sliceDirections = sliceDirections(
            self, self.controlFrame.sliceGrid)

        self.selectedPoints = selectedPoints(
            self, self.controlFrame.pointsGrid)

        # we now have a wx.ListCtrl, let's abuse it
        self._tdObjects = tdObjects(self,
                                    self.controlFrame.objectsListGrid)

        self._implicits = implicits(self,
                                    self.controlFrame.implicitsGrid)


        # setup orientation widget stuff
        # NB NB NB: we switch interaction with this off later
        # (InteractiveOff()), thus disabling direct translation and
        # scaling.  If we DON'T do this, interaction with software 
        # raycasters are greatly slowed down.
        self._orientation_widget = vtk.vtkOrientationMarkerWidget()
        
        self._annotated_cube_actor = aca = vtk.vtkAnnotatedCubeActor()
        #aca.TextEdgesOff()

        aca.GetXMinusFaceProperty().SetColor(1,0,0)
        aca.GetXPlusFaceProperty().SetColor(1,0,0)
        aca.GetYMinusFaceProperty().SetColor(0,1,0)
        aca.GetYPlusFaceProperty().SetColor(0,1,0)
        aca.GetZMinusFaceProperty().SetColor(0,0,1)
        aca.GetZPlusFaceProperty().SetColor(0,0,1)
        
        self._axes_actor = vtk.vtkAxesActor()

        self._orientation_widget.SetInteractor(
            self.threedFrame.threedRWI)
        self._orientation_widget.SetOrientationMarker(
            self._axes_actor)
        self._orientation_widget.On()
       
        # make sure interaction is off; when on, interaction with
        # software raycasters is greatly slowed down!
        self._orientation_widget.InteractiveOff()
开发者ID:sanguinariojoe,项目名称:devide,代码行数:98,代码来源:slice3dVWR.py

示例15: Execute

    def Execute(self):

        if self.Mesh == None:
            self.PrintError("Error: no Mesh.")

        self.Clipper = vtk.vtkClipDataSet()
        self.Clipper.SetInput(self.Mesh)
        self.Clipper.GenerateClippedOutputOn()
        self.Clipper.SetInsideOut(self.InsideOut)

        if self.Interactive:

            self.Planes = vtk.vtkPlanes()
            self.Clipper.SetClipFunction(self.Planes)

            self.Cutter = vtk.vtkCutter()
            self.Cutter.SetInput(self.Mesh)
            self.Cutter.SetCutFunction(self.Planes)

            self.ClippedMesh = vtk.vtkUnstructuredGrid()
            self.Surface = vtk.vtkPolyData()

            if not self.vmtkRenderer:
                self.vmtkRenderer = vmtkrenderer.vmtkRenderer()
                self.vmtkRenderer.Initialize()
                self.OwnRenderer = 1

            self.vmtkRenderer.RegisterScript(self)

            mapper = vtk.vtkDataSetMapper()
            mapper.SetInput(self.Mesh)
            mapper.ScalarVisibilityOff()
            self.Actor = vtk.vtkActor()
            self.Actor.SetMapper(mapper)
            self.vmtkRenderer.Renderer.AddActor(self.Actor)

            self.BoxWidget = vtk.vtkBoxWidget()
            self.BoxWidget.SetInteractor(self.vmtkRenderer.RenderWindowInteractor)
            self.BoxWidget.GetFaceProperty().SetColor(0.6, 0.6, 0.2)
            self.BoxWidget.GetFaceProperty().SetOpacity(0.25)

            self.vmtkRenderer.AddKeyBinding("i", "Interact.", self.InteractCallback)
            self.vmtkRenderer.AddKeyBinding("space", "Clip.", self.ClipCallback)

            self.Display()

            if self.OwnRenderer:
                self.vmtkRenderer.Deallocate()

        else:

            self.Mesh.GetPointData().SetActiveScalars(self.ClipArrayName)

            self.Clipper.GenerateClipScalarsOff()
            self.Clipper.SetValue(self.ClipValue)
            self.Clipper.Update()

            self.Cutter = vtk.vtkContourFilter()
            self.Cutter.SetInput(self.Mesh)
            self.Cutter.SetValue(0, self.ClipValue)
            self.Cutter.Update()

            self.Mesh = self.Clipper.GetOutput()
            self.Surface = self.Cutter.GetOutput()
            self.ClippedMesh = self.Clipper.GetClippedOutput()

        if self.Mesh.GetSource():
            self.Mesh.GetSource().UnRegisterAllOutputs()
开发者ID:abhishek101hi,项目名称:vmtk,代码行数:68,代码来源:vmtkmeshclipper.py


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