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

Python vtk.vtkSphereSource函数代码示例

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

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



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

示例1: __init__

	def __init__(self, amt, radius):
		Model.__init__(self)
		self.source = vtk.vtkAppendPolyData()
		for i in range(amt):
			opX = 1.0
			opY = 1.0
			opZ = 1.0
			if random() > 0.5:
				opX *= -1.0
			if random() > 0.5:
				opY *= -1.0
			if random() > 0.5:
				opZ *= -1.0
			sRad = 0.25 + ( random() * 0.25 )
			x = float(random() * radius) * opX
			y = float(random() * radius) * opY
			z = float(random() * radius) * opZ
			s = vtk.vtkSphereSource()
			s.SetCenter(x,y,z)
			s.SetRadius(float(sRad))
			s.Update()
			self.source.AddInput(s.GetOutput())
		#add center
		s = vtk.vtkSphereSource()
		s.SetCenter(0.0, 0.0, 0.0)
		s.SetRadius(0.5)
		s.Update()
		self.source.AddInput(s.GetOutput())
		self.Update()
开发者ID:aglowacki,项目名称:ScanSimulator,代码行数:29,代码来源:PrimitiveModels.py


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


示例3: get_electrode_glyphs

def get_electrode_glyphs(e_pts, e_colors):
    e_glyph_shape = vtk.vtkSphereSource()

    # cone.SetResolution(5)
    # cone.SetHeight(2)
    e_glyph_shape.SetRadius(3.0)

    glyphs = vtk.vtkGlyph3D()
    glyphs.SetSourceConnection(e_glyph_shape.GetOutputPort())
    glyphs.SetColorModeToColorByScalar()

    centroidsPD = vtk.vtkPolyData()
    centroidsPD.SetPoints(e_pts)
    centroidsPD.GetPointData().SetScalars(e_colors)

    if vtk_major_version == 5:

        glyphs.SetInput(centroidsPD)


    else:
        glyphs.SetInputData(centroidsPD)

    glyphs.ScalingOff()  # IMPORTANT
    glyphs.Update()

    glyphs.ScalingOff()  # IMPORTANT
    glyphs.Update()

    return glyphs
开发者ID:maciekswat,项目名称:ram_plots,代码行数:30,代码来源:brain_plot_utils.py


示例4: make_sphereActor

def make_sphereActor (x, r, rgb, opacity):
    points = vtk.vtkPoints()
    points.InsertNextPoint(x[0], x[1], x[2])

    diameter = vtk.vtkDoubleArray()
    diameter.SetNumberOfComponents(1)
    diameter.InsertNextTuple1(2.0*r)

    pData = vtk.vtkPolyData()
    pData.SetPoints(points)
    pData.GetPointData().SetScalars(diameter)

    pSource = vtk.vtkSphereSource()
    pSource.SetPhiResolution(16)
    pSource.SetThetaResolution(16)

    pGlyph = vtk.vtkGlyph3D()
    pGlyph.SetSource(pSource.GetOutput())
    pGlyph.SetInput(pData)
    pGlyph.ScalingOn()
    pGlyph.SetScaleModeToScaleByScalar()

    pMapper = vtk.vtkPolyDataMapper()
    pMapper.ScalarVisibilityOff()
    pMapper.SetInput(pGlyph.GetOutput())

    pActor = vtk.vtkActor()
    pActor.SetMapper(pMapper)
    pActor.GetProperty().SetColor(rgb[0], rgb[1], rgb[2])
    pActor.GetProperty().SetOpacity(opacity)

    return pActor
开发者ID:kichiki,项目名称:stokes,代码行数:32,代码来源:stvis-vtk.py


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


示例6: __init__

 def __init__(self, pos, radius=None, frame=None, scene=None, color='gray'):
     if radius is None:
         radius = ArticulationSphere.last_radius_update
     self.init_radius = radius
     self.src = vtk.vtkSphereSource()
     self.src.SetThetaResolution(16)
     self.src.SetPhiResolution(16)
     self.src.SetCenter(pos)
     self.src.SetRadius(radius)
     self.mapper = vtk.vtkPolyDataMapper()
     if USING_VTK6:
         self.mapper.SetInputConnection(self.src.GetOutputPort())
     else:
         self.mapper.SetInput(self.src.GetOutput())
     self.actor = vtk.vtkActor()
     self.actor.SetMapper(self.mapper)
     self.color = color # base color name
     self.set_color()
     self.actor.GetProperty().SetOpacity(0.25)
     self.frame = frame
     self.frame.ren.AddActor(self.actor)
     self.scene = scene
     self.selected_pts = []
     self.is_selected = False
     if self.scene.point_cloud_selection_enabled:
         self.select_point_cloud()
     self.callbacks = defaultdict(lambda: [lambda a: None])
     # action_name -> list of callbacks to be called
     # after action is performed (i.e. 'moved', 'delete', etc)
     self.polytube_node = None # None -> sphere is "roaming"
                               #         (i.e. not attached to any model)
     self.frame.ren_win.Render()
开发者ID:cjauvin,项目名称:pypetree,代码行数:32,代码来源:world.py


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


示例8: onApplyButtonClicked

    def onApplyButtonClicked(self):
        """
        Real algorithm should be in class VascularWallLogic.
        """
        logging.info("applyButton is clicked.")

        # Create models for sphere

        self.sphere = vtk.vtkSphereSource()
        # Model node
        model = slicer.vtkMRMLModelNode()
        model.SetAndObservePolyData(self.sphere.GetOutput())

        # Display node
        self.modelDisplay = slicer.vtkMRMLModelDisplayNode()
        self.modelDisplay.SetSliceIntersectionVisibility(True)
        self.modelDisplay.SetVisibility(self.showCheckBox.isChecked())
        self.modelDisplay.SetOpacity(0.5)
        self.modelDisplay.SetRepresentation(1)
        slicer.mrmlScene.AddNode(self.modelDisplay)
        model.SetAndObserveDisplayNodeID(self.modelDisplay.GetID())

        # Add to scene
        self.modelDisplay.SetInputPolyDataConnection(
            model.GetPolyDataConnection())
        slicer.mrmlScene.AddNode(model)

        # Callback
        self.UpdateSphere(0, 0)
        self.rulerSelector.currentNode().AddObserver(
            'ModifiedEvent', self.UpdateSphere)
开发者ID:quentan,项目名称:SlicerScript,代码行数:31,代码来源:VascularWall.py


示例9: CreateSphere

def CreateSphere(radius, color=None):
	sphereSource = vtkSphereSource()
	sphereSource.SetRadius(radius)
	sphereSource.SetThetaResolution(18)
	sphereSource.SetPhiResolution(18)

	sphereMapper = vtkPolyDataMapper()
	sphereMapper.SetInputConnection(sphereSource.GetOutputPort())

	sphereActor = vtkActor()
	sphereActor.PickableOff()
	sphereActor.SetMapper(sphereMapper)

	# Give the actor a custom color
	ColorActor(sphereActor, color)

	# Also give the sphere object the convenience methods of
	# SetCenter() and GetCenter() that misses from the vtkActor
	# class but is present in the vtkSphereSource class
	def setCenter(x, y, z):
		sphereSource.SetCenter(x, y, z)

	def getCenter():
		return sphereSource.GetCenter()

	setattr(sphereActor, "SetCenter", setCenter)
	setattr(sphereActor, "GetCenter", getCenter)

	return sphereActor
开发者ID:berendkleinhaneveld,项目名称:Registrationshop,代码行数:29,代码来源:vtkDrawing.py


示例10: __init__

    def __init__(self, module_manager):
        # initialise our base class
        ModuleBase.__init__(self, module_manager)

        # what a lame-assed filter, we have to make dummy inputs!
        # if we don't have a dummy input (but instead a None input) it
        # bitterly complains when we do a GetOutput() (it needs the input
        # to know the type of the output) - and GetPolyDataOutput() also
        # doesn't work.
        # NB: this does mean that our probeFilter NEEDS a PolyData as
        # probe geometry!
        ss = vtk.vtkSphereSource()
        ss.SetRadius(0)
        self._dummyInput = ss.GetOutput()

        #This is also retarded - we (sometimes, see below) need the "padder"
        #to get the image extent big enough to satisfy the probe filter. 
        #No apparent logical reason, but it throws an exception if we don't.
        self._padder = vtk.vtkImageConstantPad()
        self._source = None
        self._input = None
        
        self._probeFilter = vtk.vtkProbeFilter()
        self._probeFilter.SetInput(self._dummyInput)

        NoConfigModuleMixin.__init__(
            self,
            {'Module (self)' : self,
             'vtkProbeFilter' : self._probeFilter})

        module_utils.setup_vtk_object_progress(self, self._probeFilter,
                                           'Mapping source on input')
        
        self.sync_module_logic_with_config()
开发者ID:fvpolpeta,项目名称:devide,代码行数:34,代码来源:probeFilter.py


示例11: __init__

 def __init__(self,ext_actors=None): #ext_actors is a list of any external vtkActors.
     #initializations:
     self.renderer  = vtk.vtkRenderer()
     self.window    = vtk.vtkRenderWindow()
     self.window.SetSize(1000,1000)
     self.mapper    = vtk.vtkPolyDataMapper()
     self.points    = vtk.vtkPoints()
     self.poly_data = vtk.vtkPolyData()
     self.glyph3d   = vtk.vtkGlyph3D()
     self.actor     = vtk.vtkActor()
     self.point_s   = vtk.vtkPointSource()
     self.sphere    = vtk.vtkSphereSource() 
     self.interactor= vtk.vtkRenderWindowInteractor()
     self.inter_sty = PdbInteractorStyle()
     self.axes_actor= vtk.vtkAxesActor()
     #configurations:
     self.point_s.SetNumberOfPoints(1)
     self.sphere.SetRadius(1.0)
     self.interactor.SetInteractorStyle(self.inter_sty)
     self.interactor.SetRenderWindow(self.window)
     self.axes_actor.SetTotalLength(100,100,100)
     if ext_actors:
         self.ex_actors = ext_actors
     else:
         self.ex_actors=[]
开发者ID:alinar,项目名称:Molar,代码行数:25,代码来源:pdb_viewer.py


示例12: __init__

    def __init__(self, profile=0, radius=2):

        if not radius:
            self.radius = Globals.renderProps["sphereSize"] * 1.1
        else: self.radius = radius
        self.z = 0

        self.data = vtk.vtkPolyData()


        self.sphere = vtk.vtkSphereSource()
        self.sphere.SetRadius( Globals.referenceSize * self.radius )
        self.sphere.SetPhiResolution( Globals.renderProps["spherePhiResolution"] )
        self.sphere.SetThetaResolution( Globals.renderProps["sphereThetaResolution"] )

        self.glyphPoints = vtk.vtkGlyph3D()
        self.glyphPoints.SetInput( self.data )
        self.glyphPoints.SetSource( self.sphere.GetOutput() )

        self.mapper = vtk.vtkPolyDataMapper()
        self.mapper.SetInputConnection( self.glyphPoints.GetOutputPort() )

        self.actor = vtk.vtkActor()
        self.actor.SetMapper(self.mapper)
        if profile:
            self.actor.GetProperty().SetColor(0,0,1)
        else:
            self.actor.GetProperty().SetColor(1,1,0)

        Globals.ren.AddActor(self.actor)
开发者ID:ewong718,项目名称:freesurfer,代码行数:30,代码来源:CrossHair.py


示例13: __addVolumeSelectedActor

 def __addVolumeSelectedActor(self, worldpos):
     # Create a sphere
     sphereSource = vtk.vtkSphereSource()
     sphereSource.SetCenter(worldpos)
     sphereSource.SetRadius(0.5 + self.pick_radius / 2.0)
     
     
     mapper = vtk.vtkPolyDataMapper()
     mapper.SetInputConnection( sphereSource.GetOutputPort() )
     
     ren = self.GetRenderWindow().GetRenderers().GetFirstRenderer()
     
     if self.actor is not None:
         #remove old volume selected 
         ren.RemoveActor(self.actor)
     
     self.actor = vtk.vtkActor()
     self.actor.SetMapper(mapper)
     
     
     #prop = vtk.vtkProperty()
     #prop.ShadingOn()
     #prop.SetInterpolationToGouraud()
     #prop.EdgeVisibilityOff()
     #prop.SetDiffuse(0.7)
     #prop.SetSpecular(0.4)
     #prop.SetSpecularPower(20)
     #prop.SetColor(1.0, 1.0, 0)
     #prop.SetOpacity(0.5)
     
     #self.actor.SetProperty(prop)
            
     ren.AddActor(self.actor)
开发者ID:behollis,项目名称:DBSViewer,代码行数:33,代码来源:dbsInteractor.py


示例14: TestSection_01_GenerateInputData

  def TestSection_01_GenerateInputData(self):

    self.inputSegmentationNode = slicer.vtkMRMLSegmentationNode()
    slicer.mrmlScene.AddNode(self.inputSegmentationNode)

    # Create new segments
    import random
    for segmentName in ['first', 'second', 'third']:

      sphereSegment = vtkSegmentationCore.vtkSegment()
      sphereSegment.SetName(segmentName)
      sphereSegment.SetColor(random.uniform(0.0,1.0), random.uniform(0.0,1.0), random.uniform(0.0,1.0))

      sphere = vtk.vtkSphereSource()
      sphere.SetCenter(random.uniform(0,100),random.uniform(0,100),random.uniform(0,100))
      sphere.SetRadius(random.uniform(20,30))
      sphere.Update()
      spherePolyData = sphere.GetOutput()
      sphereSegment.AddRepresentation(
        vtkSegmentationCore.vtkSegmentationConverter.GetSegmentationClosedSurfaceRepresentationName(),
        spherePolyData)

      self.inputSegmentationNode.GetSegmentation().AddSegment(sphereSegment)

    self.assertEqual(self.inputSegmentationNode.GetSegmentation().GetNumberOfSegments(), 3)
开发者ID:SlicerRt,项目名称:Slicer,代码行数:25,代码来源:SegmentationWidgetsTest1.py


示例15: make_sphere

def make_sphere():
    global renderer
    # ---------------------------------------------------------------
    # The following code is identical to render_demo.py...
    # ---------------------------------------------------------------
    # create a sphere
    sphere_src = vtk.vtkSphereSource()
    sphere_src.SetRadius(1.0)
    sphere_src.SetCenter(0.0, 0.0, 0.0)
    sphere_src.SetThetaResolution(20)
    sphere_src.SetPhiResolution(20)
    # extract the edges
    edge_extractor = vtk.vtkExtractEdges()
    edge_extractor.SetInputConnection(sphere_src.GetOutputPort())
    # map sphere and edges separately
    sphere_mapper = vtk.vtkPolyDataMapper()
    sphere_mapper.SetInputConnection(sphere_src.GetOutputPort())
    edge_mapper = vtk.vtkPolyDataMapper()
    edge_mapper.SetInputConnection(edge_extractor.GetOutputPort())
    # define different rendering styles for sphere and edges
    sphere_actor = vtk.vtkActor()
    sphere_actor.SetMapper(sphere_mapper)
    sphere_actor.GetProperty().SetColor(1, 0.5, 0)
    edge_actor = vtk.vtkActor()
    edge_actor.SetMapper(edge_mapper)
    edge_actor.GetProperty().SetColor(0, 0.5, 0)
    edge_actor.GetProperty().SetLineWidth(3)
    # add resulting primitives to renderer
    renderer.AddActor(sphere_actor)
    renderer.AddActor(edge_actor)
开发者ID:CreativeCodingLab,项目名称:DarkSkyVis,代码行数:30,代码来源:interactor_demo.py


示例16: createSampleModelVolume

  def createSampleModelVolume(self, name, color, volumeNode=None):
    if volumeNode:
      self.assertTrue( volumeNode.IsA('vtkMRMLScalarVolumeNode') )
      bounds = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
      volumeNode.GetRASBounds(bounds)
      x = (bounds[0] + bounds[1])/2
      y = (bounds[2] + bounds[3])/2
      z = (bounds[4] + bounds[5])/2
      radius = min(bounds[1]-bounds[0],bounds[3]-bounds[2],bounds[5]-bounds[4]) / 3.0
    else:
      radius = 50
      x = y = z = 0

    # Taken from: http://www.na-mic.org/Bug/view.php?id=1536
    sphere = vtk.vtkSphereSource()
    sphere.SetCenter(x, y, z)
    sphere.SetRadius(radius)

    modelNode = slicer.vtkMRMLModelNode()
    modelNode.SetName(name)
    modelNode = slicer.mrmlScene.AddNode(modelNode)
    if vtk.VTK_MAJOR_VERSION <= 5:
      modelNode.SetAndObservePolyData(sphere.GetOutput())
    else:
      modelNode.SetPolyDataConnection(sphere.GetOutputPort())
    modelNode.SetHideFromEditors(0)

    displayNode = slicer.vtkMRMLModelDisplayNode()
    slicer.mrmlScene.AddNode(displayNode)
    displayNode.SliceIntersectionVisibilityOn()
    displayNode.VisibilityOn()
    displayNode.SetColor(color[0], color[1], color[2])
    modelNode.SetAndObserveDisplayNodeID(displayNode.GetID())

    return modelNode
开发者ID:kingofpanda,项目名称:Slicer,代码行数:35,代码来源:SubjectHierarchyGenericSelfTest.py


示例17: __init__

    def __init__(self, parent = None):
        QtGui.QMainWindow.__init__(self, parent)
 
        self.frame = QtGui.QFrame()
 
        self.vl = QtGui.QVBoxLayout()
        self.vtkWidget = QVTKRenderWindowInteractor(self.frame)
        self.vl.addWidget(self.vtkWidget)
 
        self.ren = vtk.vtkRenderer()
        self.vtkWidget.GetRenderWindow().AddRenderer(self.ren)
        self.iren = self.vtkWidget.GetRenderWindow().GetInteractor()
 
        # Create source
        source = vtk.vtkSphereSource()
        source.SetCenter(0, 0, 0)
        source.SetRadius(5.0)
 
        # Create a mapper
        mapper = vtk.vtkPolyDataMapper()
        mapper.SetInputConnection(source.GetOutputPort())
 
        # Create an actor
        actor = vtk.vtkActor()
        actor.SetMapper(mapper)
 
        self.ren.AddActor(actor)
 
        self.ren.ResetCamera()
 
        self.frame.setLayout(self.vl)
        self.setCentralWidget(self.frame)
 
        self.show()
        self.iren.Initialize()
开发者ID:behollis,项目名称:DBSViewer,代码行数:35,代码来源:vtkExamplePyQtEmbed.py


示例18: main

def main():
   #Create a sphere
   sphereSource = vtk.vtkSphereSource()
   sphereSource.SetCenter(0.0, 0.0, 0.0)
   sphereSource.SetRadius(5)
 
   #Create a mapper and actor
   mapper = vtk.vtkPolyDataMapper()
   mapper.SetInputConnection(sphereSource.GetOutputPort())
   actor = vtk.vtkActor()
   actor.SetMapper(mapper)
 
   # Setup a renderer, render window, and interactor
   renderer = vtk.vtkRenderer()
   renderWindow = vtk.vtkRenderWindow()
   #renderWindow.SetWindowName("Test")
 
   renderWindow.AddRenderer(renderer);
   renderWindowInteractor = vtk.vtkRenderWindowInteractor()
   renderWindowInteractor.SetRenderWindow(renderWindow)
 
   #Add the actor to the scene
   renderer.AddActor(actor)
   renderer.SetBackground(1,1,1) # Background color white
 
   #Render and interact
   renderWindow.Render()
 
   #*** SetWindowName after renderWindow.Render() is called***
   renderWindow.SetWindowName("Test")
 
   renderWindowInteractor.Start()
开发者ID:alon,项目名称:chibi-juggling,代码行数:32,代码来源:viewer.py


示例19: PlaneSphereActors

def PlaneSphereActors():
    ps = vtk.vtkPlaneSource()
    ps.SetXResolution(10)
    ps.SetYResolution(10)

    ss = vtk.vtkSphereSource()
    ss.SetRadius (0.3)

    group = vtk.vtkMultiBlockDataGroupFilter()
    group.AddInputConnection(ps.GetOutputPort())
    group.AddInputConnection(ss.GetOutputPort())

    ag = vtk.vtkRandomAttributeGenerator()
    ag.SetInputConnection(group.GetOutputPort())
    ag.GenerateCellScalarsOn()
    ag.AttributesConstantPerBlockOn()

    n = vtk.vtkPolyDataNormals()
    n.SetInputConnection(ag.GetOutputPort())
    n.Update ();

    actors = []
    it = n.GetOutputDataObject(0).NewIterator()
    it.InitTraversal()
    while not it.IsDoneWithTraversal():
        pm = vtk.vtkPolyDataMapper()
        pm.SetInputData(it.GetCurrentDataObject())

        a = vtk.vtkActor()
        a.SetMapper(pm)
        actors.append (a)
        it.GoToNextItem()
    return actors
开发者ID:timkrentz,项目名称:SunTracker,代码行数:33,代码来源:TestRandomAttributeGeneratorScalar.py


示例20: VtkDefineActorKPoint

def VtkDefineActorKPoint(recordGrid, renderer, radius):
  '''Returns a vtkActor to represent key-points in a rendering scene.
  It defines the scale, orientation, rendering properties, textures, ...
  
  :ivar recordGrid: unstructured grid (generic data set) to which incorporate
                    the actor KPoint
  :ivar renderer:   name of the renderer (lights, views, ...) to be used in the
                    display
  :ivar radius:     radius of the spheres to be employed in the KPoints 
                    representation
  '''
  sphereSource= vtk.vtkSphereSource()
  sphereSource.SetRadius(radius)
  sphereSource.SetThetaResolution(5)
  sphereSource.SetPhiResolution(5)
  
  markKPts= vtk.vtkGlyph3D()
  markKPts.SetInputData(recordGrid.uGrid) 
  markKPts.SetSourceData(sphereSource.GetOutput())
  markKPts.ScalingOff()
  markKPts.OrientOff()
    
  mappKPts= vtk.vtkPolyDataMapper()
  mappKPts.SetInputData(markKPts.GetOutput())

  visKPts= vtk.vtkActor()
  visKPts.SetMapper(mappKPts)
  visKPts.GetProperty().SetColor(.7, .5, .5)
    
  renderer.AddActor(visKPts)
开发者ID:lcpt,项目名称:xc,代码行数:30,代码来源:cad_mesh.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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