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

Python vtk.vtkLODActor函数代码示例

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

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



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

示例1: __init__

    def __init__(self, renderer):
        Visualizer.__init__(self)

        assert isinstance(renderer, vtk.vtkRenderer)
        self.ren = renderer
    
        # -------- add the beam ----
        # geometry
        self.beam = vtk.vtkCubeSource()
        self.beam.SetXLength(st.visBeamLength)
        self.beam.SetYLength(st.visBeamWidth)
        self.beam.SetZLength(st.visBeamDepth)

        # mapper
        self.beamMapper = vtk.vtkPolyDataMapper()
        self.beamMapper.SetInputConnection(self.beam.GetOutputPort())

        # actor
        self.beamActor = vtk.vtkLODActor()
        self.beamActor.SetMapper(self.beamMapper)

        # make it look nice
        self.beamProp = self.beamActor.GetProperty()
        self.beamProp.SetColor(101 / 255, 123 / 255, 131 / 255)

        self.ren.AddActor(self.beamActor)

        # -------- add the ball ----
        # geometry
        self.ball = vtk.vtkSphereSource()
        self.ball.SetRadius(st.visR)
        self.ball.SetThetaResolution(20)
        self.ball.SetPhiResolution(20)

        # mapper
        self.ballMapper = vtk.vtkPolyDataMapper()
        self.ballMapper.SetInputConnection(self.ball.GetOutputPort())

        # actor
        self.ballActor = vtk.vtkLODActor()
        self.ballActor.SetMapper(self.ballMapper)

        # make it look nice
        self.ballProp = self.ballActor.GetProperty()
        self.ballProp.SetColor(255 / 255, 255 / 255, 0)
        self.ballProp.SetAmbient(0.2)
        self.ballProp.SetDiffuse(0.8)
        self.ballProp.SetSpecular(0.5)
        self.ballProp.SetSpecularPower(0.5)

        self.ren.AddActor(self.ballActor)

        # add background
        self.ren.GradientBackgroundOn()
        self.ren.SetBackground(228 / 255, 232 / 255, 213 / 255)
        self.ren.SetBackground2(38 / 255, 139 / 255, 210 / 255)

        # get everybody into the frame
        self.ren.ResetCamera()
        self.ren.GetActiveCamera().Zoom(1.7)
开发者ID:cklb,项目名称:pymoskito,代码行数:60,代码来源:visualization.py


示例2: InitVTKMethods

	def InitVTKMethods(self):
		"""Initializes the VTK methods to be used."""
		self.colortable=ColorTableSource()
		self._plane=vtkPlane()
		self._cutter=vtkCutter()
		self._mapper=vtkDataSetMapper()
		self.actor=vtkLODActor()
开发者ID:danse-inelastic,项目名称:inelastic-svn,代码行数:7,代码来源:PlaneSource.py


示例3: LerSTL

    def LerSTL(self, path):
        mesh= vtk.vtkSTLReader()
        mesh.SetFileName(path)
        mesh.Update()

        #self.pd  = mesh.GetOutput()
        self.polydata  = mesh.GetOutput()

        normals = vtk.vtkPolyDataNormals()
        #normals.SetInput(polydata)
        normals.SetInputData(mesh.GetOutput())
        normals.ComputeCellNormalsOn()
        normals.Update()

        #mudanças para aumentar a normal
        

        self.vertices =pontos(normals.GetOutput())
        self.normalsp = get_normals(normals.GetOutput())

        

        stlMapper = vtk.vtkPolyDataMapper()
        stlMapper.SetInputConnection(normals.GetOutputPort())
        
        stlActor = vtk.vtkLODActor()
        stlActor.SetMapper(stlMapper)


        self.renderer.AddActor(stlActor)
        self.Interactor.Render()
开发者ID:jcdinis,项目名称:POMES,代码行数:31,代码来源:app.py


示例4: __init__

    def __init__(self, parent, visualizer, **kws):
        """
		Initialization
		"""
        self.init = False
        VisualizationModule.__init__(self, parent, visualizer, numberOfInputs=(2, 2), **kws)
        # self.name = "Surface Rendering"
        self.normals = vtk.vtkPolyDataNormals()
        self.smooth = None
        self.volumeModule = None
        self.scalarRange = (0, 255)
        for i in range(1, 3):
            self.setInputChannel(i, i)

        self.eventDesc = "Rendering iso-surface"
        self.decimate = vtk.vtkDecimatePro()
        self.mapper = vtk.vtkPolyDataMapper()
        self.mapper2 = vtk.vtkPolyDataMapper()

        self.contour = vtk.vtkMarchingCubes()
        self.contour2 = vtk.vtkDiscreteMarchingCubes()

        self.descs = {
            "Normals": "Smooth surface with normals",
            "FeatureAngle": "Feature angle of normals\n",
            "Simplify": "Simplify surface",
            "PreserveTopology": "Preserve topology",
            "Transparency": "Surface transparency",
            "Distance": "Distance to consider inside",
            "MarkColor": "Mark in/outside objects with colors",
        }

        self.actor = self.lodActor = vtk.vtkLODActor()
        self.lodActor.SetMapper(self.mapper)
        self.lodActor.SetNumberOfCloudPoints(10000)

        self.actor2 = vtk.vtkLODActor()
        self.actor2.SetMapper(self.mapper2)
        self.actor2.SetNumberOfCloudPoints(10000)
        self.renderer = self.parent.getRenderer()
        self.renderer.AddActor(self.lodActor)
        self.renderer.AddActor(self.actor2)

        lib.messenger.connect(None, "highlight_object", self.onHighlightObject)
开发者ID:chalkie666,项目名称:bioimagexd-svn-import-from-sourceforge,代码行数:44,代码来源:PolydataVisualization.py


示例5: __init__

    def __init__(self, parent=None, id=-1,
                 pos=wx.DefaultPosition,
                 title="3D Density"):
        VizFrame.__init__(self, parent, id, pos, title)
        self.widget = wxVTKRenderWindowInteractor(self,-1)
        style = vtk.vtkInteractorStyleTrackballCamera()
        self.widget.SetInteractorStyle(style)

        self.ren = vtk.vtkRenderer()
        self.ren.SetBackground(0.1, 0.1, 0.7)
        self.widget.GetRenderWindow().AddRenderer(self.ren)


        self.data = None
        self.colors = None
        
        # layout the frame
        self.box = wx.BoxSizer(wx.HORIZONTAL)
        self.leftPanel = wx.BoxSizer(wx.VERTICAL)
        self.SetSizer(self.box)
        self.box.Add(self.leftPanel,0, wx.EXPAND)
        self.box.Add(self.widget,1,wx.EXPAND)
        self.Layout()

        self.MenuBar = wx.MenuBar()
        self.FileMenu = wx.Menu()
        self.GateMenu = wx.Menu()
        self.MenuBar.Append(self.FileMenu, "File")
        self.MenuBar.Append(self.GateMenu, "Gating")
        self.SetMenuBar(self.MenuBar)
        export = self.FileMenu.Append(-1, "Export graphics")
        self.Bind(wx.EVT_MENU, self.OnExport, export)
        self.colorGate = self.GateMenu.Append(-1, "Gate on visible colors only")
        self.Bind(wx.EVT_MENU, self.GateByColor, self.colorGate)
        self.colorGate.Enable(False)
        gate = self.GateMenu.Append(-1, "Capture gated events")
        self.boxAddMenuItem = self.GateMenu.Append(-1, "Add box gate")
        self.GateMenu.AppendSeparator()
        self.boxes = []
        self.Bind(wx.EVT_MENU, self.OnBox, self.boxAddMenuItem)
        
        self.Bind(wx.EVT_MENU, self.Gate, gate)

        self.selectActor = vtk.vtkLODActor()
        self.planes = {} #vtk.vtkPlanes()
        self.clipper = vtk.vtkClipPolyData()
        
        self.boxCount = 1
        self.boxIds = {}

        self.Show()
        self.SendSizeEvent()
开发者ID:cliburn,项目名称:flow,代码行数:52,代码来源:Main.py


示例6: appendContextActor

    def appendContextActor(self, name, filename, color, customProps = dict()):
        """
        Add a context actor (actor with a name) loaded from a file to the
        scene.

        @param name: the name of the actor
        @type name: str

        @param filename: path to a file containing the actor
        @type filename: str

        @param color: the requested colour of the actor
        @type color: (float, float, float)

        @param customProps: C{dict}
        @type  customProps: dictionary storing additional properties to be applied to
                       the actor (opacity, diffuse color, etc.)

        @note: the method DOES NOT trigger the scene to render
        """

        # If if actor with given name already exists,
        # remove it
        if self.hasContextActor(name):
            self.removeContextActor(name)

        # Read the vtkPolyData file from the disk
        # and load it into render window trough the mapper
        reader = vtk.vtkPolyDataReader()
        reader.SetFileName(filename)

        mapMesh = vtk.vtkPolyDataMapper()
        mapMesh.SetInputConnection(reader.GetOutputPort())

        meshActor = vtk.vtkLODActor()
        meshActor.SetMapper(mapMesh)
        meshActor.GetProperty().SetColor(color)

        print customProps
        # Apply additional setting as given by customProps
        for (k,v) in customProps.items():
            # Apply the property depending on its type:
            if v:
                getattr(meshActor.GetProperty(), k)(v)
            else:
                getattr(meshActor.GetProperty(), k)()

        # Create reference for the appended actor
        self.__contextActors[name] = meshActor
        self.renderer.AddActor(meshActor)
开发者ID:baishi,项目名称:3dbar,代码行数:50,代码来源:barreconstructor.py


示例7: addGrid

    def addGrid(self, grid):
        nx, ny, nz = grid.shape[1:]

        self.display.append(True)

        self.grids.append(vtk.vtkStructuredGrid())

        self.grids[-1].SetExtent(0, nz-1, 0, ny-1, 0, nx-1)
        p = vtk.vtkPoints()

        shp = grid.shape
        grid.shape = (3, nx*ny*nz)
        p.SetData(vtknp.numpy_to_vtk(np.ascontiguousarray(grid.T), deep=True, array_type=vtknp.get_vtk_array_type(grid.dtype)))
        grid.shape = shp
        self.grids[-1].SetPoints(p)

        #Couleur
        color = np.random.rand(3)
        #Create a vtkOutlineFilter to draw the bounding box of the data set.
        ol = vtk.vtkOutlineFilter()
        if (vtk.vtkVersion().GetVTKMajorVersion()>=6):
          ol.SetInputData(self.grids[-1])
        else:
          ol.SetInput(self.grids[-1])      
        olm = vtk.vtkPolyDataMapper()
        olm.SetInputConnection(ol.GetOutputPort())
        ola = vtk.vtkActor()
        ola.SetMapper(olm)
        ola.GetProperty().SetColor(color)

        s=vtk.vtkShrinkFilter()
        if (vtk.vtkVersion().GetVTKMajorVersion()>=6):
          s.SetInputData(self.grids[-1])
        else:
          s.SetInput(self.grids[-1])      
        s.SetShrinkFactor(0.8)
        #
        mapper = vtk.vtkDataSetMapper()
        #map.SetInputData(data)
        mapper.SetInputConnection(s.GetOutputPort())
        act = vtk.vtkLODActor()
        act.SetMapper(mapper)
        #act.GetProperty().SetRepresentationToWireframe()
        #act.GetProperty().SetRepresentationToPoints()	
        act.GetProperty().SetColor(color)
        act.GetProperty().SetEdgeColor(color)
        act.GetProperty().EdgeVisibilityOff()	
        self.actors.append(act)
        self.setBounds()
        self.ren.SetActiveCamera(self.cam)
开发者ID:gouarin,项目名称:python_azur,代码行数:50,代码来源:vtkPlot.py


示例8: lineActor

    def lineActor(self,obj):
        """
        Returns an object of type vtkLODActor for rendering within a VTK 
        pipeline
        """
        me  = vtk.vtkPolyData()
        pts = vtk.vtkPoints()
        cts = vtk.vtkCellArray()
            
        for n in range(len(obj.points)):
            pts.InsertPoint(n,obj.points[n][0],
                              obj.points[n][1],
                              obj.points[n][2])
            
        for n in range(1,len(obj.points)):
            cts.InsertNextCell(2)
            cts.InsertCellPoint(n-1)
            cts.InsertCellPoint(n)
              
        me.SetPoints(pts)
        me.SetLines(cts)
                          
        dataMapper = vtk.vtkPolyDataMapper()
        dataMapper.SetInputData(me)

        dataActor =vtk.vtkLODActor()
        dataActor.SetMapper(dataMapper)
        
        if obj.color is not None:
            if np.size(obj.color) == 3:
                dataActor.GetProperty().SetColor(obj.color[0],
                                                 obj.color[1],
                                                 obj.color[2])
            else:
                carray = vtk.vtkUnsignedCharArray()
                carray.SetNumberOfComponents(3)
                carray.SetName("Colors")
                color = (obj.color*255).astype(int)
                for c in color:
                    carray.InsertNextTupleValue(c)
                me.GetCellData().SetScalars(carray)

        if obj.opacity is not None:
            dataActor.GetProperty().SetOpacity(obj.opacity)
            
        if obj.width is not None:
            dataActor.GetProperty().SetLineWidth(obj.width)
            
        return dataActor
开发者ID:rmaiko,项目名称:pyvsim,代码行数:49,代码来源:System.py


示例9: __createMainActor

    def __createMainActor(self):
        """
        If no main actor (C{self.L{__mainActor} == None}) create it from the
        volume C{self.L{__sourceVolume}} (if exists). The colour of main actor
        is given by C{self.L{__mainActorCol}}
        """
        if self.__mainActor == None and self.__sourceVolume != None:
            ct = self.__mainActorCol
            vtksource = self.__finalPipeline.execute(self.vtkMesh)

            self.__mainActor = vtk.vtkLODActor()
            self.__mainActor.SetMapper(vtksource)
            self.__mainActor.GetProperty().SetColor(ct[0],ct[1],ct[2])

            self.renderer.AddActor(self.__mainActor)
开发者ID:baishi,项目名称:3dbar,代码行数:15,代码来源:barreconstructor.py


示例10: makeVTKLODActor

	def makeVTKLODActor(vtkObj,clipper):
		"""Make LOD vtk Actor"""
		selectMapper = vtk.vtkDataSetMapper()
		selectMapper.SetInputConnection(clipper.GetOutputPort())
		selectMapper.SetScalarVisibility(1)
		selectMapper.SetColorModeToMapScalars()
		selectMapper.SetScalarModeToUseCellData()
		selectMapper.SetScalarRange(clipper.GetInputDataObject(0,0).GetCellData().GetArray(0).GetRange())

		selectActor = vtk.vtkLODActor()
		selectActor.SetMapper(selectMapper)
		selectActor.GetProperty().SetEdgeColor(1,0.5,0)
		selectActor.GetProperty().SetEdgeVisibility(0)
		selectActor.VisibilityOn()
		selectActor.SetScale(1.01, 1.01, 1.01)
		return selectActor
开发者ID:simpeg,项目名称:simpegviz,代码行数:16,代码来源:vtkTools.py


示例11: polyActor

 def polyActor(self,obj): 
     """
     Returns an object of type vtkLODActor for rendering within a VTK 
     pipeline
     """
     actor   = vtk.vtkPolyData()
     pts     = vtk.vtkPoints()
     cts     = vtk.vtkCellArray()
         
     for n in range(len(obj.points)):
         pts.InsertPoint(n,obj.points[n,0], 
                           obj.points[n,1],
                           obj.points[n,2])
        
     for n in range(len(obj.connectivity)):
         cts.InsertNextCell(3)
         for node in obj.connectivity[n]:
             cts.InsertCellPoint(node) 
             
     actor.SetPoints(pts)
     actor.SetPolys(cts)
     
     # If the normals of the object are specified (smooth object), this is
     # rendered as such
     if obj.normals is not None:
         nrm = vtk.vtkDoubleArray()
         nrm.SetNumberOfComponents(3)
         nrm.SetNumberOfTuples(len(obj.points))
         for n in range(len(obj.points)):
             nrm.SetTuple(n,obj.normals[n].tolist())
         actor.GetPointData().SetNormals(nrm)
         
     dataMapper = vtk.vtkPolyDataMapper()
     dataMapper.SetInputData(actor)
     
     dataActor =vtk.vtkLODActor()
     dataActor.SetMapper(dataMapper)
     
     if obj.color is not None:
         dataActor.GetProperty().SetColor(obj.color[0],
                                          obj.color[1],
                                          obj.color[2])
     if obj.opacity is not None:
         dataActor.GetProperty().SetOpacity(obj.opacity)
         
     return dataActor
开发者ID:rmaiko,项目名称:pyvsim,代码行数:46,代码来源:System.py


示例12: __init__

    def __init__(self, parent, visualizer, **kws):
        """
		Initialization
		"""
        VisualizationModule.__init__(self, parent, visualizer, **kws)
        # self.name = "Surface Rendering"
        # for i in range(1, 3):
        # 	self.setInputChannel(i, i)
        self.normals = vtk.vtkPolyDataNormals()
        self.smooth = None
        self.volumeModule = None
        self.scalarRange = (0, 255)

        self.eventDesc = "Rendering iso-surface"
        self.decimate = vtk.vtkDecimatePro()
        self.setMethod(1)
        self.init = 0
        self.mapper = vtk.vtkPolyDataMapper()

        self.descs = {
            "Method": "Surface rendering method",
            "Gaussian": "Smooth surface with gaussian smoothing",
            "Normals": "Smooth surface with normals",
            "FeatureAngle": "Feature angle of normals\n",
            "Simplify": "Simplify surface",
            "PreserveTopology": "Preserve topology",
            "IsoValue": "Iso value",
            "SurfaceRangeBegin": "Generate surfaces in range:\n",
            "SurfaceAmnt": "Number of surfaces",
            "Transparency": "Surface transparency",
            "MultipleSurfaces": "Visualize multiple surfaces",
            "SolidColor": "Color surface with max. intensity",
        }

        self.actor = self.lodActor = vtk.vtkLODActor()
        self.lodActor.SetMapper(self.mapper)
        self.lodActor.SetNumberOfCloudPoints(10000)
        self.renderer = self.parent.getRenderer()
        self.renderer.AddActor(self.lodActor)
        # self.updateRendering()
        self.filterDesc = "Create and visualize iso-surface"
开发者ID:chalkie666,项目名称:bioimagexd-svn-import-from-sourceforge,代码行数:41,代码来源:NewSurface.py


示例13: initPlaneWidget

	def initPlaneWidget(self):
		
		"""Sets up vtkImplicitPlaneWidget for plane selection.
		
		Sets also up necessary actor and mapper.
		
		Returns:
			vtk.vtkImplicitPlaneWidget: Widget.
		
		"""
		
		# Initialize a plane widget
		self.planeWidget = vtk.vtkImplicitPlaneWidget()
		self.planeWidget.SetInteractor(self.iren)
		self.planeWidget.SetPlaceFactor(1.25)
		self.planeWidget.SetInput(self.grid)
		self.planeWidget.PlaceWidget()
		
		# Callback connection of interaction event
		self.planeWidget.AddObserver("InteractionEvent", self.StartPlaneCallback)
		self.planeWidget.AddObserver("EndInteractionEvent",self.EndPlaneCallback)
		
		# Mapper
		self.selectMapper = vtk.vtkDataSetMapper()
		self.selectMapper.SetInput(self.grid)
		
		# Actor
		self.selectActor = vtk.vtkLODActor()
		self.selectActor.SetMapper(self.selectMapper)
		self.selectActor.GetProperty().SetColor(0, 1, 0)
		self.selectActor.VisibilityOff()
		self.selectActor.SetScale(1.01, 1.01, 1.01)
		
		self.ren.AddActor(self.selectActor)
		
		# Place widget at right position
		self.planeWidget.SetNormal(0,0,1)
		self.planeWidget.SetOrigin(self.grid.GetCenter())
		
		
		return self.planeWidget
开发者ID:alexblaessle,项目名称:PyFRAP,代码行数:41,代码来源:pyfrp_gui_vtk.py


示例14: show

def show(vtkObject, w=512, h=512):
    """
    Show result of pipeline.

    :param vtkObject: anything VTK
    :param w: window width
    :param h: window height

    :type vtkObject: None
    :type w: int
    :type h: int

    >>> image_data = create_image_data_from_array(surf)
    >>> cubes = filter_marching_cubes(image_data)
    >>> show(cubes)
    """
    mapper = vtk.vtkPolyDataMapper()

    try:
        mapper.SetInputConnection(vtkObject.GetOutputPort())
    except AttributeError:
        mapper.SetInput(vtkObject)

    actor = vtk.vtkLODActor()
    actor.SetMapper(mapper)

    renderer = vtk.vtkRenderer()
    renderer.AddActor(actor)

    window = vtk.vtkRenderWindow()
    window.AddRenderer(renderer)
    window.SetSize(w, h)

    interactor = vtk.vtkRenderWindowInteractor()
    interactor.SetRenderWindow(window)

    interactor.Initialize()
    window.Render()
    interactor.Start()
开发者ID:JoshuaSBrown,项目名称:langmuir,代码行数:39,代码来源:vtkutils.py


示例15: pointsActor

 def pointsActor(self, obj):
     npts = np.size(obj.points, 0)
      
     vertices = vtk.vtkCellArray()
     ptsource = vtk.vtkPoints()
     
     ptsource.SetNumberOfPoints(npts)
     
     for n,p in enumerate(obj.points):
         ptsource.SetPoint(n,p)
         vertices.InsertNextCell(1)
         vertices.InsertCellPoint(n)
         
     point = vtk.vtkPolyData()
     point.SetPoints(ptsource)
     point.SetVerts(vertices)   
     
     mapper = vtk.vtkPolyDataMapper()
     mapper.SetInputData(point) 
     
     actor = vtk.vtkLODActor()
     actor.SetMapper(mapper)
     actor.GetProperty().SetPointSize(1)
     return actor
开发者ID:rmaiko,项目名称:pyvsim,代码行数:24,代码来源:System.py


示例16:

Sphere0.SetStartPhi(0)
Sphere0.SetEndPhi(180)
Glyph0 = vtk.vtkGlyph3D()
Glyph0.SetInputConnection(pdb0.GetOutputPort())
Glyph0.SetOrient(1)
Glyph0.SetColorMode(1)
#Glyph0 ScalingOn
Glyph0.SetScaleMode(2)
Glyph0.SetScaleFactor(.25)
Glyph0.SetSourceConnection(Sphere0.GetOutputPort())
Mapper5 = vtk.vtkPolyDataMapper()
Mapper5.SetInputConnection(Glyph0.GetOutputPort())
Mapper5.UseLookupTableScalarRangeOff()
Mapper5.SetScalarVisibility(1)
Mapper5.SetScalarModeToDefault()
Actor5 = vtk.vtkLODActor()
Actor5.SetMapper(Mapper5)
Actor5.GetProperty().SetRepresentationToSurface()
Actor5.GetProperty().SetInterpolationToGouraud()
Actor5.GetProperty().SetAmbient(0.15)
Actor5.GetProperty().SetDiffuse(0.85)
Actor5.GetProperty().SetSpecular(0.1)
Actor5.GetProperty().SetSpecularPower(100)
Actor5.GetProperty().SetSpecularColor(1,1,1)
Actor5.GetProperty().SetColor(1,1,1)
Actor5.SetNumberOfCloudPoints(30000)
ren1.AddActor(Actor5)
Tuber0 = vtk.vtkTubeFilter()
Tuber0.SetInputConnection(pdb0.GetOutputPort())
Tuber0.SetNumberOfSides(8)
Tuber0.SetCapping(0)
开发者ID:ElsevierSoftwareX,项目名称:SOFTX-D-15-00004,代码行数:31,代码来源:TestXYZMol.py


示例17:

iso.SetValue(0, .24)

normals = vtk.vtkPolyDataNormals()
normals.SetInputConnection(iso.GetOutputPort())
normals.SetFeatureAngle(45)

# We indicate to the mapper to use the velcoity magnitude, which is a
# vtkDataArray that makes up part of the point attribute data.
isoMapper = vtk.vtkPolyDataMapper()
isoMapper.SetInputConnection(normals.GetOutputPort())
isoMapper.ScalarVisibilityOn()
isoMapper.SetScalarRange(0, 1500)
isoMapper.SetScalarModeToUsePointFieldData()
isoMapper.ColorByArrayComponent("VelocityMagnitude", 0)

isoActor = vtk.vtkLODActor()
isoActor.SetMapper(isoMapper)
isoActor.SetNumberOfCloudPoints(1000)

outline = vtk.vtkStructuredGridOutlineFilter()
outline.SetInputData(pl3d_output)
outlineMapper = vtk.vtkPolyDataMapper()
outlineMapper.SetInputConnection(outline.GetOutputPort())
outlineActor = vtk.vtkActor()
outlineActor.SetMapper(outlineMapper)

# Create the usual rendering stuff.
ren = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
iren = vtk.vtkRenderWindowInteractor()
开发者ID:0004c,项目名称:VTK,代码行数:31,代码来源:ColorIsosurface.py


示例18:

loop = vtk.vtkSelectPolyData()
loop.SetInputConnection(sphere.GetOutputPort())
loop.SetLoop(selectionPoints)
loop.GenerateSelectionScalarsOn()
# negative scalars inside
loop.SetSelectionModeToSmallestRegion()

# clips out positive region
clip = vtk.vtkClipPolyData()
clip.SetInputConnection(loop.GetOutputPort())

clipMapper = vtk.vtkPolyDataMapper()
clipMapper.SetInputConnection(clip.GetOutputPort())

clipActor = vtk.vtkLODActor()
clipActor.SetMapper(clipMapper)

loop2 = vtk.vtkSelectPolyData()
loop2.SetInputConnection(sphere.GetOutputPort())
loop2.SetLoop(selectionPoints)
loop2.SetSelectionModeToSmallestRegion()

selectMapper = vtk.vtkPolyDataMapper()
selectMapper.SetInputConnection(loop2.GetOutputPort())

selectActor = vtk.vtkLODActor()
selectActor.SetMapper(selectMapper)
selectActor.AddPosition(1, 0, 0)
selectActor.GetProperty().SetColor(GetRGBColor('peacock'))
开发者ID:0004c,项目名称:VTK,代码行数:29,代码来源:cutLoop.py


示例19:

glyph.SetInputConnection(sphere.GetOutputPort())
glyph.SetSourceConnection(cone.GetOutputPort())
glyph.SetVectorModeToUseNormal()
glyph.SetScaleModeToScaleByVector()
glyph.SetScaleFactor(0.25)

# The sphere and spikes are appended into a single polydata.
# This just makes things simpler to manage.
apd = vtk.vtkAppendPolyData()
apd.AddInputConnection(glyph.GetOutputPort())
apd.AddInputConnection(sphere.GetOutputPort())

maceMapper = vtk.vtkPolyDataMapper()
maceMapper.SetInputConnection(apd.GetOutputPort())

maceActor = vtk.vtkLODActor()
maceActor.SetMapper(maceMapper)
maceActor.VisibilityOn()

# This portion of the code clips the mace with the vtkPlanes
# implicit function. The clipped region is colored green.
plane = vtk.vtkPlane()
clipper = vtk.vtkClipPolyData()
clipper.SetInputConnection(apd.GetOutputPort())
clipper.SetClipFunction(plane)
clipper.InsideOutOn()

selectMapper = vtk.vtkPolyDataMapper()
selectMapper.SetInputConnection(clipper.GetOutputPort())

selectActor = vtk.vtkLODActor()
开发者ID:0004c,项目名称:VTK,代码行数:31,代码来源:ImplicitPlaneWidget.py


示例20:

# Here we add a filter that computes surface normals from the geometry.
shrink = vtk.vtkShrinkPolyData()
shrink.SetInputConnection(part.GetOutputPort())
shrink.SetShrinkFactor(0.85)

# The mapper is responsible for pushing the geometry into the graphics
# library. It may also do color mapping, if scalars or other
# attributes are defined.
partMapper = vtk.vtkPolyDataMapper()
partMapper.SetInputConnection(shrink.GetOutputPort())

# The LOD actor is a special type of actor. It will change appearance
# in order to render faster. At the highest resolution, it renders
# ewverything just like an actor. The middle level is a point cloud,
# and the lowest level is a simple bounding box.
partActor = vtk.vtkLODActor()
partActor.SetMapper(partMapper)
partActor.GetProperty().SetColor(light_grey)
partActor.RotateX(30.0)
partActor.RotateY(-45.0)

# Create the graphics structure. The renderer renders into the
# render window. The render window interactor captures mouse events
# and will perform appropriate camera or actor manipulation
# depending on the nature of the events.
ren = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
开发者ID:weitaoli-echuang,项目名称:vtkExamplePython,代码行数:30,代码来源:FilterCADPart.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python vtk.vtkLabeledDataMapper函数代码示例发布时间:2022-05-26
下一篇:
Python vtk.vtkJPEGWriter函数代码示例发布时间: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