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

Python vtk.vtkPolyDataMapper2D函数代码示例

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

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



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

示例1: _draw_line

    def _draw_line(self):
        line1 = vtk.vtkLineSource()
        line1.SetPoint1(self.points[0])
        line1.SetPoint2(self.points[1])

        line2 = vtk.vtkLineSource()
        line2.SetPoint1(self.points[1])
        line2.SetPoint2(self.points[2])

        arc = self.DrawArc()

        line = vtk.vtkAppendPolyData()
        line.AddInput(line1.GetOutput())
        line.AddInput(line2.GetOutput())
        line.AddInput(arc.GetOutput())

        c = vtk.vtkCoordinate()
        c.SetCoordinateSystemToWorld()

        m = vtk.vtkPolyDataMapper2D()
        m.SetInputConnection(line.GetOutputPort())
        m.SetTransformCoordinate(c)

        a = vtk.vtkActor2D()
        a.SetMapper(m)
        a.GetProperty().SetColor(self.colour)
        self.line_actor = a
开发者ID:RuanAragao,项目名称:invesalius3,代码行数:27,代码来源:measures.py


示例2: __init__

  def __init__(self, sliceWidget):
    super(RectangleEffectTool,self).__init__(sliceWidget)

    # create a logic instance to do the non-gui work
    self.logic = RectangleEffectLogic(self.sliceWidget.sliceLogic())

    # interaction state variables
    self.actionState = None
    self.startXYPosition = None
    self.currentXYPosition = None

    # initialization
    self.createGlyph()

    self.mapper = vtk.vtkPolyDataMapper2D()
    self.actor = vtk.vtkActor2D()
    if vtk.VTK_MAJOR_VERSION <= 5:
      self.mapper.SetInput(self.polyData)
    else:
      self.mapper.SetInputData(self.polyData)
    self.actor.SetMapper(self.mapper)
    property_ = self.actor.GetProperty()
    property_.SetColor(1,1,0)
    property_.SetLineWidth(1)
    self.renderer.AddActor2D( self.actor )
    self.actors.append( self.actor )
开发者ID:jperdomo23,项目名称:Slicer,代码行数:26,代码来源:RectangleEffect.py


示例3: __init__

  def __init__(self, sliceWidget):
    super(QuickTCGAEffectTool,self).__init__(sliceWidget)
    # create a logic instance to do the non-gui work
    #self.logic = QuickTCGAEffectLogic(self.sliceWidget.sliceLogic())

    self.sliceWidget = sliceWidget
    self.sliceLogic = sliceWidget.sliceLogic()
    self.sliceView = self.sliceWidget.sliceView()
    self.interactor = self.sliceView.interactorStyle().GetInteractor()
    self.renderWindow = self.sliceWidget.sliceView().renderWindow()

    self.actionState = None
    self.startXYPosition = None
    self.currentXYPosition = None

    self.createGlyph()

    self.mapper = vtk.vtkPolyDataMapper2D()
    self.actor = vtk.vtkActor2D()
    self.mapper.SetInputData(self.polyData)
    self.actor.SetMapper(self.mapper)
    property_ = self.actor.GetProperty()
    property_.SetColor(1,1,0)
    property_.SetLineWidth(1)
    self.renderer.AddActor2D( self.actor )
    self.actors.append( self.actor )
开发者ID:fedorov,项目名称:SlicerPathology,代码行数:26,代码来源:QuickTCGAEffect.py


示例4: __init__

  def __init__(self, sliceWidget):
    super(LevelTracingEffectTool,self).__init__(sliceWidget)

    # create a logic instance to do the non-gui work
    self.logic = LevelTracingEffectLogic(self.sliceWidget.sliceLogic())

    # instance variables
    self.actionState = ''

    # initialization
    self.xyPoints = vtk.vtkPoints()
    self.rasPoints = vtk.vtkPoints()
    self.polyData = vtk.vtkPolyData()

    self.tracingFilter = vtkITK.vtkITKLevelTracingImageFilter()
    self.ijkToXY = vtk.vtkGeneralTransform()

    self.mapper = vtk.vtkPolyDataMapper2D()
    self.actor = vtk.vtkActor2D()
    property_ = self.actor.GetProperty()
    property_.SetColor( 107/255., 190/255., 99/255. )
    property_.SetLineWidth( 1 )
    if vtk.VTK_MAJOR_VERSION <= 5:
      self.mapper.SetInput(self.polyData)
    else:
      self.mapper.SetInputData(self.polyData)
    self.actor.SetMapper(self.mapper)
    property_ = self.actor.GetProperty()
    property_.SetColor(1,1,0)
    property_.SetLineWidth(1)
    self.renderer.AddActor2D( self.actor )
    self.actors.append( self.actor )
开发者ID:kingofpanda,项目名称:Slicer,代码行数:32,代码来源:LevelTracingEffect.py


示例5: CreateViewportBox

def CreateViewportBox(colorfg,linewidth=3) :
	pts = vtk.vtkPoints()
	pts.SetNumberOfPoints(4)
	pts.SetPoint(0, 0.0, 0.0, 0.0)
	pts.SetPoint(1, 0.0, 1.0, 0.0)
	pts.SetPoint(2, 1.0, 1.0, 0.0)
	pts.SetPoint(3, 1.0, 0.0, 0.0)
	lines = vtk.vtkCellArray()
	lines.InsertNextCell(5)
	lines.InsertCellPoint(0)
	lines.InsertCellPoint(1)
	lines.InsertCellPoint(2)
	lines.InsertCellPoint(3)
	lines.InsertCellPoint(0)
	box = vtk.vtkPolyData()
	box.SetPoints(pts)
	box.SetLines(lines)

	coords = vtk.vtkCoordinate()
	coords.SetCoordinateSystemToNormalizedViewport()

	boxmapper = vtk.vtkPolyDataMapper2D()
	boxmapper.SetInputData(box)
	boxmapper.SetTransformCoordinate(coords)

	boxactor = vtk.vtkActor2D()
	boxactor.SetMapper(boxmapper)
	boxactor.GetProperty().SetLineWidth(linewidth)
	boxactor.GetProperty().SetColor(colorfg)

	return boxactor
开发者ID:PBrockmann,项目名称:VTK_Mapper,代码行数:31,代码来源:mylib_axis.py


示例6: __create_line_actor

    def __create_line_actor(self, line):
        line_mapper = vtk.vtkPolyDataMapper2D()
        line_mapper.SetInput(line.GetOutput())

        line_actor = vtk.vtkActor2D()
        line_actor.SetMapper(line_mapper)
        return line_actor
开发者ID:ruppert,项目名称:invesalius3,代码行数:7,代码来源:slice_data.py


示例7: enable

 def enable(self, parent):
     self.parent = parent
     
     self.pts = vtk.vtkPoints()
     self.pts.SetNumberOfPoints(4)
     
     self.lines = vtk.vtkCellArray()
     self.lines.InsertNextCell(5)
     for i in range(4):
         self.lines.InsertCellPoint(i)
     self.lines.InsertCellPoint(0)
     
     self.pd = vtk.vtkPolyData()
     self.pd.SetPoints(self.pts)
     self.pd.SetLines(self.lines)
     
     self.bboxMapper = vtk.vtkPolyDataMapper2D()
     self.bboxMapper.SetInput(self.pd)
     self.bboxActor = vtk.vtkActor2D()
     self.bboxActor.SetMapper(self.bboxMapper)
     self.bboxActor.GetProperty().SetColor(1, 0, 0)
     
     self.parent.renderer.AddViewProp(self.bboxActor)
     
     self.pts.SetPoint(0, self.X1, self.Y1, 0)
     self.pts.SetPoint(1, self.X2, self.Y1, 0)
     self.pts.SetPoint(2, self.X2, self.Y2, 0)
     self.pts.SetPoint(3, self.X1, self.Y2, 0)
     self.bboxEnabled = False
开发者ID:guohengkai,项目名称:MIRVAP,代码行数:29,代码来源:ClipPlugin.py


示例8: __init__

  def __init__(self, sliceWidget):

    # keep a flag since events such as sliceNode modified
    # may come during superclass construction, which will
    # invoke our processEvents method
    self.initialized = False

    super(DrawEffectTool,self).__init__(sliceWidget)

    # create a logic instance to do the non-gui work
    self.logic = DrawEffectLogic(self.sliceWidget.sliceLogic())

    # interaction state variables
    self.activeSlice = None
    self.lastInsertSLiceNodeMTime = None
    self.actionState = None

    # initialization
    self.xyPoints = vtk.vtkPoints()
    self.rasPoints = vtk.vtkPoints()
    self.polyData = self.createPolyData()

    self.mapper = vtk.vtkPolyDataMapper2D()
    self.actor = vtk.vtkActor2D()
    self.mapper.SetInputData(self.polyData)
    self.actor.SetMapper(self.mapper)
    property_ = self.actor.GetProperty()
    property_.SetColor(1,1,0)
    property_.SetLineWidth(1)
    self.renderer.AddActor2D( self.actor )
    self.actors.append( self.actor )

    self.initialized = True
开发者ID:LucasGandel,项目名称:Slicer,代码行数:33,代码来源:DrawEffect.py


示例9: __init__

  def __init__(self, sliceWidget):
    super(PaintEffectTool,self).__init__(sliceWidget)
    # create a logic instance to do the non-gui work
    self.logic = PaintEffectLogic(self.sliceWidget.sliceLogic())

    # configuration variables
    self.delayedPaint = True
    self.parameterNode = EditUtil.getParameterNode()
    self.sphere = not (0 == int(self.parameterNode.GetParameter("PaintEffect,sphere")))
    self.smudge = not (0 == int(self.parameterNode.GetParameter("PaintEffect,smudge")))
    self.pixelMode = not (0 == int(self.parameterNode.GetParameter("PaintEffect,pixelMode")))
    self.radius = float(self.parameterNode.GetParameter("PaintEffect,radius"))

    # interaction state variables
    self.position = [0, 0, 0]
    self.paintCoordinates = []
    self.feedbackActors = []
    self.lastRadius = 0

    # scratch variables
    self.rasToXY = vtk.vtkMatrix4x4()

    # initialization
    self.brush = vtk.vtkPolyData()
    self.createGlyph(self.brush)
    self.mapper = vtk.vtkPolyDataMapper2D()
    self.actor = vtk.vtkActor2D()
    self.mapper.SetInputData(self.brush)
    self.actor.SetMapper(self.mapper)
    self.actor.VisibilityOff()

    self.renderer.AddActor2D(self.actor)
    self.actors.append(self.actor)

    self.processEvent()
开发者ID:Slicer,项目名称:Slicer,代码行数:35,代码来源:PaintEffect.py


示例10: __init__

	def __init__(self):
		self.poly_list = []
		self.actor_list = []
		
		# Create shapes and actors
		boxUp = vtk.vtkRegularPolygonSource()
		boxUp.GeneratePolygonOn()
		boxUp.GeneratePolylineOff()
		boxUp.SetNumberOfSides(3)
		boxUp.SetCenter(0,14,0)
		boxUp.SetRadius(11)
		self.poly_list.append(boxUp)
		
		boxL = vtk.vtkRegularPolygonSource()
		boxL.GeneratePolygonOn()
		boxL.GeneratePolylineOff()
		boxL.SetNumberOfSides(4)
		boxL.SetCenter(-15,-2,0)
		boxL.SetRadius(9)
		self.poly_list.append(boxL)
		
		boxR = vtk.vtkRegularPolygonSource()
		boxR.GeneratePolygonOn()
		boxR.GeneratePolylineOff()
		boxR.SetNumberOfSides(4)
		boxR.SetCenter(15,-2,0)
		boxR.SetRadius(9)
		self.poly_list.append(boxR)
		
		boxLDown = vtk.vtkRegularPolygonSource()
		boxLDown.GeneratePolygonOn()
		boxLDown.GeneratePolylineOff()
		boxLDown.SetNumberOfSides(6)
		boxLDown.SetCenter(-12,-22,0)
		boxLDown.SetRadius(9)
		self.poly_list.append(boxLDown)
		
		boxRDown = vtk.vtkRegularPolygonSource()
		boxRDown.GeneratePolygonOn()
		boxRDown.GeneratePolylineOff()
		boxRDown.SetNumberOfSides(6)
		boxRDown.SetCenter(12,-22,0)
		boxRDown.SetRadius(9)
		self.poly_list.append(boxRDown)
		
		for ii, poly in enumerate(self.poly_list):
			map = vtk.vtkPolyDataMapper2D()
			map.SetInputConnection(poly.GetOutputPort(0))
			act = vtk.vtkActor2D()
			act.SetMapper(map)
			act.SetPickable(True)
			# act.GetProperty().SetColor(0.5, 0.45, 0.35)
			act.GetProperty().SetColor(0.4, 0.4, 0.4)
			act.GetProperty().SetLineWidth(0.0)
			act.GetPositionCoordinate().SetCoordinateSystemToNormalizedDisplay()
			act.GetPositionCoordinate().SetValue(0.075 ,0.15)
			act.GetPosition2Coordinate().SetCoordinateSystemToNormalizedDisplay()
			act.GetPosition2Coordinate().SetValue(0.5, 0.5)
			self.actor_list.append(act)
开发者ID:emonson,项目名称:MultiScaleSVD,代码行数:59,代码来源:icicle_noview_textured.py


示例11: render_image

def render_image(png_reader):
    square = 8
    color_map = vtk.vtkLookupTable()
    color_map.SetNumberOfColors(16)
    color_map.SetHueRange(0, 0.667)

    magnitude = vtk.vtkImageMagnitude()
    magnitude.SetInput(png_reader.GetOutput())

    geometry = vtk.vtkImageDataGeometryFilter()
    geometry.SetInput(magnitude.GetOutput())

    warp = vtk.vtkWarpScalar()
    warp.SetInput(geometry.GetOutput())
    warp.SetScaleFactor(0.25)

    merge = vtk.vtkMergeFilter()
    merge.SetGeometry(warp.GetOutput())
    merge.SetScalars(png_reader.GetOutput())

    elevation_mtHood = vtk.vtkElevationFilter()
    elevation_mtHood.SetInput(merge.GetOutput())
    elevation_mtHood.SetLowPoint(0, 0, 0)
    elevation_mtHood.SetHighPoint(0, 0, 50)

    mapper_3D_mtHood = vtk.vtkDataSetMapper()
    mapper_3D_mtHood.SetInput(elevation_mtHood.GetOutput())
    mapper_3D_mtHood.SetLookupTable(color_map)

    mapper_2D_mtHood = vtk.vtkPolyDataMapper2D()
    mapper_2D_mtHood.SetInput(elevation_mtHood.GetOutput())
    mapper_2D_mtHood.SetLookupTable(color_map)
    
    actor_2D_mtHood = vtk.vtkActor2D()
    actor_2D_mtHood.SetMapper(mapper_2D_mtHood)
    actor_2D_mtHood.GetPositionCoordinate().SetCoordinateSystemToNormalizedDisplay()
    actor_2D_mtHood.GetPositionCoordinate().SetValue(0.25,0.25)
    
    actor_3D_mtHood = vtk.vtkActor()
    actor_3D_mtHood.SetMapper(mapper_3D_mtHood)


    renderer = vtk.vtkRenderer()
    renderWindow = vtk.vtkRenderWindow()
    renderWindow.AddRenderer(renderer)
    renderWindowInteractor = vtk.vtkRenderWindowInteractor()
    renderWindowInteractor.SetRenderWindow(renderWindow)

    renderer.AddActor(actor_3D_mtHood)
    renderer.SetBackground(.5, .5, .5)

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


示例12: GetRepresentation

    def GetRepresentation(self, x, y, z):
        pc = self.camera.GetPosition() # camera position
        pf = self.camera.GetFocalPoint() # focal position
        pp = (x, y, z) # point where the user clicked

        # Vector from camera position to user clicked point
        vcp = [j-i for i,j in zip(pc, pp)]
        # Vector from camera position to camera focal point
        vcf = [j-i for i,j in zip(pc, pf)]
        # the vector where the perpendicular vector will be given
        n = [0,0,0]
        # The cross, or vectorial product, give a vector perpendicular to vcp
        # and vcf, in this case this vector will be in horizontal, this vector
        # will be stored in the variable "n"
        vtk.vtkMath.Cross(vcp, vcf, n)
        # then normalize n to only indicate the direction of this vector
        vtk.vtkMath.Normalize(n)
        # then
        p1 = [i*self.size + j for i,j in zip(n, pp)]
        p2 = [i*-self.size + j for i,j in zip(n, pp)]

        sh = vtk.vtkLineSource()
        sh.SetPoint1(p1)
        sh.SetPoint2(p2)

        n = [0,0,0]
        vcn = [j-i for i,j in zip(p1, pc)]
        vtk.vtkMath.Cross(vcp, vcn, n)
        vtk.vtkMath.Normalize(n)
        p3 = [i*self.size + j for i,j in zip(n, pp)]
        p4 = [i*-self.size +j for i,j in zip(n, pp)]

        sv = vtk.vtkLineSource()
        sv.SetPoint1(p3)
        sv.SetPoint2(p4)

        cruz = vtk.vtkAppendPolyData()
        cruz.AddInput(sv.GetOutput())
        cruz.AddInput(sh.GetOutput())

        c = vtk.vtkCoordinate()
        c.SetCoordinateSystemToWorld()

        m = vtk.vtkPolyDataMapper2D()
        m.SetInputConnection(cruz.GetOutputPort())
        m.SetTransformCoordinate(c)

        a = vtk.vtkActor2D()
        a.SetMapper(m)
        a.GetProperty().SetColor(self.colour)
        return a
开发者ID:RuanAragao,项目名称:invesalius3,代码行数:51,代码来源:measures.py


示例13: CreateAxisTickActor

def CreateAxisTickActor(xstart,ystart,xend,yend,colorfg) :
	line=vtk.vtkLineSource()
	line.SetPoint1(xstart,ystart,0.0)
	line.SetPoint2(xend,yend,0.0)
	coords = vtk.vtkCoordinate()
	coords.SetCoordinateSystemToNormalizedViewport()
	linemapper = vtk.vtkPolyDataMapper2D()
	linemapper.SetInputConnection(line.GetOutputPort())
	linemapper.SetTransformCoordinate(coords)
	tick = vtk.vtkActor2D()
	tick.SetMapper(linemapper)
	tick.GetProperty().SetLineWidth(1)
	tick.GetProperty().SetColor(colorfg)
	tick.GetPositionCoordinate().SetCoordinateSystemToNormalizedViewport()
	return tick 
开发者ID:PBrockmann,项目名称:VTK_Mapper,代码行数:15,代码来源:mylib_axis.py


示例14: render_image

def render_image(pointset):
    '''
    square = 10
    color_map = vtk.vtkLookupTable()
    color_map.SetNumberOfColors(square * square)
    color_map.SetTableRange(0, square * square - 1)
    for ii in range(0, square):
        for jj in range(0, square):
            color_map.SetTableValue(ii, jj / square, jj / square, ii /square)
    '''

    color_map = vtk.vtkLookupTable()
    color_map.SetNumberOfColors(16)
    color_map.SetHueRange(0, 0.667)

    delaunay = vtk.vtkDelaunay2D()
    delaunay.SetTolerance(0.001)
    delaunay.SetAlpha(18)
    delaunay.SetInput(pointset);
    delaunay.Update();

    elevation_thorax = vtk.vtkElevationFilter()
    elevation_thorax.SetInput(delaunay.GetOutput())
    elevation_thorax.SetLowPoint(0, 0, -25)
    elevation_thorax.SetHighPoint(0, 0, 25)

 
    meshMapper = vtk.vtkPolyDataMapper2D()
    meshMapper.SetInput(elevation_thorax.GetOutput())
    meshMapper.SetLookupTable(color_map)
    #meshMapper.SetScalarRange(0,255)
 
    meshActor = vtk.vtkActor2D()
    meshActor.SetMapper(meshMapper)

    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,代码行数:47,代码来源:height_fields_thorax_c1.py


示例15: __init__

  def __init__(self, point_1, point_2, color=(0,0,0), width=1, renderer=None):
    self.line = vtk.vtkLineSource()
    mapper = vtk.vtkPolyDataMapper2D()
    mapper.SetInputConnection(self.line.GetOutputPort())
    self.actor = vtk.vtkActor2D()
    self.actor.SetMapper(mapper)
    self._renderer = None

    # Default to hidden
    self.hide()

    # Actor and everything need to be set up before magic properties work
    self.point_1 = point_1
    self.point_2 = point_2
    self.color = color
    self.width = width
    self.renderer = renderer
开发者ID:devarajun,项目名称:uvcdat,代码行数:17,代码来源:line.py


示例16: __init__

  def __init__(self, scriptedEffect, sliceWidget):
    self.scriptedEffect = scriptedEffect
    self.sliceWidget = sliceWidget
    self.activeSlice = None
    self.lastInsertSliceNodeMTime = None
    self.actionState = None

    self.xyPoints = vtk.vtkPoints()
    self.rasPoints = vtk.vtkPoints()
    self.polyData = self.createPolyData()

    self.mapper = vtk.vtkPolyDataMapper2D()
    self.actor = vtk.vtkActor2D()
    self.mapper.SetInputData(self.polyData)
    self.actor.SetMapper(self.mapper)
    actorProperty = self.actor.GetProperty()
    actorProperty.SetColor(1,1,0)
    actorProperty.SetLineWidth(1)
开发者ID:BRAINSia,项目名称:Slicer,代码行数:18,代码来源:SegmentEditorDrawEffect.py


示例17: _draw_text

    def _draw_text(self):
        text = u' %.2f ' % \
                self.CalculateAngle()
        x,y,z= self.points[1]
        textsource = vtk.vtkTextSource()
        textsource.SetText(text)
        textsource.SetBackgroundColor((250/255.0, 247/255.0, 218/255.0))
        textsource.SetForegroundColor(self.colour)

        m = vtk.vtkPolyDataMapper2D()
        m.SetInputConnection(textsource.GetOutputPort())

        a = vtk.vtkActor2D()
        a.SetMapper(m)
        a.DragableOn()
        a.GetPositionCoordinate().SetCoordinateSystemToWorld()
        a.GetPositionCoordinate().SetValue(x,y,z)
        self.text_actor = a
开发者ID:RuanAragao,项目名称:invesalius3,代码行数:18,代码来源:measures.py


示例18: drawLine

    def drawLine(self, points):
        try:
            self.viewer.GetRenderer().RemoveActor(self.actor)
            self.viewer.GetRenderer().Render()
        except:
            pass
        point1 = points[0]
        point2 = points[1]

        points = vtk.vtkPoints()
        points.SetNumberOfPoints(2)
        points.Allocate(2)

        points.InsertPoint(0, point1[0], point1[1], 0.001)
        points.InsertPoint(1, point2[0], point2[1], 0.001)

        dist = numpy.sqrt(numpy.square((point1[0]-point2[0])*0.028) + numpy.square((point1[1]-point2[1])*0.030))
        self.cells = vtk.vtkCellArray()
        self.cells.Initialize()

        line = vtk.vtkLine()
        line.GetPointIds().SetId(0,0)
        line.GetPointIds().SetId(1,1)
        self.cells.InsertNextCell(line)

        self.poly = vtk.vtkPolyData()
        self.poly.Initialize()
        self.poly.SetPoints(points)
        self.poly.SetLines(self.cells)
        self.poly.Modified()

        mapper = vtk.vtkPolyDataMapper2D()
        #print(dir(mapper))
        mapper.SetInput(self.poly)
        mapper.ScalarVisibilityOn()
        mapper.SetScalarModeToUsePointData()
        mapper.Update()

        self.actor = vtk.vtkActor2D()
        self.actor.SetMapper(mapper)
        self.viewer.GetRenderer().AddActor2D(self.actor)

        self.dist = dist
开发者ID:Nefarin,项目名称:SODM,代码行数:43,代码来源:AppWindow.py


示例19: __init__

  def __init__(self, effect, sliceWidget):
    self.effect = effect
    self.sliceWidget = sliceWidget
    self.actionState = ''

    self.xyPoints = vtk.vtkPoints()
    self.rasPoints = vtk.vtkPoints()
    self.polyData = vtk.vtkPolyData()

    self.tracingFilter = vtkITK.vtkITKLevelTracingImageFilter()
    self.ijkToXY = vtk.vtkGeneralTransform()

    self.mapper = vtk.vtkPolyDataMapper2D()
    self.actor = vtk.vtkActor2D()
    actorProperty = self.actor.GetProperty()
    actorProperty.SetColor( 107/255., 190/255., 99/255. )
    actorProperty.SetLineWidth( 1 )
    self.mapper.SetInputData(self.polyData)
    self.actor.SetMapper(self.mapper)
    actorProperty = self.actor.GetProperty()
    actorProperty.SetColor(1,1,0)
    actorProperty.SetLineWidth(1)
开发者ID:MayeulChassagnard,项目名称:Slicer,代码行数:22,代码来源:SegmentEditorLevelTracingEffect.py


示例20: vtkGetDataRoot

#!/usr/bin/env python
import vtk
from vtk.test import Testing
from vtk.util.misc import vtkGetDataRoot

VTK_DATA_ROOT = vtkGetDataRoot()


# create four cursors configured differently
cursor = vtk.vtkCursor2D()
cursor.SetModelBounds(15, 45, 15, 45, 0, 0)
cursor.SetFocalPoint(30, 30, 0)
cursor.AllOff()
cursor.AxesOn()
cursor.OutlineOn()
cursorMapper = vtk.vtkPolyDataMapper2D()
cursorMapper.SetInputConnection(cursor.GetOutputPort())
cursorActor = vtk.vtkActor2D()
cursorActor.SetMapper(cursorMapper)
cursorActor.GetProperty().SetColor(1, 0, 0)

cursor2 = vtk.vtkCursor2D()
cursor2.SetModelBounds(75, 105, 15, 45, 0, 0)
cursor2.SetFocalPoint(90, 30, 0)
cursor2.AllOff()
cursor2.AxesOn()
cursor2.OutlineOn()
cursor2.PointOn()
cursor2Mapper = vtk.vtkPolyDataMapper2D()
cursor2Mapper.SetInputConnection(cursor2.GetOutputPort())
cursor2Actor = vtk.vtkActor2D()
开发者ID:skyopener,项目名称:OSCCAR-dev,代码行数:31,代码来源:cursor2D.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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