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


Python vtk.vtkPolyDataMapper函数代码示例

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


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

示例1: __init__

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

		self.descs = {"TrackFile": "Tracks file", #"AllTracks": "Show all tracks", \
					"MinLength": "Min. length of track (# of timepoints)",
					"SphereRadius": "Sphere radius",
					"TubeRadius": "Tube radius",
					"SameStartingPoint": "Visualize tracks starting from same point"}
		
		self.showTracks = []
			
		self.lineMapper = vtk.vtkPolyDataMapper()
		self.sphereMapper = vtk.vtkPolyDataMapper()
		self.firstMapper = vtk.vtkPolyDataMapper()
		self.lastMapper = vtk.vtkPolyDataMapper()
		self.currentMapper = vtk.vtkPolyDataMapper()
		self.actors = []
		self.renderer = self.parent.getRenderer()

        #iactor = self.wxrenwin.GetRenderWindow().GetInteractor()
		lib.messenger.connect(None, "visualize_tracks", self.onVisualizeTracks)
		self.filterDesc = "Visualize created motion tracks"
开发者ID:chalkie666,项目名称:bioimagexd-svn-import-from-sourceforge,代码行数:25,代码来源:VisualizeTrack.py

示例2: _MakeActors

    def _MakeActors(self):

        actors = []

        # lines
        for i in range(3):
            mapper = vtk.vtkPolyDataMapper()
            mapper.SetInputConnection(self._Cutters[i].GetOutputPort())
            actor = self._NewActor()
            actor.SetProperty(self._Properties[i])
            actor.SetMapper(mapper)
            actor.PickableOff()
            actors.append(actor)
        # use index to track actors in different renderers
        self._LineActorsIndex = (0, 1, 2)

        # cones
        for i in range(6):
            mapper = vtk.vtkPolyDataMapper()
            mapper.SetInputConnection(self._Cones[i].GetOutputPort())
            actor = self._NewActor()
            actor.SetProperty(self._ConeProperties[i / 2])
            actor.SetMapper(mapper)
            actor.PickableOff()
            actors.append(actor)
        self._ConeActorsIndex = (3, 4, 5, 6, 7, 8)

        return actors
开发者ID:parallaxinnovations,项目名称:vtkEVS,代码行数:28,代码来源:OrthoPlanesIntersectionsFactory.py

示例3: _MakeActors

    def _MakeActors(self):
        actors = []
        # 4 corners
        for i in range(4):
            mapper = vtk.vtkPolyDataMapper()
            mapper.SetInput(self._Corners[i].GetOutput())
            actor = self._NewActor()
            actor.SetProperty(self._CornerProperty)
            actor.SetMapper(mapper)
            actors.append(actor)

        # center
        mapper = vtk.vtkPolyDataMapper()
        mapper.SetInput(self._Center.GetOutput())
        actor = self._NewActor()
        actor.SetProperty(self._CenterProperty)
        actor.SetMapper(mapper)
        actors.append(actor)

        # rectangle roi
        mapper = vtk.vtkPolyDataMapper()
        mapper.SetInput(self._ROI.GetOutput())
        actor = self._NewActor()
        actor.SetProperty(self._ROIProperty)
        actor.SetMapper(mapper)
        actor.PickableOff()
        actors.append(actor)

        return actors
开发者ID:parallaxinnovations,项目名称:vtkEVS,代码行数:29,代码来源:RectROIFactory.py

示例4: plotvtk

def plotvtk(mesh,boundary):
    meshMapper = vtk.vtkPolyDataMapper()
    meshMapper.SetInputConnection(mesh.GetOutputPort())

    meshActor = vtk.vtkActor()
    meshActor.SetMapper(meshMapper)
    meshActor.GetProperty().SetEdgeColor(0, 0, 1)
    meshActor.GetProperty().SetInterpolationToFlat()
    meshActor.GetProperty().SetRepresentationToWireframe()

    boundaryMapper = vtk.vtkPolyDataMapper()
    if vtk.VTK_MAJOR_VERSION <= 5:
        boundaryMapper.SetInputConnection(boundary.GetProducerPort())
    else:
        boundaryMapper.SetInputData(boundary)

    boundaryActor = vtk.vtkActor()
    boundaryActor.SetMapper(boundaryMapper)
    boundaryActor.GetProperty().SetColor(1, 0, 0)

    renderer = vtk.vtkRenderer()
    renderWindow = vtk.vtkRenderWindow()
    renderWindow.AddRenderer(renderer)
    renderWindowInteractor = vtk.vtkRenderWindowInteractor()
    renderWindowInteractor.SetRenderWindow(renderWindow)
    renderer.AddActor(meshActor)
    renderer.AddActor(boundaryActor)
    renderer.SetBackground(.3, .6, .3)

    renderWindowInteractor.Initialize()
    renderWindow.Render()
    renderWindowInteractor.Start()
开发者ID:remiboulardot,项目名称:afmmesh,代码行数:32,代码来源:afmmesher.py

示例5: test

def test(points, springs1, springs2):
    app = QApplication(sys.argv)
    window = Viewer3D.SimpleView()

    polydata1 = GeneratePolydata.generateLinePolydata(points, springs1)
    polydata2 = GeneratePolydata.generateLinePolydata(points, springs2)

    mapper1 = vtk.vtkPolyDataMapper()
    mapper1.SetInputData(polydata1)
    actor1 = vtk.vtkActor()
    actor1.SetMapper(mapper1)

    mapper2 = vtk.vtkPolyDataMapper()
    mapper2.SetInputData(polydata2)
    actor2 = vtk.vtkActor()
    actor2.SetMapper(mapper2)

    actor1.GetProperty().SetColor(1,0,0)
    actor2.GetProperty().SetColor(0,1,0.5)

    window.ren.AddActor(actor1)
    window.ren.AddActor(actor2)

    window.start(app)
    return
开发者ID:wzaylor,项目名称:Classwork,代码行数:25,代码来源:meshGen.py

示例6: main

    def main(self):
        print("main builder")
        window = self.widget.GetRenderWindow()
        window.AddRenderer(self.rend)

        self.addGeometry()
        self.addAltGeometry()
        self.buildLookupTable()
        #self.startWireframeLight()
        self.createTriAxes()

        textSize = 14 * self.magnify
        self.createText([5, 50], 'Max  ', textSize)  # text actor 0
        self.createText([5, 35], 'Min  ', textSize)  # text actor 1
        self.createText([5, 20], 'Word1', textSize)  # text actor 2
        self.createText([5, 5], 'Word2', textSize)  # text actor 3
        #self.createText([5,35],'Yet Again',  textSize)

        # Create the usual rendering stuff.
        self.get_edges()
        if self.is_edges:
            prop = self.edgeActor.GetProperty()
            prop.EdgeVisibilityOn()
        else:
            prop = self.edgeActor.GetProperty()
            prop.EdgeVisibilityOff()

        self.rend.GetActiveCamera().ParallelProjectionOn()
        self.rend.SetBackground(.1, .2, .4)
        vtk.vtkPolyDataMapper().SetResolveCoincidentTopologyToPolygonOffset()
        self.rend.ResetCamera()
开发者ID:sukhbinder,项目名称:cyNastran,代码行数:31,代码来源:pan.py

示例7: render_image

def render_image(pointset):
    delaunay = vtk.vtkDelaunay2D()
    delaunay.SetTolerance(0.001)
    delaunay.SetAlpha(18)
    delaunay.SetInput(pointset);
    delaunay.Update();
 
    meshMapper = vtk.vtkPolyDataMapper()
    meshMapper.SetInput(delaunay.GetOutput())
    meshMapper.SetScalarRange(0,255)
 
    meshActor = vtk.vtkActor()
    meshActor.SetMapper(meshMapper)
 
    boundaryMapper = vtk.vtkPolyDataMapper()
    boundaryMapper.SetInput(delaunay.GetOutput())
 
    boundaryActor = vtk.vtkActor()
    boundaryActor.SetMapper(boundaryMapper);
    boundaryActor.GetProperty().SetColor(0,0.55,0);
 
    renderer = vtk.vtkRenderer()
    renderWindow = vtk.vtkRenderWindow()
    renderWindow.AddRenderer(renderer)
    renderWindowInteractor = vtk.vtkRenderWindowInteractor()
    renderWindowInteractor.SetRenderWindow(renderWindow)
    renderer.AddActor(meshActor)
    renderer.AddActor(boundaryActor)
    renderer.SetBackground(.5, .5, .5)

    renderWindow.SetSize(600, 600) 
    renderWindow.Render()
    renderWindowInteractor.Start()
开发者ID:arun04ceg,项目名称:2D-spatial-data,代码行数:33,代码来源:height_fields_thorax.py

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

示例9: __init__

    def __init__(self):
        # Central dot
        self.dot = vtk.vtkSphereSource()
        self.dot.SetThetaResolution(20)
        self.dot.SetRadius(.5)
        self.dotMapper = vtk.vtkPolyDataMapper()
        self.dotMapper.SetInputConnection(self.dot.GetOutputPort())
        self.dotActor = vtk.vtkActor()
        self.dotActor.SetMapper(self.dotMapper)
        
        # Circular halo around dot
        self.halo = vtk.vtkSphereSource()
        self.halo.SetThetaResolution(20)
        self.halo.SetRadius(2)
        self.haloMapper = vtk.vtkPolyDataMapper()
        self.haloMapper.SetInputConnection(self.halo.GetOutputPort())
        self.haloActor = vtk.vtkActor()
        self.haloActor.SetMapper(self.haloMapper)
        
        self.dotActor.GetProperty().SetColor(red)
        self.haloActor.GetProperty().SetColor(white)
        self.haloActor.GetProperty().SetOpacity(0.1)
        self.haloActor.GetProperty().SetSpecular(0.6)

        self.actor = vtk.vtkAssembly()
        self.actor.AddPart(self.dotActor)
        self.actor.AddPart(self.haloActor)
开发者ID:cmcantalupo,项目名称:libra,代码行数:27,代码来源:vtkutils.py

示例10: addPoints

    def addPoints(self, points, color, thick=False, thickness=_DEFAULT_POINT_THICKNESS):
        vtkPoints = vtk.vtkPoints()
        for point in points:
            vtkPoints.InsertNextPoint(point[0], point[1], point[2])

        pointsPolyData = vtk.vtkPolyData()
        pointsPolyData.SetPoints(vtkPoints)

        if thick:
            sphereSource = vtk.vtkSphereSource()
            sphereSource.SetRadius(thickness)
            
            glyph3D = vtk.vtkGlyph3D()
            glyph3D.SetSourceConnection(sphereSource.GetOutputPort())
            glyph3D.SetInputData(pointsPolyData)
            glyph3D.Update()
 
            mapper = vtk.vtkPolyDataMapper()
            mapper.SetInputConnection(glyph3D.GetOutputPort())
        else:
            vertexFilter = vtk.vtkVertexGlyphFilter()
            vertexFilter.SetInputData(pointsPolyData)
            vertexFilter.Update()                          

            mapper = vtk.vtkPolyDataMapper()
            mapper.SetInputData(vertexFilter.GetOutput())

        actor = vtk.vtkActor()
        actor.SetMapper(mapper)
        actor.GetProperty().SetColor(color)

        self._rendererScene.AddActor(actor)
开发者ID:trianam,项目名称:voropath,代码行数:32,代码来源:plotter.py

示例11: plotContinents

 def plotContinents(self,x1,x2,y1,y2,projection,wrap,tmpl):
     contData = vcs2vtk.prepContinents(self.canvas._continents)
     contMapper = vtk.vtkPolyDataMapper()
     contMapper.SetInputData(contData)
     contActor = vtk.vtkActor()
     contActor.SetMapper(contMapper)
     contActor.GetProperty().SetColor(0.,0.,0.)
     contActor = vcs2vtk.doWrap(contActor,[x1,x2,y1,y2],wrap)
     if projection.type!="linear":
         contData=contActor.GetMapper().GetInput()
         cpts = contData.GetPoints()
         geo, gcpts = vcs2vtk.project(cpts,projection,[x1,x2,y1,y2])
         contData.SetPoints(gcpts)
         contMapper = vtk.vtkPolyDataMapper()
         contMapper.SetInputData(contData)
         contActor = vtk.vtkActor()
         contActor.SetMapper(contMapper)
         contActor.GetProperty().SetColor(0.,0.,0.)
     else:
         geo=None
     ren = vtk.vtkRenderer()
     self.renWin.AddRenderer(ren)
     self.setLayer(ren,tmpl.data.priority)
     vcs2vtk.fitToViewport(contActor,ren,[tmpl.data.x1,tmpl.data.x2,tmpl.data.y1,tmpl.data.y2],wc=[x1,x2,y1,y2],geo=geo)
     if tmpl.data.priority!=0:
       ren.AddActor(contActor)
开发者ID:arulalant,项目名称:uvcdat,代码行数:26,代码来源:VTKPlots.py

示例12: __init__

    def __init__(self, reader):
        self.reader = reader
        sg = self.src_glyph = vtk.vtkSphereSource()
        sg.SetRadius(0.5)
        sg.SetCenter(0.5, 0.0, 0.0)
        g = self.glyph = vtk.vtkTensorGlyph()        
        g.SetInputConnection(self.reader.GetOutputPort())
        g.SetSource(self.src_glyph.GetOutput())
        g.SetScaleFactor(0.25)
        
        # The normals are needed to generate the right colors and if
        # not used some of the glyphs are black.        
        self.normals = vtk.vtkPolyDataNormals()
        self.normals.SetInputConnection(g.GetOutputPort())
        self.map = vtk.vtkPolyDataMapper()
        self.map.SetInputConnection(self.normals.GetOutputPort())        
        self.act = vtk.vtkActor()
        self.act.SetMapper(self.map)

        # An outline.
        self.of = vtk.vtkOutlineFilter()
        self.of.SetInputConnection(self.reader.GetOutputPort())
        self.out_map = vtk.vtkPolyDataMapper()
        self.out_map.SetInputConnection(self.of.GetOutputPort())
        self.out_act = vtk.vtkActor()
        self.out_act.SetMapper(self.out_map)        
开发者ID:Armand0s,项目名称:homemade_vtk,代码行数:26,代码来源:TestTensorGlyph.py

示例13: add_edge

 def add_edge(self, start, end, colour=Colours.BASE0):
     """Appends an edge to the edges list."""
     # Line
     line = vtkLineSource()
     line.SetPoint1(start)
     line.SetPoint2(end)
     # Line Mapper
     line_mapper = vtkPolyDataMapper()
     line_mapper.SetInputConnection(line.GetOutputPort())
     self.edge_colours.append(colour)
     self.line_mappers.append(line_mapper)
     # Bar
     bar = vtkTubeFilter()
     bar.SetInputConnection(line.GetOutputPort())
     bar.SetRadius(2.5)
     self.bar_data.append(bar)
     # Bar Mapper
     # Tried this, but mapping the ribbon caused beaucoup errors,
     # debugging would take a week.There must be some kind of way
     # out of here.
     # Said the joker to the thief
     # There's too much confusion
     # I can't get no relief
     # No reason to get excited, the thief he kindly spoke
     # But you and I have been through that
     # And this is not our fate
     # So let us not talk falsely now, the hour is getting late.
     # (2011-08-12)
     bar_mapper = vtkPolyDataMapper()
     bar_mapper.SetInputConnection(bar.GetOutputPort())
     self.bar_mappers.append(bar_mapper)
开发者ID:TomRegan,项目名称:synedoche,代码行数:31,代码来源:Graphics.py

示例14: addCube

    def addCube(self,pos,tam,img=False):
        jpegfile = "struct.jpg"
        
        # Read the image data from a file
        reader = vtk.vtkJPEGReader()
        reader.SetFileName(jpegfile)
         
        (x,y,z) = pos
        (i,j,k) = tam

        cubito = vtk.vtkCubeSource()
        cubito.SetXLength(0.2*i)
        cubito.SetYLength(0.2*j)
        cubito.SetZLength(0.2*k)
        cubito.SetCenter((x,y,z)) 
        if img == True:
            
            # Create texture object
            texture = vtk.vtkTexture()
            if vtk.VTK_MAJOR_VERSION <= 5:
                texture.SetInput(reader.GetOutput())
            else:
                texture.SetInputConnection(reader.GetOutputPort())
            # Map texture coordinates
            map_to_sphere = vtk.vtkTextureMapToPlane()
            if vtk.VTK_MAJOR_VERSION <= 5:
                map_to_sphere.SetInput(cubito.GetOutput())
            else:
                map_to_sphere.SetInputConnection(cubito.GetOutputPort())
            #map_to_sphere.PreventSeamOn()
             
            # Create mapper and set the mapped texture as input
            mapper = vtk.vtkPolyDataMapper()
            if vtk.VTK_MAJOR_VERSION <= 5:
                mapper.SetInput(map_to_sphere.GetOutput())
            else:
                mapper.SetInputConnection(map_to_sphere.GetOutputPort())
            
        

        planeMapper = vtk.vtkPolyDataMapper()
        planeMapper.SetInputConnection(cubito.GetOutputPort())
        planeActor = (vtk.vtkActor())
        if (img == True):
            planeActor.SetMapper(mapper)
        else:
            planeActor.SetMapper(planeMapper)# mapper planeMapper
        planeActor.DragableOn()
        planeActor.SetDragable(1)
        if (img== True):
            planeActor.SetTexture(texture)
        else:
            planeActor.GetProperty().SetColor(.0,.3,.6)
            planeActor.GetProperty().SetOpacity(0.95)
        #planeActor.GetProperty().SetAmbient(0)
        #planeActor.GetProperty().SetDiffuse(0.9)
        #planeActor.GetProperty().SetSpecular(0.1)
        self.render.AddActor(planeActor)
        
        return planeActor
开发者ID:Jovior85,项目名称:NavEsp,代码行数:60,代码来源:Renderer.py

示例15: update_viewer

    def update_viewer(self, event, *args):
        MarkerWindowInteractor.update_viewer(self, event, *args)
        if event=='color marker':
            marker, color = args
            marker.set_color(color)
        elif event=='label marker':
            marker, label = args
            marker.set_label(label)
            
            if shared.debug: print "Create VTK-Text", marker.get_label()
            text = vtk.vtkVectorText()
            text.SetText(marker.get_label())
            textMapper = vtk.vtkPolyDataMapper()
            textMapper.SetInput(text.GetOutput())
            textActor = self.textActors[marker]
            textActor.SetMapper(textMapper)

        elif event=='move marker':
            marker, center = args
            marker.set_center(center)
            #update the select boxes and text actor
            textActor = self.textActors[marker]
            size = marker.get_size()
            textActor.SetScale(size, size, size)
            x,y,z = marker.get_center()
            textActor.SetPosition(x+size, y+size, z+size)

            if self.boxes.has_key(marker):
                selectActor = self.boxes[marker]
                boxSource = vtk.vtkCubeSource()
                boxSource.SetBounds(marker.GetBounds())
                mapper = vtk.vtkPolyDataMapper()
                mapper.SetInput(boxSource.GetOutput())
                selectActor.SetMapper(mapper)
                
        elif event=='labels on':
            actors = self.textActors.values()
            for actor in actors:
                actor.VisibilityOn()
        elif event=='labels off':
            actors = self.textActors.values()
            for actor in actors:
                actor.VisibilityOff()
        #elif event=='select marker':
        #    marker = args[0]
        #    actor = create_box_actor_around_marker(marker)
        #    if shared.debug: print "PlaneWidgetsXYZ.update_viewer(): self.renderer.AddActor(actor)"
        #    self.renderer.AddActor(actor)
        #    self.boxes[marker] = actor
        #elif event=='unselect marker':
        #    marker = args[0]
        #    actor = self.boxes[marker]
        #    print "pwxyz: u m", repr(marker), repr(actor)
        #    self.renderer.RemoveActor(actor)
        #    del self.boxes[marker]
        elif event=="set axes directions":
            self.add_axes_labels()
            EventHandler().notify('observers update plane')
        
        self.Render()
开发者ID:neurodebian,项目名称:PyLocator,代码行数:60,代码来源:plane_widgets_xyz.py


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